chef-provisioning-vsphere 0.7.2 → 0.8.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: 3cffce0a191ef6fba36015eadf1a40fb8687c1ca
4
- data.tar.gz: d0d511dc2dd2c5bd6c17931b92841fedbb182e87
3
+ metadata.gz: a65afc7e0935c6aee4039c0c06e1bed99bd9efce
4
+ data.tar.gz: ac5179279549c85fd161a44581a89333cb5820d3
5
5
  SHA512:
6
- metadata.gz: 5fb15e79f694db0a9ad4881e86ace5e406b93bf4ef4017127b04616ce36c2efe80869a57299f32c4a67ebb1b3881b609173d9195be1ee30f39965a279cd36dd8
7
- data.tar.gz: 454a31fdee270a2263f73626ebd1d720fd8e69510b4ce981eaf3e6a243813f09cd5aeb5aea57c3d9e97cd3a8f1f5d6768bee283df44bd6961a606d12ca6261dd
6
+ metadata.gz: 36ce534cda40ec7e9bd8fe06f2403eedc66ce4ac33fe9f053d998fe69b0812e02f968e2c99f8166027c15449037c85482f418d0570d9068760f15201a09a46a2
7
+ data.tar.gz: 72ae2902ccf4a6adaa4ff74c1df2aadb93904a68864b9caea4c5678c6513d3006da943a9c04813347e74a422530b4fc945fc9e212dfee2896be1a32700399f7f
data/README.md CHANGED
@@ -84,7 +84,7 @@ This will use chef-zero and needs no chef server (only works for ssh). Note that
84
84
  - `[:memory_mb]` - number of megabytes to allocate for machine
85
85
  - `[:host]` - `{cluster}`/`{host}` to use during provisioning
86
86
  - `[:resource_pool]` - `{cluster}`/`{resource pool}` to use during provisioning
87
- - `[:additional_disk_size_gb]` - if provided an additional disk will be added with the specified number of gigabytes (*his requires a datastore to be specified*)
87
+ - `[:additional_disk_size_gb]` - an array of numbers, each signifying the number of gigabytes to assign to an additional disk (*his requires a datastore to be specified*)
88
88
  - `[:ssh][:user]` user to use for ssh/winrm (defaults to root on linux/administrator on windows)
89
89
  - `[:ssh][:password]` - password to use for ssh/winrm
90
90
  - `[:ssh][:paranoid]` - specifies the strictness of the host key verification checking
@@ -113,7 +113,7 @@ These are settings set at the root of `machine_options`. Chances are the default
113
113
 
114
114
  ## More config examples
115
115
 
116
- ### Static IP and an additional 50GB disk
116
+ ### Static IP and two additional disks of 20 and 50GB
117
117
 
118
118
  ```
119
119
  with_machine_options :bootstrap_options => {
@@ -125,7 +125,7 @@ with_machine_options :bootstrap_options => {
125
125
  resource_pool: 'cluster',
126
126
  template_name: 'path to template',
127
127
  datastore: "my_data_store",
128
- additional_disk_size_gb: 50,
128
+ additional_disk_size_gb: [50,20],
129
129
  customization_spec: {
130
130
  ipsettings: {
131
131
  ip: '192.168.3.4',
@@ -508,11 +508,25 @@ module ChefProvisioningVsphere
508
508
 
509
509
  vm = vsphere_helper.find_vm(vm_folder, machine_name)
510
510
 
511
- if bootstrap_options[:additional_disk_size_gb].to_i > 0
511
+ additional_disk_size_gb = bootstrap_options[:additional_disk_size_gb]
512
+ if !additional_disk_size_gb.is_a?(Array)
513
+ additional_disk_size_gb = [additional_disk_size_gb]
514
+ end
515
+
516
+ additional_disk_size_gb.each do |size|
517
+ size = size.to_i
518
+ next if size == 0
519
+ if bootstrap_options[:datastore].to_s.empty?
520
+ raise ':datastore must be specified when adding a disk to a cloned vm'
521
+ end
512
522
  task = vm.ReconfigVM_Task(
513
523
  spec: RbVmomi::VIM.VirtualMachineConfigSpec(
514
524
  deviceChange: [
515
- vsphere_helper.virtual_disk_for(vm, bootstrap_options)
525
+ vsphere_helper.virtual_disk_for(
526
+ vm,
527
+ bootstrap_options[:datastore],
528
+ size
529
+ )
516
530
  ]
517
531
  )
518
532
  )
@@ -1,3 +1,3 @@
1
1
  module ChefProvisioningVsphere
2
- VERSION = '0.7.2'
2
+ VERSION = '0.8.0'
3
3
  end
@@ -152,10 +152,7 @@ module ChefProvisioningVsphere
152
152
  end
153
153
  end
154
154
 
155
- def virtual_disk_for(vm, options)
156
- if options[:datastore].to_s.empty?
157
- raise ':datastore must be specified when adding a disk to a cloned vm'
158
- end
155
+ def virtual_disk_for(vm, datastore, size_gb)
159
156
  idx = vm.disks.count
160
157
  RbVmomi::VIM::VirtualDeviceConfigSpec(
161
158
  :operation => :add,
@@ -163,11 +160,11 @@ module ChefProvisioningVsphere
163
160
  :device => RbVmomi::VIM.VirtualDisk(
164
161
  :key => idx,
165
162
  :backing => RbVmomi::VIM.VirtualDiskFlatVer2BackingInfo(
166
- :fileName => "[#{options[:datastore]}]",
163
+ :fileName => "[#{datastore}]",
167
164
  :diskMode => 'persistent',
168
165
  :thinProvisioned => true
169
166
  ),
170
- :capacityInKB => options[:additional_disk_size_gb] * 1024 * 1024,
167
+ :capacityInKB => size_gb * 1024 * 1024,
171
168
  :controllerKey => 1000,
172
169
  :unitNumber => idx
173
170
  )
@@ -107,7 +107,10 @@ describe 'vsphere_driver' do
107
107
  end
108
108
  it 'has an added disk of the correct size' do
109
109
  disk_count = @vm.disks.count
110
- expect(@vm.disks[disk_count-1].capacityInKB).to eq(@metal_config[:machine_options][:bootstrap_options][:additional_disk_size_gb] * 1024 * 1024)
110
+ expect(@vm.disks[disk_count-1].capacityInKB).to eq(@metal_config[:machine_options][:bootstrap_options][:additional_disk_size_gb][1] * 1024 * 1024)
111
+ end
112
+ it 'has the correct number of disks' do
113
+ expect(@vm.disks.count).to eq(3)
111
114
  end
112
115
  it 'has hot add cpu enabled' do
113
116
  expect(@vm.config.cpuHotAddEnabled).to eq(true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning-vsphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CenturyLink Cloud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-19 00:00:00.000000000 Z
11
+ date: 2015-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbvmomi