vagrant-vmware-esxi 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0fd559e963813bd56e7f2dedf83924abbe16706
4
- data.tar.gz: 56447256f57346e7f1b3da2de4da83d0a529c237
3
+ metadata.gz: 5335d542dafabd92713684c827886ac3c203f856
4
+ data.tar.gz: 4d13033de5ad8d8295e6e0f733d3d1523fe89d22
5
5
  SHA512:
6
- metadata.gz: 00200e42bb32d12799a69d1f50a79c9345078c4d84875017ad7c8d1cef46e168296d1ba06aab9720fc5b0e66bc9086b739ac9e938d291bfedaa54a20c44eff2e
7
- data.tar.gz: 043e6563f627a24a820f4963eff2e225ff082063db94f7bddbb8d25ec87e2d57449c9368140c16ecd2e4205e8d665931ab5122567126c9486d4bdf6e72a27d20
6
+ metadata.gz: 36030dddf5555de12bf60b7fd2b8af9bae47b4cfca5616af885db87b1f07e2256c01e112fc98fe6e6086feecfbed5c9dcc2923f15b64f7a929a2991e7d47097b
7
+ data.tar.gz: b148ae7cb8066bddd881bb053cf869510961dd6aa54e5b57f9e867697ee74101712efbbfbf57773a18166739196244ccee028ee6dae5f07d731ae4f77b51df42
data/README.md CHANGED
@@ -190,6 +190,13 @@ Vagrant.configure('2') do |config|
190
190
  # 'thin', 'thick', or 'eagerzeroedthick'
191
191
  #esxi.guest_disk_type = 'thick'
192
192
 
193
+ # OPTIONAL. Boot disk size.
194
+ # If unspecified, the boot disk size will be the same as the original
195
+ # box. You can specify a larger boot disk size in GB. The extra disk space
196
+ # will NOT automatically be available to your OS. You will need to
197
+ # create or modify partitions, LVM and/or filesystems.
198
+ #esxi.guest_boot_disk_size = 50
199
+
193
200
  # OPTIONAL. Create additional storage for guests.
194
201
  # You can specify an array of up to 13 virtual disk sizes (in GB) that you
195
202
  # would like the provider to create once the guest has been created.
@@ -268,6 +275,9 @@ Known issues with vmware_esxi
268
275
 
269
276
  Version History
270
277
  ---------------
278
+ * 2.2.0 Add support to extend boot disk size.
279
+ Fix, add many more special characters to encode in esxi passwords.
280
+
271
281
  * 2.1.0 Add support for clone_from_vm.
272
282
  Fix, use esxcli to get storage information.
273
283
 
@@ -161,6 +161,14 @@ Vagrant.configure('2') do |config|
161
161
  # 'thin', 'thick', or 'eagerzeroedthick'
162
162
  #esxi.guest_disk_type = 'thick'
163
163
 
164
+ # OPTIONAL. Boot disk size.
165
+ # If unspecified, the boot disk size will be the same as the original
166
+ # box. You can specify a larger boot disk size in GB. The extra disk space
167
+ # will NOT automatically be available to your OS. You will need to
168
+ # create or modify partitions, LVM and/or filesystems. NOTE: This will
169
+ # extend only, no shrinking.
170
+ #esxi.guest_boot_disk_size = 50
171
+
164
172
  # OPTIONAL. Create additional storage for guests.
165
173
  # You can specify an array of upto 14 virtual disk sizes (in GB) that you
166
174
  # would like the provider to create once the guest has been created. The
@@ -78,7 +78,7 @@ module VagrantPlugins
78
78
  message: "Unable to create tmp dir #{tmpdir}"
79
79
  end
80
80
  #
81
- # Source from Clone Source
81
+ # Source from Clone
82
82
  clone_from_vm_path = "vi://#{config.esxi_username}:#{$encoded_esxi_password}@#{config.esxi_hostname}/#{config.clone_from_vm}"
83
83
  ovf_cmd = "ovftool --noSSLVerify --overwrite --powerOffTarget --noDisks --targetType=vmx "\
84
84
  "#{clone_from_vm_path} #{tmpdir}"
@@ -220,9 +220,7 @@ module VagrantPlugins
220
220
  "found, using #{availnetworks.first}")
221
221
  end
222
222
  networkID += 1
223
- if networkID >= 4
224
- break
225
- end
223
+ break if networkID >= 4
226
224
  end
227
225
  end
228
226
 
@@ -322,7 +320,7 @@ module VagrantPlugins
322
320
 
323
321
  end
324
322
 
325
- # finalize vmx.
323
+ # Some vmx didn't have this set???
326
324
  unless new_vmx_contents =~ %r{^numvcpus =}i
327
325
  new_vmx_contents << "numvcpus = \"#{desired_guest_numvcpus}\"\n"
328
326
  end
@@ -463,6 +461,10 @@ module VagrantPlugins
463
461
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
464
462
  message: "Disk Type : #{guest_disk_type}")
465
463
  end
464
+ unless config.guest_boot_disk_size.nil?
465
+ env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
466
+ message: "Boot Disk Size : #{config.guest_boot_disk_size}GB")
467
+ end
466
468
  unless config.guest_storage.nil?
467
469
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
468
470
  message: "Storage (GB) : #{config.guest_storage[0..13]}")
@@ -549,8 +551,6 @@ module VagrantPlugins
549
551
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
550
552
  message: "VMID : #{env[:machine].id}")
551
553
 
552
- #
553
- # -=-=-=-=-=-=-
554
554
  # Destination (on esxi host) vmx file
555
555
  dst_vmx = ssh.exec!("vim-cmd vmsvc/get.config #{env[:machine].id} |\
556
556
  grep vmPathName|awk '{print $NF}'|sed 's/[\"|,]//g'")
@@ -567,6 +567,29 @@ module VagrantPlugins
567
567
  esxi_guest_dir = dst_vmx_file + dst_vmx_dir.strip
568
568
  dst_vmx_file << dst_vmx
569
569
 
570
+ # Extend boot disk if required
571
+ if config.guest_boot_disk_size.is_a? Integer
572
+ boot_disk = ssh.exec!("vim-cmd vmsvc/device.getdevices #{env[:machine].id} |"\
573
+ 'grep -A10 "key = 2000"|grep fileName|head -1|grep -o "\/.*.vmdk"')
574
+
575
+ puts "Boot Disk: #{boot_disk}" if config.debug =~ %r{true}i
576
+
577
+ if boot_disk.exitstatus != 0
578
+ raise Errors::ESXiError,
579
+ message: "Unable to determin boot disk"
580
+ end
581
+ cmd = "/bin/vmkfstools -X #{config.guest_boot_disk_size}G \"#{esxi_guest_dir}#{boot_disk.strip}\""
582
+ puts "cmd: #{cmd}" if config.debug =~ %r{true}i
583
+ r = ssh.exec!(cmd)
584
+ if r.exitstatus != 0
585
+ env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
586
+ message: "WARNING : Unable to extend Boot Disk to #{config.guest_boot_disk_size}GB")
587
+ else
588
+ env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
589
+ message: "Extend Boot dsk : #{config.guest_boot_disk_size}GB")
590
+ end
591
+ end
592
+
570
593
  # Create storage if required
571
594
  if config.guest_storage.is_a? Array
572
595
  index = -1
@@ -582,13 +605,11 @@ module VagrantPlugins
582
605
  else
583
606
  env[:ui].info I18n.t('vagrant_vmware_esxi.vagrant_vmware_esxi_message',
584
607
  message: "Creating Storage: disk_#{index}.vmdk (#{store_size}GB)")
585
-
586
608
  # Figure out what SCSI slots are used.
587
609
  r = ssh.exec!("vim-cmd vmsvc/device.getdevices #{machine.id}|"\
588
610
  "grep -A 30 vim.vm.device.VirtualDisk|"\
589
611
  "grep -e controllerKey -e unitNumber|grep -A 1 'controllerKey = 1000,'|"\
590
612
  "grep unitNumber|awk '{print $3}'|sed 's/,//g'")
591
-
592
613
  if r.length < 2
593
614
  raise Errors::ESXiError,
594
615
  message: "Unable to get guest storage configuration:\n"\
@@ -600,7 +621,6 @@ module VagrantPlugins
600
621
  if r !~ %r{^#{slot.to_s}$}i
601
622
  puts "Avail slot: #{slot}" if config.debug =~ %r{true}i
602
623
  guest_disk_type = 'zeroedthick' if guest_disk_type == 'thick'
603
-
604
624
  cmd = "/bin/vmkfstools -c #{store_size}G -d #{guest_disk_type} \"#{esxi_guest_dir}/disk_#{index}.vmdk\""
605
625
  puts "cmd: #{cmd}" if config.debug =~ %r{true}i
606
626
  r = ssh.exec!(cmd)
@@ -668,9 +688,7 @@ module VagrantPlugins
668
688
  end
669
689
  end
670
690
  end
671
- if line_changed == false
672
- new_vmx_contents << line
673
- end
691
+ new_vmx_contents << line if line_changed == false
674
692
  end
675
693
  end
676
694
 
@@ -728,6 +746,13 @@ module VagrantPlugins
728
746
  end
729
747
  ssh.loop
730
748
 
749
+ r = ssh.exec!("vim-cmd vmsvc/reload #{env[:machine].id}")
750
+ vmid = r
751
+ if r.exitstatus != 0
752
+ raise Errors::ESXiError,
753
+ message: "Unable to reload vmx."
754
+ end
755
+
731
756
  # Done
732
757
  end
733
758
  end
@@ -108,17 +108,39 @@ module VagrantPlugins
108
108
  #
109
109
  # Encode special characters in PW
110
110
  #
111
- $encoded_esxi_password = $esxi_password.gsub('%', '%25').gsub(\
112
- '<', '%3c').gsub('>', '%3e').gsub(\
113
- '[', '%5b').gsub(']', '%5d').gsub(\
114
- '(', '%28').gsub(')', '%29').gsub(\
115
- '@', '%40').gsub('#', '%23').gsub(\
116
- '&', '%26').gsub(':', '%3a').gsub(\
117
- '/', '%2f').gsub('\\','%5c').gsub(\
118
- '"', '%22').gsub('\'','%27').gsub(\
119
- '*', '%2a').gsub('?', '%3f').gsub(\
120
- '$', '%24').gsub(' ', '%20').gsub(\
121
- '/', '%2f')
111
+ $encoded_esxi_password = $esxi_password.gsub('%', '%25').\
112
+ gsub(' ', '%20').\
113
+ gsub('!', '%21').\
114
+ gsub('"', '%22').\
115
+ gsub('#', '%23').\
116
+ gsub('$', '%24').\
117
+ gsub('&', '%26').\
118
+ gsub('\'','%27').\
119
+ gsub('(', '%28').\
120
+ gsub(')', '%29').\
121
+ gsub('*', '%2a').\
122
+ gsub('+', '%2b').\
123
+ gsub(',', '%2c').\
124
+ gsub('-', '%2d').\
125
+ gsub('.', '%2e').\
126
+ gsub('/', '%2f').\
127
+ gsub(':', '%3a').\
128
+ gsub(';', '%3b').\
129
+ gsub('<', '%3c').\
130
+ gsub('=', '%3d').\
131
+ gsub('>', '%3e').\
132
+ gsub('?', '%3f').\
133
+ gsub('@', '%40').\
134
+ gsub('[', '%5b').\
135
+ gsub('\\','%5c').\
136
+ gsub(']', '%5d').\
137
+ gsub('^', '%5e').\
138
+ gsub('_', '%5f').\
139
+ gsub('`', '%60').\
140
+ gsub('{', '%7b').\
141
+ gsub('|', '%7c').\
142
+ gsub('}', '%7d').\
143
+ gsub('~', '%7e')
122
144
 
123
145
  @logger.info('vagrant-vmware-esxi, connect_esxi: local_private_keys: '\
124
146
  "#{config.local_private_keys}")
@@ -17,6 +17,7 @@ module VagrantPlugins
17
17
  attr_accessor :guest_name_prefix
18
18
  attr_accessor :guest_guestos
19
19
  attr_accessor :guest_disk_type
20
+ attr_accessor :guest_boot_disk_size
20
21
  attr_accessor :guest_storage
21
22
  attr_accessor :guest_nic_type
22
23
  attr_accessor :guest_mac_address
@@ -73,6 +74,7 @@ module VagrantPlugins
73
74
  @guest_name_prefix = 'V-'
74
75
  @guest_guestos = nil
75
76
  @guest_disk_type = nil
77
+ @guest_boot_disk_size = nil
76
78
  @guest_storage = nil
77
79
  @guest_nic_type = nil
78
80
  @guest_mac_address = ["","","",""]
@@ -364,6 +366,8 @@ module VagrantPlugins
364
366
 
365
367
  @guest_username = nil if @guest_username == UNSET_VALUE
366
368
 
369
+ @guest_boot_disk_size = @guest_boot_disk_size.to_i if @guest_boot_disk_size.is_a? String
370
+ @guest_boot_disk_size = nil if @guest_boot_disk_size == 0
367
371
  @guest_storage = [@guest_storage.to_i] if @guest_storage.is_a? String
368
372
  @guest_storage = [@guest_storage] if @guest_storage.is_a? Integer
369
373
 
@@ -373,7 +377,6 @@ module VagrantPlugins
373
377
 
374
378
  @local_private_keys = @system_private_keys if @local_private_keys == nil
375
379
 
376
- # @guest_virtualhw_version = @guest_virtualhw_version.to_i unless @guest_virtualhw_version.nil?
377
380
 
378
381
  if @local_lax =~ /true/i
379
382
  @local_lax = 'True'
@@ -1,7 +1,7 @@
1
1
  # VERSION
2
2
  module VagrantPlugins
3
3
  module ESXi
4
- VERSION = '2.1.0'
4
+ VERSION = '2.2.0'
5
5
  $vagrant_vmware_esxi_version = VERSION
6
6
  end
7
7
  end
@@ -3,7 +3,7 @@ require File.expand_path('../lib/vagrant-vmware-esxi/version', __FILE__)
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'vagrant-vmware-esxi'
5
5
  s.version = VagrantPlugins::ESXi::VERSION
6
- s.date = '2018-04-01'
6
+ s.date = '2018-04-13'
7
7
  s.summary = 'Vagrant ESXi provider plugin'
8
8
  s.description = 'A Vagrant plugin that adds a VMware ESXi provider support'
9
9
  s.authors = ['Jonathan Senkerik']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-vmware-esxi
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Senkerik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-01 00:00:00.000000000 Z
11
+ date: 2018-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n