chef-provisioning-vsphere 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +195 -64
- data/Rakefile +6 -1
- data/chef-provisioning-vsphere.gemspec +1 -0
- data/lib/chef/provisioning/vsphere_driver/driver.rb +1 -7
- data/lib/chef/provisioning/vsphere_driver/version.rb +1 -1
- data/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb +10 -12
- data/spec/integration_tests/vsphere_driver_spec.rb +30 -26
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 056663797fc34f01df8e90f6f8a09215b52cbd02
|
4
|
+
data.tar.gz: 846498ec8eaa5846614f7fd8feab39707ccfaccc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7accde606905aa4bcf0273ee976f0f3c421a6479e9af6adf4558d26bac99ccdc87d759110b206aba7a8b1873e91d520d608c2e956a9fc740514fbcba0890939
|
7
|
+
data.tar.gz: 88fd45b249a43a81d4397aab278954c83418c829121d262424601bbc6d158d98170ec975866e24974c272e140032d91ee057ecc44043f0e4e2fd88ea27fd27d3
|
data/README.md
CHANGED
@@ -3,77 +3,208 @@ chef-provisioning-vsphere
|
|
3
3
|
|
4
4
|
This is a [chef-provisioning](https://github.com/opscode/chef-provisioning) provisioner for [VMware vSphere](http://www.vmware.com/products/vsphere).
|
5
5
|
|
6
|
-
|
6
|
+
chef-provisioning-vsphere supports provisioning Unix/ssh and Windows/winrm guest VMs.
|
7
7
|
|
8
|
-
|
9
|
-
----------
|
8
|
+
## Prerequisites
|
10
9
|
|
11
|
-
###
|
10
|
+
### Vsphere infrastructure
|
12
11
|
|
13
|
-
|
12
|
+
A vcenter and valid login credentials.
|
14
13
|
|
15
|
-
|
16
|
-
- run vmware-tools on system boot (provides visiblity to ip address of the running VM)
|
17
|
-
- provide access via ssh or winrm
|
18
|
-
- provide a user account with NOPASSWD sudo/administrator
|
14
|
+
### VM Teplate
|
19
15
|
|
20
|
-
|
16
|
+
A VM template capable of installing Chef 11.8 or newer. This can be either windows or linux flavored.
|
17
|
+
|
18
|
+
### A provisioning node (can be local)
|
19
|
+
|
20
|
+
An environment equipped with the chef client and the chef-Provision-vsphere gem.
|
21
|
+
|
22
|
+
## A basic provisioning recipe
|
23
|
+
|
24
|
+
This is a minimal machine devinition that will use a dhcp assigned ip (it assumes the presense of a dhcp server). For test purposes this uses a linked clone for a faster provisioning time. This recipe should be used with a linux template. Windows provisioned servers need to point to a chef server for the cookbooks since winrm does not support port forwarding and there fore cannot reach back on the chef-zero port to get the local cookbooks. See examples below.
|
25
|
+
|
26
|
+
```
|
27
|
+
chef_gem 'chef-provisioning-vsphere' do
|
28
|
+
action :install
|
29
|
+
compile_time true
|
30
|
+
end
|
31
|
+
|
32
|
+
require 'chef/provisioning/vsphere_driver'
|
33
|
+
|
34
|
+
with_vsphere_driver host: 'vcenter-host-name',
|
35
|
+
insecure: true,
|
36
|
+
user: 'you_user_name',
|
37
|
+
password: 'your_mothers_maiden_name'
|
38
|
+
|
39
|
+
with_machine_options :bootstrap_options => {
|
40
|
+
use_linked_clone: true,
|
41
|
+
num_cpus: 2,
|
42
|
+
memory_mb: 4096,
|
43
|
+
network_name: ["vlan_20_172.21.20"],
|
44
|
+
datacenter: 'datacenter_name',
|
45
|
+
resource_pool: 'cluster',
|
46
|
+
template_name: 'path to template',
|
47
|
+
customization_spec: {
|
48
|
+
ipsettings: {
|
49
|
+
dnsServerList: ['1.2.3.31','1.2.3.41']
|
50
|
+
},
|
51
|
+
:domain => 'local'
|
52
|
+
}
|
53
|
+
:ssh => {
|
54
|
+
:user => 'root',
|
55
|
+
:password => 'password',
|
56
|
+
:paranoid => false,
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
machine "my_machine_name" do
|
61
|
+
run_list ['my_cookbook::default']
|
62
|
+
end
|
21
63
|
|
22
64
|
```
|
23
|
-
chef_gem 'chef-provisioning-vsphere' do
|
24
|
-
action :install
|
25
|
-
compile_time true
|
26
|
-
end
|
27
|
-
|
28
|
-
require 'chef/provisioning/vsphere_driver'
|
29
|
-
|
30
|
-
with_vsphere_driver host: 'vcenter-host-name',
|
31
|
-
insecure: true,
|
32
|
-
user: 'you_user_name',
|
33
|
-
password: 'your_mothers_maiden_name'
|
34
|
-
|
35
|
-
machine_options = {
|
36
|
-
:bootstrap_options => {
|
37
|
-
:num_cpus => 2,
|
38
|
-
:additional_disk_size_gb => 50,
|
39
|
-
:memory_mb => 4096,
|
40
|
-
:network_name => ["vlan_20_172.21.20"],
|
41
|
-
:datacenter 'datacenter_name',
|
42
|
-
:host: 'cluster/host',
|
43
|
-
:resource_pool: 'cluster/resource_pool_name',
|
44
|
-
:datastore: 'datastore_name',
|
45
|
-
:template_name: 'path to template_vm', # may be a VM or a VM Template
|
46
|
-
:vm_folder 'folder_to_clone_vms_into',
|
47
|
-
:customization_spec => {
|
48
|
-
:ipsettings => {
|
49
|
-
:ip => '1.2.3.125',
|
50
|
-
:subnetMask => '255.255.255.0',
|
51
|
-
:gateway => ["1.2.3.1"],
|
52
|
-
:dnsServerList => ["1.2.3.31","1.2.3.41"]
|
53
|
-
},
|
54
|
-
:domain => 'local',
|
55
|
-
:domainAdmin => "administrator@local",
|
56
|
-
:domainAdminPassword => "Password",
|
57
|
-
:org_name => 'my_company',
|
58
|
-
:product_id => 'xxxxx-xxxxx-xxxxx-xxxxx-xxxxx',
|
59
|
-
:win_time_zone => 4
|
60
|
-
}
|
61
|
-
:ssh => {
|
62
|
-
:user => 'administrator',
|
63
|
-
:password => 'password',
|
64
|
-
:paranoid => false,
|
65
|
-
:port => 22
|
66
|
-
},
|
67
|
-
:convergence_options => {
|
68
|
-
:install_msi_url=>"https://opscode-omnibus-packages.s3.amazonaws.com/windows/2008r2/x86_64/chef-windows-11.16.4-1.windows.msi",
|
69
|
-
:install_sh_url=>"/tmp/chef-install.sh -v 11.16.4"
|
70
|
-
}
|
71
|
-
}
|
72
|
-
|
73
|
-
machine "my_machine_name" do
|
74
|
-
machine_options machine_options
|
75
|
-
run_list ['my_cookbook::default']
|
76
|
-
end
|
77
65
|
|
66
|
+
## Provision!
|
67
|
+
|
68
|
+
```
|
69
|
+
chef-client -z -o 'my_cookbook::provision'
|
78
70
|
```
|
79
71
|
|
72
|
+
This will use chef-zero and needs no chef server (only works for ssh). Note that chef-zero does not support berkshelf style cookbook dependency resolution. So this works if the cookbook in the machine's runlist has no external dependencies. If it needs to reach out to supermarket or another berkshelf API server, perform a `berks vendor` to pull down the dependencies first.
|
73
|
+
|
74
|
+
## Supported machine bootstrapping options
|
75
|
+
|
76
|
+
- `[:use_linked_clone]` - (true/false) great for testing but not recommended for production.
|
77
|
+
- `[:datacenter]` - Name of vsphere datacenter (*required*)
|
78
|
+
- `[:template_name]` - path to vmware template (can be template or a shutown vm) (*required*)
|
79
|
+
- `[:vm_folder]` - path to a folder where the machine will be created.
|
80
|
+
- `[:datastore]` - name of datastore to use
|
81
|
+
- `[:num_cpus]` - number of cpus to allocate to machine
|
82
|
+
- `[:network_name]` - array of network names to use. A NIC will be added for each
|
83
|
+
- `[:memory_mb]` - number of megabytes to allocate for machine
|
84
|
+
- `[:host]` - `{cluster}`/`{host}` to use during provisioning
|
85
|
+
- `[:resource_pool]` - `{cluster}`/`{resource pool}` to use during provisioning
|
86
|
+
- `[: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
|
+
- `[:ssh][:user]` user to use for ssh/winrm (defaults to root on linux/administrator on windows)
|
88
|
+
- `[:ssh][:password]` - password to use for ssh/winrm
|
89
|
+
- `[:ssh][:paranoid]` - specifies the strictness of the host key verification checking
|
90
|
+
- `[:ssh][:port]` port to use for ssh/winrm (defaults to 22 for ssh or 5985 for winrm)
|
91
|
+
- `[:convergence_options][:install_msi_url]` - url to chef client msi to use (defaults to latest)
|
92
|
+
- `[:convergence_options][:install_sh_url]` - the bach script to install chef client on linux (defaults to latest)
|
93
|
+
- `[:customization_spec][:ipsettings][:ip]` static ip to assign to machine
|
94
|
+
- `[:customization_spec][:ipsettings][:subnetMask]` - subnet to use
|
95
|
+
- `[:customization_spec][:ipsettings][:gateway]` - gateway to use
|
96
|
+
- `[:customization_spec][:ipsettings][:dnsServerList]` - array of DNS servers to use
|
97
|
+
- `[:customization_spec][:domain]` - domain to use (if not 'local' on a windows machine it will attempt to domain join)
|
98
|
+
- `[:customization_spec][:domainAdmin]` - domain admin account to use for domain join on windows (should be `{user name}`@`{domain}`)
|
99
|
+
- `[:customization_spec][:domainAdminPassword]` - domain administrator password
|
100
|
+
- `[:customization_spec][:org_name]` - org name used in sysprep on windows
|
101
|
+
- `[:customization_spec][:product_id]` - windows product key
|
102
|
+
- `[:customization_spec][:win_time_zone]` - numeric time zone for windows
|
103
|
+
|
104
|
+
## More config examples
|
105
|
+
|
106
|
+
### Static IP and an additional 50GB disk
|
107
|
+
|
108
|
+
```
|
109
|
+
with_machine_options :bootstrap_options => {
|
110
|
+
use_linked_clone: true,
|
111
|
+
num_cpus: 2,
|
112
|
+
memory_mb: 4096,
|
113
|
+
network_name: ["vlan_20_172.21.20"],
|
114
|
+
datacenter: 'datacenter_name',
|
115
|
+
resource_pool: 'cluster',
|
116
|
+
template_name: 'path to template',
|
117
|
+
datastore: "my_data_store",
|
118
|
+
additional_disk_size_gb: 50,
|
119
|
+
customization_spec: {
|
120
|
+
ipsettings: {
|
121
|
+
ip: '192.168.3.4',
|
122
|
+
subnetMask: '255.255.255.0',
|
123
|
+
gateway: ["192.168.3.1"],
|
124
|
+
dnsServerList: ['1.2.3.31','1.2.3.41']
|
125
|
+
},
|
126
|
+
:domain => 'local'
|
127
|
+
}
|
128
|
+
:ssh => {
|
129
|
+
:user => 'root',
|
130
|
+
:password => 'password',
|
131
|
+
:paranoid => false,
|
132
|
+
}
|
133
|
+
}
|
134
|
+
```
|
135
|
+
|
136
|
+
### Domain joined windows machine
|
137
|
+
|
138
|
+
Note: You must run chef-client against a server for a windows box. You cn do this locally since the provisioning recipe should not change the state of the provisioner. You will need to upload the cookbook (both the one doing the provisioning and the one used in the provisioned machine's runlist) before running `chef-client`.
|
139
|
+
|
140
|
+
```
|
141
|
+
with_machine_options :bootstrap_options => {
|
142
|
+
use_linked_clone: true,
|
143
|
+
num_cpus: 2,
|
144
|
+
memory_mb: 4096,
|
145
|
+
network_name: ["vlan_20_172.21.20"],
|
146
|
+
datacenter: 'datacenter_name',
|
147
|
+
resource_pool: 'cluster',
|
148
|
+
template_name: 'path to template',
|
149
|
+
customization_spec: {
|
150
|
+
ipsettings: {
|
151
|
+
dnsServerList: ['1.2.3.31','1.2.3.41']
|
152
|
+
},
|
153
|
+
domain => 'blah.com',
|
154
|
+
domainAdmin => "administrator@blah.com",
|
155
|
+
domainAdminPassword => "Passwordyoyoyo",
|
156
|
+
org_name => 'acme',
|
157
|
+
product_id => 'CDAA-87DC-3455-FF77-2AAC',
|
158
|
+
win_time_zone => 4
|
159
|
+
}
|
160
|
+
:ssh => {
|
161
|
+
:user => 'administrator',
|
162
|
+
:password => 'password',
|
163
|
+
:paranoid => false,
|
164
|
+
}
|
165
|
+
}
|
166
|
+
```
|
167
|
+
|
168
|
+
## Kitchen Driver
|
169
|
+
|
170
|
+
This chef-provisioning-driver comes with a test-kitchen driver. Here are example driver options you can add to your `kitchen.yml`.
|
171
|
+
|
172
|
+
```
|
173
|
+
driver_plugin: vsphere
|
174
|
+
driver_config:
|
175
|
+
driver_options:
|
176
|
+
host: '1.2.3.5'
|
177
|
+
user: 'user'
|
178
|
+
password: 'pass'
|
179
|
+
insecure: true
|
180
|
+
machine_options:
|
181
|
+
start_timeout: 600
|
182
|
+
create_timeout: 600
|
183
|
+
ready_timeout: 90
|
184
|
+
bootstrap_options:
|
185
|
+
use_linked_clone: true
|
186
|
+
datacenter: 'DC'
|
187
|
+
template_name: 'UBUNTU1264'
|
188
|
+
vm_folder: 'TEST'
|
189
|
+
num_cpus: 2,
|
190
|
+
network_name:
|
191
|
+
- vlan_20_1.2.3.4
|
192
|
+
memory_mb: 4096
|
193
|
+
resource_pool: 'CLSTR/TEST'
|
194
|
+
ssh:
|
195
|
+
user: root
|
196
|
+
paranoid: false
|
197
|
+
password: password
|
198
|
+
port: 22
|
199
|
+
convergence_options:
|
200
|
+
customization_spec:
|
201
|
+
domain: local
|
202
|
+
ipsettings:
|
203
|
+
dnsServerList:
|
204
|
+
- 8.8.8.8
|
205
|
+
- 8.8.4.4
|
206
|
+
```
|
207
|
+
|
208
|
+
## Contributions are welcome!
|
209
|
+
|
210
|
+
We took care to make this driver as generic as possible but there wll certainly be implementation nuances that may not work for everyone. We are happy to accept contributions to improve the driver and make it more accessible to a broader set of use cases.
|
data/Rakefile
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
|
+
require 'chef/provisioning/vsphere_driver/version'
|
2
3
|
require 'rspec/core/rake_task'
|
4
|
+
require "rubocop/rake_task"
|
3
5
|
|
4
6
|
$:.unshift(File.dirname(__FILE__) + '/lib')
|
5
|
-
|
7
|
+
|
8
|
+
RuboCop::RakeTask.new(:style) do |task|
|
9
|
+
task.options << "--display-cop-names"
|
10
|
+
end
|
6
11
|
|
7
12
|
RSpec::Core::RakeTask.new(:unit) do |task|
|
8
13
|
task.pattern = 'spec/unit_tests/*_spec.rb'
|
@@ -167,7 +167,6 @@ module ChefProvisioningVsphere
|
|
167
167
|
bootstrap_options[:vm_folder],
|
168
168
|
machine_spec.name
|
169
169
|
)
|
170
|
-
server_id = nil
|
171
170
|
if vm
|
172
171
|
Chef::Log.info machine_msg(
|
173
172
|
machine_spec.name,
|
@@ -485,14 +484,9 @@ module ChefProvisioningVsphere
|
|
485
484
|
end
|
486
485
|
|
487
486
|
def clone_vm(action_handler, bootstrap_options, machine_name)
|
488
|
-
vm = find_vm(bootstrap_options[:vm_folder], machine_name)
|
489
|
-
return vm if vm
|
490
|
-
|
491
|
-
vm_template = vm_template_for(bootstrap_options)
|
492
|
-
|
493
487
|
do_vm_clone(
|
494
488
|
action_handler,
|
495
|
-
|
489
|
+
vm_template_for(bootstrap_options),
|
496
490
|
machine_name,
|
497
491
|
bootstrap_options
|
498
492
|
)
|
@@ -26,10 +26,9 @@ module ChefProvisioningVsphere
|
|
26
26
|
@current_connection
|
27
27
|
end
|
28
28
|
|
29
|
-
def find_vm(
|
30
|
-
folder = find_folder(
|
31
|
-
|
32
|
-
vm = folder.find(vm_name, RbVmomi::VIM::VirtualMachine)
|
29
|
+
def find_vm(folder, vm_name)
|
30
|
+
folder = find_folder(folder) unless folder.is_a? RbVmomi::VIM::Folder
|
31
|
+
folder.find(vm_name, RbVmomi::VIM::VirtualMachine)
|
33
32
|
end
|
34
33
|
|
35
34
|
def find_vm_by_id(uuid, connection = vim)
|
@@ -99,12 +98,10 @@ module ChefProvisioningVsphere
|
|
99
98
|
#folder could be like: /Level1/Level2/folder_name
|
100
99
|
def find_folder(folder_name)
|
101
100
|
base = datacenter.vmFolder
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
f.name == item
|
107
|
-
end
|
101
|
+
unless folder_name.nil?
|
102
|
+
folder_name.split('/').reject(&:empty?).each do |item|
|
103
|
+
base = base.find(item, RbVmomi::VIM::Folder) ||
|
104
|
+
raise("vSphere Folder not found [#{folder_name}]")
|
108
105
|
end
|
109
106
|
end
|
110
107
|
base
|
@@ -168,13 +165,14 @@ module ChefProvisioningVsphere
|
|
168
165
|
clone_spec.config.deviceChange = changes
|
169
166
|
end
|
170
167
|
|
168
|
+
vm_folder = find_folder(options[:vm_folder])
|
171
169
|
vm_template.CloneVM_Task(
|
172
170
|
name: vm_name,
|
173
|
-
folder:
|
171
|
+
folder: vm_folder,
|
174
172
|
spec: clone_spec
|
175
173
|
).wait_for_completion
|
176
174
|
|
177
|
-
vm = find_vm(
|
175
|
+
vm = find_vm(vm_folder, vm_name)
|
178
176
|
|
179
177
|
if options[:additional_disk_size_gb].to_i > 0
|
180
178
|
task = vm.ReconfigVM_Task(:spec => RbVmomi::VIM.VirtualMachineConfigSpec(:deviceChange => [virtual_disk_for(vm, options)]))
|
@@ -33,7 +33,7 @@ require 'chef/provisioning/machine_spec'
|
|
33
33
|
# }
|
34
34
|
# }
|
35
35
|
|
36
|
-
describe
|
36
|
+
describe 'vsphere_driver' do
|
37
37
|
include ChefProvisioningVsphere::Helpers
|
38
38
|
|
39
39
|
before :all do
|
@@ -54,93 +54,97 @@ describe "vsphere_driver" do
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
|
58
57
|
context 'when allocating a machine' do
|
59
58
|
|
60
|
-
it
|
59
|
+
it 'adds machine to the correct folder' do
|
61
60
|
expect(@vm.parent.name).to eq(@metal_config[:machine_options][:bootstrap_options][:vm_folder])
|
62
61
|
end
|
63
|
-
it
|
62
|
+
it 'has a matching id with the machine_spec' do
|
64
63
|
expect(@vm.config.instanceUuid).to eq(@machine_spec.location['server_id'])
|
65
64
|
end
|
66
|
-
it
|
65
|
+
it 'has the correct name' do
|
67
66
|
now = Time.now.utc
|
68
67
|
trimmed_name = @vm.config.guestId.start_with?('win') ? @vm_name.byteslice(0,15) : @vm_name
|
69
68
|
expected_name="#{trimmed_name}.#{@metal_config[:machine_options][:bootstrap_options][:customization_spec][:domain]}"
|
70
69
|
until (Time.now.utc - now) > 30 || (@vm.guest.hostName == expected_name) do
|
71
|
-
print
|
70
|
+
print '.'
|
72
71
|
sleep 5
|
73
72
|
end
|
74
73
|
expect(@vm.guest.hostName).to eq(expected_name)
|
75
74
|
end
|
76
|
-
it
|
75
|
+
it 'has the correct number of CPUs' do
|
77
76
|
expect(@vm.config.hardware.numCPU).to eq(@metal_config[:machine_options][:bootstrap_options][:num_cpus])
|
78
77
|
end
|
79
|
-
it
|
78
|
+
it 'has the correct amount of memory' do
|
80
79
|
expect(@vm.config.hardware.memoryMB).to eq(@metal_config[:machine_options][:bootstrap_options][:memory_mb])
|
81
80
|
end
|
82
|
-
it
|
81
|
+
it 'is on the correct networks' do
|
83
82
|
expect(@vm.network.map {|n| n.name}).to include(@metal_config[:machine_options][:bootstrap_options][:network_name][0])
|
84
83
|
expect(@vm.network.map {|n| n.name}).to include(@metal_config[:machine_options][:bootstrap_options][:network_name][1])
|
85
84
|
end
|
86
|
-
it
|
85
|
+
it 'is on the correct datastore' do
|
87
86
|
expect(@vm.datastore[0].name).to eq(@metal_config[:machine_options][:bootstrap_options][:datastore])
|
88
87
|
end
|
89
|
-
it
|
88
|
+
it 'is in the correct resource pool' do
|
90
89
|
if @metal_config[:machine_options][:bootstrap_options].has_key?(:resource_pool)
|
91
90
|
expect(@vm.resourcePool.name).to eq(@metal_config[:machine_options][:bootstrap_options][:resource_pool].split('/')[1])
|
92
91
|
end
|
93
92
|
end
|
94
|
-
it
|
93
|
+
it 'is in the correct host' do
|
95
94
|
if @metal_config[:machine_options][:bootstrap_options].has_key?(:host)
|
96
95
|
expect(@vm.runtime.host.name).to eq(@metal_config[:machine_options][:bootstrap_options][:host].split('/')[1])
|
97
96
|
end
|
98
97
|
end
|
99
|
-
it
|
98
|
+
it 'is in the correct cluster' do
|
100
99
|
if @metal_config[:machine_options][:bootstrap_options].has_key?(:resource_pool)
|
101
100
|
expect(@vm.resourcePool.owner.name).to eq(@metal_config[:machine_options][:bootstrap_options][:resource_pool].split('/')[0])
|
102
101
|
end
|
103
102
|
end
|
104
|
-
it
|
103
|
+
it 'is in the correct datacenter' do
|
105
104
|
expect(@connection.serviceInstance.find_datacenter(@metal_config[:machine_options][:bootstrap_options][:datacenter]).find_vm("#{@vm.parent.name}/#{@vm_name}")).not_to eq(nil)
|
106
105
|
end
|
107
|
-
it
|
106
|
+
it 'has an added disk of the correct size' do
|
108
107
|
disk_count = @vm.disks.count
|
109
108
|
expect(@vm.disks[disk_count-1].capacityInKB).to eq(@metal_config[:machine_options][:bootstrap_options][:additional_disk_size_gb] * 1024 * 1024)
|
110
109
|
end
|
111
|
-
it
|
110
|
+
it 'has hot add cpu enabled' do
|
112
111
|
expect(@vm.config.cpuHotAddEnabled).to eq(true)
|
113
112
|
end
|
114
|
-
it
|
113
|
+
it 'has hot remove cpu enabled' do
|
115
114
|
expect(@vm.config.cpuHotRemoveEnabled).to eq(true)
|
116
115
|
end
|
117
|
-
it
|
116
|
+
it 'has hot add memory enabled' do
|
118
117
|
expect(@vm.config.memoryHotAddEnabled).to eq(true)
|
119
118
|
end
|
120
|
-
it
|
119
|
+
it 'has the correct IP address' do
|
121
120
|
now = Time.now.utc
|
122
|
-
until (Time.now.utc - now) > 30 || (@vm.guest.toolsRunningStatus ==
|
123
|
-
print
|
121
|
+
until (Time.now.utc - now) > 30 || (@vm.guest.toolsRunningStatus == 'guestToolsRunning' && @vm.guest.net.count == 2 && @vm.guest.net[1].ipAddress[1] == @metal_config[:machine_options][:bootstrap_options][:customization_spec][:ipsettings][:ip]) do
|
122
|
+
print '.'
|
124
123
|
sleep 5
|
125
124
|
end
|
126
125
|
expect(@vm.guest.net.map { |net| net.ipAddress}.flatten).to include(@metal_config[:machine_options][:bootstrap_options][:customization_spec][:ipsettings][:ip])
|
127
126
|
end
|
128
127
|
end
|
129
128
|
|
130
|
-
context
|
129
|
+
context 'destroy_machine' do
|
131
130
|
|
132
|
-
it
|
131
|
+
it 'removes the machine' do
|
133
132
|
Cheffish.honor_local_mode do
|
134
133
|
chef_server = Cheffish.default_chef_server
|
135
134
|
url = URI::VsphereUrl.from_config(@metal_config[:driver_options]).to_s
|
136
135
|
driver = Chef::Provisioning.driver_for_url(url, @metal_config)
|
137
136
|
action_handler = Chef::Provisioning::ActionHandler.new
|
138
|
-
machine_spec = Chef::Provisioning.chef_managed_entry_store(chef_server)
|
139
|
-
|
137
|
+
machine_spec = Chef::Provisioning.chef_managed_entry_store(chef_server)
|
138
|
+
.new_entry(:machine, @vm_name)
|
139
|
+
machine_spec.location = {
|
140
140
|
'driver_url' => driver.driver_url,
|
141
141
|
'server_id' => @server_id
|
142
142
|
}
|
143
|
-
driver.destroy_machine(
|
143
|
+
driver.destroy_machine(
|
144
|
+
action_handler,
|
145
|
+
machine_spec,
|
146
|
+
@metal_config[:machine_options]
|
147
|
+
)
|
144
148
|
end
|
145
149
|
vm = find_vm_by_id(@server_id, @connection)
|
146
150
|
expect(vm).to eq(nil)
|
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.5.
|
4
|
+
version: 0.5.4
|
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-05-
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbvmomi
|
@@ -72,6 +72,20 @@ dependencies:
|
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rubocop
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0.29'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0.29'
|
75
89
|
description: Provisioner for creating vSphere VM instances in Chef Provisioning.
|
76
90
|
email: matt.wrock@CenturyLinkCloud.com
|
77
91
|
executables: []
|