Skip to content

Commit 0409781

Browse files
committed
v2.4.5 Do not wait for when resuming a VM that is not able to be resumed.
1 parent 8cf89e3 commit 0409781

File tree

10 files changed

+61
-37
lines changed

10 files changed

+61
-37
lines changed

ESXi_guestos_types.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ VMware ESXi 6.5 guestOS types
33

44
Based on my research and some trial & error, I made this list of guestOS types that are compatible with ESXi 6.5. I started with some api documenation from vmware that listed guestOS types.
55

6-
>http://pubs.vmware.com/vsphere-6-5/index.jsp#com.vmware.wssdk.apiref.doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html
6+
>http://pubs.vmware.com/vsphere-65/topic/com.vmware.wssdk.apiref.doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html
7+
>https://code.vmware.com/apis/358/vsphere#/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html
78
89
But they didn't quite work when put directly in the vmx file... I noticed none of my existing vmx files had the word "Guest" in guestOS line. I also noticed in the list that the 64 bit entries were inconsistent. (Some have _64, others are -64, and others are just 64.) I removed the word Guest and set all the 64 bit OS's to be standard "-64". The results seems to work for various OS's I installed, but I certainly didn't try all of these. So here is my list... Please report any errors.
910

Gemfile

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1-
source 'https://rubygems.org'
1+
#source 'https://rubygems.org'
2+
#
3+
#group :development do
4+
# #gem 'vagrant', git: 'https://github.com/hashicorp/vagrant.git', :branch => 'v2.2.3'
5+
# gem 'vagrant', git: 'https://github.com/hashicorp/vagrant.git'
6+
#end
7+
#
8+
#group :plugins do
9+
# #gemspec
10+
# gem "vagrant-vmware-esxi", path: "."
11+
#end
12+
13+
source "https://rubygems.org"
214

315
group :development do
4-
gem 'vagrant', git: 'https://github.com/hashicorp/vagrant.git'
16+
# Need to tag to 2.2.4, there is still a bug.
17+
# https://github.com/hashicorp/vagrant/pull/10945
18+
gem "vagrant", git: "https://github.com/hashicorp/vagrant.git", :tag => 'v2.2.4'
519
end
620

721
group :plugins do
8-
gemspec
22+
gem "vagrant-vmware-esxi", path: "."
923
end
24+

Gemfile.path

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'vagrant', path: '../vagrant' # checked out 'cca36d9'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ Known issues with vmware_esxi
284284

285285
Version History
286286
---------------
287+
* 2.4.5 Do not wait for `running` when resuming a VM that is not able to be resumed.
287288
* 2.4.4 Show stderr if unable to connect to ESXi host. Update GuestOS types.
288289
* 2.4.3 Update GuestOS types.
289290
* 2.4.3 Fix, Allow disk stores with "(" or ")" in their name. Add support for up to 10 virtual NICs
Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
11
#
22
# Multi machine, essential options Vagrant file example. (documentation removed)
33
#
4+
nodes = {
5+
"vm-multi1" => ["hashicorp/precise64", 1, 1024, 21 ],
6+
"vm-multi2" => ["generic/centos7", 2, 2048, 22 ],
7+
}
48

5-
nodes = [
6-
{ hostname: 'VM-multi1', box: 'hashicorp/precise64' },
7-
{ hostname: 'VM-multi2', box: 'hashicorp/precise64' }
8-
]
9+
Vagrant.configure(2) do |config|
10+
nodes.each do | (name, cfg) |
11+
box, numvcpus, memory, storage = cfg
912

10-
Vagrant.configure('2') do |config|
11-
nodes.each do |node|
12-
config.vm.define node[:hostname] do |node_config|
13-
node_config.vm.hostname = node[:hostname]
14-
node_config.vm.box = node[:box]
15-
node_config.vm.synced_folder('.', '/Vagrantfiles', type: 'rsync')
16-
end
17-
end
13+
config.vm.define name do |machine|
14+
machine.vm.box = box
15+
machine.vm.hostname = name
16+
machine.vm.synced_folder('.', '/Vagrantfiles', type: 'rsync')
1817

19-
config.vm.provider :vmware_esxi do |esxi|
20-
#
21-
# Provider settings
22-
#
23-
esxi.esxi_hostname = 'esxi'
24-
esxi.esxi_username = 'root'
25-
esxi.esxi_password = 'file:'
26-
#esxi.esxi_hostport = 22
27-
#esxi.esxi_virtual_network = 'vmnet_example'
28-
#esxi.esxi_disk_store = 'DS_001'
29-
#esxi.esxi_resource_pool = '/Vagrant'
30-
#esxi.guest_memsize = '2048'
31-
#esxi.guest_numvcpus = '2'
18+
machine.vm.provider :vmware_esxi do |esxi|
19+
esxi.esxi_hostname = 'esxi'
20+
esxi.esxi_username = 'root'
21+
esxi.esxi_password = 'file:'
22+
esxi.esxi_virtual_network = "VM Network"
23+
esxi.guest_numvcpus = numvcpus
24+
esxi.guest_memsize = memory
25+
esxi.guest_storage = storage
26+
#esxi.clone_from_vm = box
27+
esxi.local_allow_overwrite = 'True'
28+
29+
end
30+
end
3231
end
3332
end

lib/vagrant-vmware-esxi/action.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ def self.action_suspend
4747
def self.action_resume
4848
Vagrant::Action::Builder.new.tap do |b|
4949
b.use SetESXiPassword
50-
b.use ReadState
51-
b.use Resume
5250
b.use Call, ReadState do |env1, b1|
53-
if env1[:machine].state.id != :not_created
51+
if env1[:machine_state].to_s == 'not_created'
52+
b1.use Resume
53+
else
54+
b1.use Resume
5455
b1.use WaitForState, :running, 240
5556
end
5657
end

lib/vagrant-vmware-esxi/action/read_ssh_info.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def read_ssh_info(env)
5757
# Try to get first interface. This is the prefered method
5858
# when you have multiple network interfaces
5959
ssh_execute_cmd = "vim-cmd vmsvc/get.guest #{machine.id} 2>/dev/null |"
60-
ssh_execute_cmd << 'grep -A 5 "deviceConfigId = 4000" |tail -1|'
61-
ssh_execute_cmd << 'grep -oE "((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])"'
60+
ssh_execute_cmd << 'sed \'1!G;h;$!d\' |awk \'/deviceConfigId = 4000/,/ipAddress/\' |'
61+
ssh_execute_cmd << 'grep -oE "((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])" |tail -1'
6262
r = ssh.exec!(ssh_execute_cmd)
6363
ipaddress = r.strip
6464

lib/vagrant-vmware-esxi/action/resume.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def resume(env)
3030
(env[:machine_state].to_s == 'running')
3131
env[:ui].info I18n.t('vagrant_vmware_esxi.already_powered_on')
3232
elsif env[:machine_state].to_s == 'not_created'
33-
env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
33+
env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
3434
message: 'Cannot resume in this state')
3535
elsif (env[:machine_state].to_s == 'powered_off') ||
3636
(env[:machine_state].to_s == 'suspended')

lib/vagrant-vmware-esxi/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# VERSION
22
module VagrantPlugins
33
module ESXi
4-
VERSION = '2.4.4'
4+
VERSION = '2.4.5'
55
$vagrant_vmware_esxi_version = VERSION
66
end
77
end

vagrant-vmware-esxi.gemspec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@ Gem::Specification.new do |s|
1515
s.files = `git ls-files`.split($\)
1616
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
1717
s.test_files = s.files.grep(%r{^(test|spec|features)/})
18+
s.require_path = 'lib'
1819

1920
s.add_runtime_dependency 'i18n', '~> 1.0'
2021
s.add_runtime_dependency 'log4r', '~> 1.1'
2122
s.add_runtime_dependency "iniparse", '> 1.0'
22-
s.add_runtime_dependency "nokogiri", '> 1.5'
23+
s.add_runtime_dependency 'nokogiri', '~> 1.6'
24+
25+
s.add_development_dependency 'rake'
26+
s.add_development_dependency 'rspec'
2327

2428
# Needed only to support ed25519 ssh keys with net-ssh 4.x. Won't need this for net-ssh 5.x.
2529
#s.add_runtime_dependency 'rbnacl', '>= 4.0', '< 5.0'

0 commit comments

Comments
 (0)