dopv 0.14.2 → 0.14.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4bae76417ddf3f78f77f7c83c4f24299eff05530
4
- data.tar.gz: 7423841f61ebfa260acfc1084d2efd8fa0c66068
3
+ metadata.gz: e80201d8c4d76c0ff9b55a00f21ff12aac7d5fe2
4
+ data.tar.gz: 23fcc0486069c037fd1f6d2c6f1a7250642e7179
5
5
  SHA512:
6
- metadata.gz: bf49b582e0e66d0f181a621a371e7073d42751366f6723c3fdb4783577b44df9131fe176f025321391795f497d96b7c70a59263f8b9877a94399d39c07e34284
7
- data.tar.gz: a127e39f7711e9d98efa5d340382c0524f7679664d39acc1287145c13424d090a336ded3b85b63778a415b17a9826188e442e4654624e0f877dd5c5103828021
6
+ metadata.gz: ff25f44003926b0d6e18fdb2710ba9bb7467b1015d7c2d8dcbb2e5867eea0984aa6a8f05426e23b20598cc7b21c0d259b12a01466aaa70112a3562182f2aa665
7
+ data.tar.gz: e39cf771c243a4c359f6c48d41f66f88c4e00f84c9b148f4a3b018ba7428a9b1a00854fc0ee6d5bb4131c78c7a7e459ef011022c327b350e62d5ddac967afdc0
@@ -1,3 +1,26 @@
1
+ # 0.14.8
2
+
3
+ ## [deps]
4
+ * Fix gem
5
+
6
+ # 0.14.4 - 0.14.7
7
+
8
+ ## [deps]
9
+ * Fix dependencies
10
+
11
+ # 0.14.3
12
+
13
+ ## [deps]
14
+ * Update `dop_common`
15
+
16
+ ## [base]
17
+ * Add force_stop property to force shutdown during undeploy
18
+
19
+ ## [vsphere]
20
+ * Some minor fixes and improvements
21
+ * Fix cluster neglect
22
+ * Fix interface cleanup
23
+
1
24
  # 0.14.2 29.05.2018
2
25
 
3
26
  ## [vsphere]
@@ -1,12 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dopv (0.14.2)
5
- dop_common (~> 0.15, >= 0.15.2)
4
+ dopv (0.14.8)
5
+ dop_common (~> 0.15, >= 0.15.3)
6
6
  fog (~> 1.36.0)
7
+ fog-xenserver (= 0.2.3)
7
8
  gli (~> 2.13.1)
9
+ hashdiff (~> 0.3, = 0.3.8)
8
10
  json (~> 1.8)
9
11
  logger-colors (~> 1)
12
+ nokogiri (= 1.8.5)
10
13
  parallel (~> 1)
11
14
  rbovirt (~> 0.1, >= 0.1.3)
12
15
  rbvmomi (~> 1.8.2)
@@ -19,15 +22,16 @@ GEM
19
22
  byebug (10.0.2)
20
23
  coderay (1.1.2)
21
24
  diff-lcs (1.3)
22
- docile (1.3.1)
25
+ docile (1.3.2)
23
26
  domain_name (0.5.20180417)
24
27
  unf (>= 0.0.5, < 1.0.0)
25
- dop_common (0.15.2)
28
+ dop_common (0.15.3)
26
29
  hashdiff (~> 0.3, >= 0.3.1)
27
30
  lockfile (~> 2)
28
31
  rb-inotify (~> 0.9)
29
- excon (0.62.0)
30
- ffi (1.9.23)
32
+ dry-inflector (0.1.2)
33
+ excon (0.64.0)
34
+ ffi (1.11.1)
31
35
  fission (0.5.0)
32
36
  CFPropertyList (~> 2.2)
33
37
  fog (1.36.0)
@@ -56,9 +60,9 @@ GEM
56
60
  fog-xml (~> 0.1.1)
57
61
  ipaddress (~> 0.5)
58
62
  nokogiri (~> 1.5, >= 1.5.11)
59
- fog-aliyun (0.2.2)
60
- fog-core (~> 1.27)
61
- fog-json (~> 1.0)
63
+ fog-aliyun (0.3.3)
64
+ fog-core
65
+ fog-json
62
66
  ipaddress (~> 0.8)
63
67
  xml-simple (~> 1.1)
64
68
  fog-atmos (0.1.0)
@@ -69,10 +73,11 @@ GEM
69
73
  fog-json (~> 1.0)
70
74
  fog-xml (~> 0.1)
71
75
  ipaddress (~> 0.8)
72
- fog-brightbox (0.14.0)
73
- fog-core (~> 1.22)
76
+ fog-brightbox (0.16.1)
77
+ dry-inflector
78
+ fog-core
74
79
  fog-json
75
- inflecto (~> 0.0.2)
80
+ mime-types
76
81
  fog-core (1.45.0)
77
82
  builder
78
83
  excon (~> 0.58)
@@ -88,15 +93,15 @@ GEM
88
93
  fog-core
89
94
  fog-json
90
95
  fog-xml
91
- fog-json (1.0.2)
92
- fog-core (~> 1.0)
96
+ fog-json (1.2.0)
97
+ fog-core
93
98
  multi_json (~> 1.10)
94
- fog-local (0.5.0)
99
+ fog-local (0.6.0)
95
100
  fog-core (>= 1.27, < 3.0)
96
- fog-powerdns (0.1.1)
97
- fog-core (~> 1.27)
98
- fog-json (~> 1.0)
99
- fog-xml (~> 0.1)
101
+ fog-powerdns (0.2.0)
102
+ fog-core
103
+ fog-json
104
+ fog-xml
100
105
  fog-profitbricks (4.1.1)
101
106
  fog-core (~> 1.42)
102
107
  fog-json (~> 1.0)
@@ -129,7 +134,7 @@ GEM
129
134
  fog-voxel (0.1.0)
130
135
  fog-core
131
136
  fog-xml
132
- fog-xenserver (0.3.0)
137
+ fog-xenserver (0.2.3)
133
138
  fog-core
134
139
  fog-xml
135
140
  fog-xml (0.1.3)
@@ -137,7 +142,7 @@ GEM
137
142
  nokogiri (>= 1.5.11, < 2.0.0)
138
143
  formatador (0.2.5)
139
144
  gli (2.13.4)
140
- guard (2.14.2)
145
+ guard (2.15.0)
141
146
  formatador (>= 0.2.4)
142
147
  listen (>= 2.7, < 4.0)
143
148
  lumberjack (>= 1.0.12, < 2.0)
@@ -150,10 +155,9 @@ GEM
150
155
  guard-ctags-bundler (1.4.0)
151
156
  guard (>= 2.0)
152
157
  guard-compat (>= 0.1.0)
153
- hashdiff (0.3.7)
158
+ hashdiff (0.3.8)
154
159
  http-cookie (1.0.3)
155
160
  domain_name (~> 0.5)
156
- inflecto (0.0.2)
157
161
  ipaddress (0.8.3)
158
162
  json (1.8.6)
159
163
  listen (3.0.8)
@@ -162,32 +166,32 @@ GEM
162
166
  lockfile (2.1.3)
163
167
  logger-colors (1.0.0)
164
168
  lumberjack (1.0.13)
165
- method_source (0.9.0)
166
- mime-types (3.1)
169
+ method_source (0.9.2)
170
+ mime-types (3.2.2)
167
171
  mime-types-data (~> 3.2015)
168
- mime-types-data (3.2016.0521)
172
+ mime-types-data (3.2019.0331)
169
173
  mini_portile2 (2.3.0)
170
- mixlib-shellout (2.3.2)
174
+ mixlib-shellout (2.4.4)
171
175
  multi_json (1.13.1)
172
176
  nenv (0.3.0)
173
177
  netrc (0.11.0)
174
- nokogiri (1.8.2)
178
+ nokogiri (1.8.5)
175
179
  mini_portile2 (~> 2.3.0)
176
180
  notiffany (0.1.1)
177
181
  nenv (~> 0.1)
178
182
  shellany (~> 0.0)
179
- parallel (1.12.1)
180
- pry (0.11.3)
183
+ parallel (1.17.0)
184
+ pry (0.12.2)
181
185
  coderay (~> 1.1.0)
182
186
  method_source (~> 0.9.0)
183
187
  pry-byebug (3.6.0)
184
188
  byebug (~> 10.0)
185
189
  pry (~> 0.10)
186
- rake (12.3.1)
190
+ rake (12.3.2)
187
191
  rb-fsevent (0.10.3)
188
- rb-inotify (0.9.10)
189
- ffi (>= 0.5.0, < 2)
190
- rbovirt (0.1.5)
192
+ rb-inotify (0.10.0)
193
+ ffi (~> 1.0)
194
+ rbovirt (0.1.7)
191
195
  nokogiri
192
196
  rest-client (> 1.7.0)
193
197
  rbvmomi (1.8.2)
@@ -198,37 +202,37 @@ GEM
198
202
  http-cookie (>= 1.0.2, < 2.0)
199
203
  mime-types (>= 1.16, < 4.0)
200
204
  netrc (~> 0.8)
201
- rspec (3.7.0)
202
- rspec-core (~> 3.7.0)
203
- rspec-expectations (~> 3.7.0)
204
- rspec-mocks (~> 3.7.0)
205
+ rspec (3.8.0)
206
+ rspec-core (~> 3.8.0)
207
+ rspec-expectations (~> 3.8.0)
208
+ rspec-mocks (~> 3.8.0)
205
209
  rspec-command (1.0.3)
206
210
  mixlib-shellout (~> 2.0)
207
211
  rspec (~> 3.2)
208
212
  rspec-its (~> 1.2)
209
- rspec-core (3.7.1)
210
- rspec-support (~> 3.7.0)
211
- rspec-expectations (3.7.0)
213
+ rspec-core (3.8.2)
214
+ rspec-support (~> 3.8.0)
215
+ rspec-expectations (3.8.4)
212
216
  diff-lcs (>= 1.2.0, < 2.0)
213
- rspec-support (~> 3.7.0)
214
- rspec-its (1.2.0)
217
+ rspec-support (~> 3.8.0)
218
+ rspec-its (1.3.0)
215
219
  rspec-core (>= 3.0.0)
216
220
  rspec-expectations (>= 3.0.0)
217
- rspec-mocks (3.7.0)
221
+ rspec-mocks (3.8.1)
218
222
  diff-lcs (>= 1.2.0, < 2.0)
219
- rspec-support (~> 3.7.0)
220
- rspec-support (3.7.1)
223
+ rspec-support (~> 3.8.0)
224
+ rspec-support (3.8.2)
221
225
  shellany (0.0.1)
222
- simplecov (0.16.1)
226
+ simplecov (0.17.0)
223
227
  docile (~> 1.1)
224
228
  json (>= 1.8, < 3)
225
229
  simplecov-html (~> 0.10.0)
226
230
  simplecov-html (0.10.2)
227
- thor (0.20.0)
228
- trollop (2.1.2)
231
+ thor (0.20.3)
232
+ trollop (2.9.9)
229
233
  unf (0.1.4)
230
234
  unf_ext
231
- unf_ext (0.0.7.5)
235
+ unf_ext (0.0.7.6)
232
236
  xml-simple (1.1.5)
233
237
 
234
238
  PLATFORMS
@@ -248,4 +252,4 @@ DEPENDENCIES
248
252
  simplecov
249
253
 
250
254
  BUNDLED WITH
251
- 1.16.2
255
+ 1.17.3
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency 'listen', '~> 3.0.8'
39
39
  spec.add_development_dependency 'guard-ctags-bundler'
40
40
 
41
- spec.add_dependency 'dop_common', '~> 0.15', '>= 0.15.2'
41
+ spec.add_dependency 'dop_common', '~> 0.15', '>= 0.15.3'
42
42
  spec.add_dependency 'fog', '~> 1.36.0'
43
43
  spec.add_dependency 'gli', '~> 2.13.1'
44
44
  spec.add_dependency 'json', '~> 1.8'
@@ -46,8 +46,14 @@ Gem::Specification.new do |spec|
46
46
  spec.add_dependency 'rbovirt', '~> 0.1', '>= 0.1.3'
47
47
  spec.add_dependency 'rbvmomi', '~> 1.8.2'
48
48
  spec.add_dependency 'parallel', '~> 1'
49
+ spec.add_dependency 'hashdiff', '~> 0.3', '0.3.8'
49
50
 
50
51
  if RUBY_VERSION < '2'
51
52
  spec.add_dependency 'rest-client', '< 2.0'
52
53
  end
54
+
55
+ if RUBY_VERSION < '2.3.0'
56
+ spec.add_dependency 'nokogiri', '1.8.5'
57
+ spec.add_dependency 'fog-xenserver', '0.2.3'
58
+ end
53
59
  end
@@ -20,7 +20,7 @@ module Dopv
20
20
 
21
21
  attr_reader :data_disks_db
22
22
  def_delegators :@plan, :nodename, :fqdn, :hostname, :domainname, :dns
23
- def_delegators :@plan, :timezone
23
+ def_delegators :@plan, :timezone, :force_stop
24
24
  def_delegators :@plan, :full_clone?, :image, :cores, :memory, :storage, :flavor
25
25
  def_delegators :@plan, :infrastructure, :infrastructure_properties
26
26
  def_delegator :@plan, :interfaces, :interfaces_config
@@ -128,19 +128,19 @@ module Dopv
128
128
 
129
129
  def root_password
130
130
  cred = credentials.find { |c| c.type == :username_password && c.username == 'root' } if
131
- @root_password.nil?
131
+ @root_password.nil?
132
132
  @root_password ||= cred.nil? ? nil : cred.password
133
133
  end
134
134
 
135
135
  def root_ssh_pubkeys
136
136
  cred = credentials.find_all { |c| c.type == :ssh_key && c.username == 'root' } if
137
- @root_ssh_pubkeys.nil?
137
+ @root_ssh_pubkeys.nil?
138
138
  @root_ssh_pubkey ||= cred.empty? ? [] : cred.collect { |k| k.public_key }.uniq
139
139
  end
140
140
 
141
141
  def administrator_password
142
142
  cred = credentials.find { |c| c.type == :username_password && c.username == 'Administrator' } if
143
- @administrator_password.nil?
143
+ @administrator_password.nil?
144
144
  @administrator_password ||= cred.nil? ? nil : cred.password
145
145
  end
146
146
 
@@ -180,12 +180,12 @@ module Dopv
180
180
  def template(filters={})
181
181
  raise ProviderError, "No template defined" unless image
182
182
  @template ||= if compute_provider.respond_to?(:templates)
183
- compute_provider.templates.all(filters).find { |t| t.name == image }
184
- elsif compute_provider.respond_to?(:images)
185
- compute_provider.images.all(filters).find { |t| t.name == image }
186
- else
187
- raise ProviderError, "The provider does not to have template/image collection"
188
- end
183
+ compute_provider.templates.all(filters).find { |t| t.name == image }
184
+ elsif compute_provider.respond_to?(:images)
185
+ compute_provider.images.all(filters).find { |t| t.name == image }
186
+ else
187
+ raise ProviderError, "The provider does not to have template/image collection"
188
+ end
189
189
  raise ProviderError, "No such template #{image}" unless @template
190
190
  @template
191
191
  end
@@ -225,7 +225,7 @@ module Dopv
225
225
 
226
226
  def destroy_node_instance(node_instance, destroy_data_volumes=false)
227
227
  if node_instance
228
- stop_node_instance(node_instance)
228
+ stop_node_instance(node_instance, { 'force' => force_stop })
229
229
 
230
230
  volumes = data_disks_db.volumes
231
231
  volumes.each do |v|
@@ -265,12 +265,16 @@ module Dopv
265
265
  customize_node_instance(node_instance)
266
266
  end
267
267
 
268
- def stop_node_instance(node_instance)
268
+ def stop_node_instance(node_instance, options={})
269
269
  reload_node_instance(node_instance)
270
270
  unless node_instance_stopped?(node_instance)
271
271
  ::Dopv::log.info("Node #{nodename}: Stopping node.")
272
272
  wait_for_task_completion(node_instance)
273
- node_instance.stop
273
+ begin
274
+ node_instance.stop(options)
275
+ rescue ArgumentError
276
+ node_instance.stop
277
+ end
274
278
  reload_node_instance(node_instance)
275
279
  end
276
280
  end
@@ -149,8 +149,8 @@ module Dopv
149
149
  def start_node_instance(node_instance)
150
150
  end
151
151
 
152
- def stop_node_instance(node_instance)
153
- super(node_instance)
152
+ def stop_node_instance(node_instance, options={})
153
+ super(node_instance, options)
154
154
  node_instance.wait_for { !ready? }
155
155
  end
156
156
 
@@ -104,8 +104,8 @@ module Dopv
104
104
  end
105
105
 
106
106
  # Redefine until regexp in Fog::Compute::Ovirt::Server#stopped? is fixed
107
- def stop_node_instance(node_instance)
108
- super
107
+ def stop_node_instance(node_instance, options={})
108
+ super(node_instance, options)
109
109
  node_instance.wait_for { status.downcase == 'down' }
110
110
  end
111
111
 
@@ -15,26 +15,32 @@ module Dopv
15
15
  super(node_config, data_disks_db)
16
16
 
17
17
  @compute_connection_opts = {
18
- :provider => 'vsphere',
19
- :vsphere_username => provider_username,
20
- :vsphere_password => provider_password,
21
- :vsphere_server => provider_host,
22
- :vsphere_port => provider_port,
23
- :vsphere_expected_pubkey_hash => provider_pubkey_hash
18
+ :provider => 'vsphere',
19
+ :vsphere_username => provider_username,
20
+ :vsphere_password => provider_password,
21
+ :vsphere_server => provider_host,
22
+ :vsphere_port => provider_port,
23
+ :vsphere_expected_pubkey_hash => provider_pubkey_hash
24
24
  }
25
25
 
26
26
  @node_creation_opts = {
27
- 'name' => nodename,
28
- 'datacenter' => datacenter.name,
29
- 'template_path' => image,
30
- 'dest_folder' => dest_folder || '',
31
- 'numCPUs' => cores,
32
- 'memoryMB' => memory.mebibytes.to_i
27
+ 'name' => nodename,
28
+ 'datacenter' => datacenter.name,
29
+ 'template_path' => image,
30
+ 'dest_folder' => dest_folder || '',
31
+ 'numCPUs' => cores,
32
+ 'memoryMB' => memory.mebibytes.to_i
33
33
  }
34
34
 
35
+ if infrastructure_properties.cluster
36
+ @node_creation_opts = {
37
+ 'resource_pool' => [infrastructure_properties.cluster, '']
38
+ }.merge(@node_creation_opts)
39
+ end
40
+
35
41
  @wait_params = {
36
- :maxtime => 300,
37
- :delay => 10
42
+ :maxtime => 300,
43
+ :delay => 10
38
44
  }.merge(wait_params)
39
45
  end
40
46
 
@@ -50,13 +56,13 @@ module Dopv
50
56
 
51
57
  def timezone_to_index(timezone)
52
58
  lookup_table = {
53
- 'Europe/Zurich' => 110,
54
- :default => 110
59
+ 'Europe/Zurich' => 110,
60
+ :default => 110
55
61
  }
56
62
 
57
63
  unless timezone.match(/^[1-9][0-9][0-9]$/)
58
64
  (lookup_table.key? timezone) ?
59
- lookup_table[timezone].to_s : lookup_table[:default].to_s
65
+ lookup_table[timezone].to_s : lookup_table[:default].to_s
60
66
  else
61
67
  timezone
62
68
  end
@@ -72,10 +78,10 @@ module Dopv
72
78
  @node_creation_opts['transform'] = thin_clone ? :sparse : :flat unless thin_clone.nil?
73
79
 
74
80
  vm = compute_provider.vm_clone(
75
- @node_creation_opts.merge(
76
- 'power_on' => false,
77
- 'wait' => true
78
- )
81
+ @node_creation_opts.merge(
82
+ 'power_on' => false,
83
+ 'wait' => true
84
+ )
79
85
  )
80
86
 
81
87
  compute_provider.servers.get(vm['new_vm']['id'])
@@ -120,8 +126,8 @@ module Dopv
120
126
 
121
127
  # Global network settings
122
128
  global_ip_settings = RbVmomi::VIM::CustomizationGlobalIPSettings.new(
123
- :dnsServerList => dns.name_servers,
124
- :dnsSuffixList => dns.search_domains
129
+ :dnsServerList => dns.name_servers,
130
+ :dnsSuffixList => dns.search_domains
125
131
  )
126
132
 
127
133
  # Identity settings
@@ -130,8 +136,8 @@ module Dopv
130
136
  when :linux
131
137
 
132
138
  RbVmomi::VIM::CustomizationLinuxPrep.new(
133
- :domain => domainname,
134
- :hostName => RbVmomi::VIM::CustomizationFixedName.new(:name => hostname)
139
+ :domain => domainname,
140
+ :hostName => RbVmomi::VIM::CustomizationFixedName.new(:name => hostname)
135
141
  )
136
142
 
137
143
  when :windows
@@ -140,8 +146,8 @@ module Dopv
140
146
  raise ProviderError, "'organization_name' is missing in plan" unless organization_name
141
147
 
142
148
  password_settings = (RbVmomi::VIM::CustomizationPassword.new(
143
- :plainText => true,
144
- :value => administrator_password
149
+ :plainText => true,
150
+ :value => administrator_password
145
151
  ) rescue nil)
146
152
 
147
153
  # Declare identification
@@ -149,54 +155,54 @@ module Dopv
149
155
  workgroup ||= nil
150
156
  if domain
151
157
  customization_domain_password_settings = (RbVmomi::VIM::CustomizationPassword.new(
152
- :plainText => true,
153
- :value => customization_domain_password(domain)
158
+ :plainText => true,
159
+ :value => customization_domain_password(domain)
154
160
  ) rescue nil)
155
161
  customization_id = RbVmomi::VIM::CustomizationIdentification.new(
156
- :joinDomain => domain,
157
- :domainAdmin => customization_domain_username(domain),
158
- :domainAdminPassword => customization_domain_password_settings
162
+ :joinDomain => domain,
163
+ :domainAdmin => customization_domain_username(domain),
164
+ :domainAdminPassword => customization_domain_password_settings
159
165
  )
160
166
  elsif workgroup
161
167
  customization_id = RbVmomi::VIM::CustomizationIdentification.new(
162
- :joinWorkgroup => workgroup
168
+ :joinWorkgroup => workgroup
163
169
  )
164
170
  else
165
171
  customization_id = RbVmomi::VIM::CustomizationIdentification.new(
166
- :domainAdmin => nil,
167
- :domainAdminPassword => nil,
168
- :joinDomain => nil
172
+ :domainAdmin => nil,
173
+ :domainAdminPassword => nil,
174
+ :joinDomain => nil
169
175
  )
170
176
  end
171
177
 
172
178
  RbVmomi::VIM::CustomizationSysprep.new(
173
- :guiRunOnce => nil,
174
- :guiUnattended => RbVmomi::VIM::CustomizationGuiUnattended.new(
175
- :autoLogon => false,
176
- :autoLogonCount => 1,
177
- :password => password_settings,
178
- :timeZone => timezone_to_index(timezone)
179
- ),
180
- :identification => customization_id,
181
- :userData => RbVmomi::VIM::CustomizationUserData.new(
182
- :computerName => RbVmomi::VIM::CustomizationFixedName.new(:name => hostname),
183
- :fullName => administrator_fullname,
184
- :orgName => organization_name,
185
- :productId => (!product_id ? '' : product_id)
186
- )
179
+ :guiRunOnce => nil,
180
+ :guiUnattended => RbVmomi::VIM::CustomizationGuiUnattended.new(
181
+ :autoLogon => false,
182
+ :autoLogonCount => 1,
183
+ :password => password_settings,
184
+ :timeZone => timezone_to_index(timezone)
185
+ ),
186
+ :identification => customization_id,
187
+ :userData => RbVmomi::VIM::CustomizationUserData.new(
188
+ :computerName => RbVmomi::VIM::CustomizationFixedName.new(:name => hostname),
189
+ :fullName => administrator_fullname,
190
+ :orgName => organization_name,
191
+ :productId => (!product_id ? '' : product_id)
192
+ )
187
193
  )
188
194
  else
189
- raise ProviderError, "Unsupported guest OS type"
195
+ raise ProviderError, "Unsupported guest OS type '#{node_instance.guest_id.to_sym}'"
190
196
  end
191
197
 
192
198
  custom_spec = RbVmomi::VIM::CustomizationSpec.new(
193
- :identity => identity_settings,
194
- :globalIPSettings => global_ip_settings,
195
- :nicSettingMap => nic_setting_map
199
+ :identity => identity_settings,
200
+ :globalIPSettings => global_ip_settings,
201
+ :nicSettingMap => nic_setting_map
196
202
  )
197
203
  custom_spec.options = RbVmomi::VIM::CustomizationWinOptions.new(
198
- :changeSID => true,
199
- :deleteAccounts => false
204
+ :changeSID => true,
205
+ :deleteAccounts => false
200
206
  ) if guest_id_to_os_family(node_instance) == :windows
201
207
 
202
208
  custom_spec
@@ -208,8 +214,8 @@ module Dopv
208
214
  node_instance.start
209
215
  end
210
216
 
211
- def stop_node_instance(node_instance)
212
- super(node_instance)
217
+ def stop_node_instance(node_instance, options={})
218
+ super(node_instance, options)
213
219
  node_instance.wait_for(@wait_params[:maxtime]){power_state.to_sym == :poweredOff}
214
220
  end
215
221
 
@@ -217,20 +223,31 @@ module Dopv
217
223
  ::Dopv::log.info("Node #{nodename}: Trying to add interfaces.")
218
224
 
219
225
  # Remove all interfaces defined by the template
220
- remove_node_nics(node_instance)
226
+ remove_node_nics(node_instance) do |node, interface|
227
+ Dopv::log.debug("Node #{nodename}: Remove #{interface.name} (#{interface.key}, #{interface.type}, #{interface.network}).")
228
+ deviceChange = compute_provider.send(:create_interface, interface, interface.key, :remove, :datacenter => datacenter.name)
229
+ # workaround in case the network of the interface is nil
230
+ if deviceChange[:device][:backing].respond_to?(:deviceName) and deviceChange[:device][:backing][:deviceName].nil?
231
+ deviceChange[:device][:backing][:deviceName] = ''
232
+ end
233
+ compute_provider.vm_reconfig_hardware('instance_uuid' => interface.server_id,
234
+ 'hardware_spec' => {
235
+ 'deviceChange'=>[deviceChange]
236
+ })
237
+ end
221
238
 
222
239
  # Create interfaces from scratch
223
240
  interfaces_config.each do |i|
224
241
  log_msg = i.virtual_switch.nil? ?
225
- "Node #{nodename}: Creating interface #{i.name} in #{i.network}." :
226
- "Node #{nodename}: Creating interface #{i.name} in #{i.network} (#{i.virtual_switch})."
242
+ "Node #{nodename}: Creating interface #{i.name} in #{i.network}." :
243
+ "Node #{nodename}: Creating interface #{i.name} in #{i.network} (#{i.virtual_switch})."
227
244
  ::Dopv::log.debug(log_msg)
228
245
  attrs = {
229
- :name => i.name,
230
- :datacenter => node_instance.datacenter,
231
- :network => i.network,
232
- :virtualswitch => i.virtual_switch,
233
- :type => 'VirtualVmxnet3'
246
+ :name => i.name,
247
+ :datacenter => node_instance.datacenter,
248
+ :network => i.network,
249
+ :virtualswitch => i.virtual_switch,
250
+ :type => 'VirtualVmxnet3'
234
251
  }
235
252
  add_node_nic(node_instance, attrs)
236
253
  end
@@ -238,10 +255,10 @@ module Dopv
238
255
 
239
256
  def add_node_volume(node_instance, config)
240
257
  volume = node_instance.volumes.create(
241
- :datastore => config.pool,
242
- :size => config.size.kibibytes.to_i,
243
- :mode => 'persistent',
244
- :thin => config.thin?
258
+ :datastore => config.pool,
259
+ :size => config.size.kibibytes.to_i,
260
+ :mode => 'persistent',
261
+ :thin => config.thin?
245
262
  )
246
263
  node_instance.volumes.reload
247
264
  volume.name = config.name
@@ -256,22 +273,22 @@ module Dopv
256
273
 
257
274
  def attach_node_volume(node_instance, volume)
258
275
  backing_info = RbVmomi::VIM::VirtualDiskFlatVer2BackingInfo.new(
259
- :datastore => volume.pool,
260
- :fileName => volume.id,
261
- :diskMode => 'persistent'
276
+ :datastore => volume.pool,
277
+ :fileName => volume.id,
278
+ :diskMode => 'persistent'
262
279
  )
263
280
 
264
281
  virtual_disk = RbVmomi::VIM::VirtualDisk.new(
265
- :controllerKey => node_instance.scsi_controller.key,
266
- :unitNumber => node_instance.volumes.collect { |v| v.unit_number }.max + 1,
267
- :key => -1,
268
- :backing => backing_info,
269
- :capacityInKB => volume.size * 1048576
282
+ :controllerKey => node_instance.scsi_controller.key,
283
+ :unitNumber => node_instance.volumes.collect { |v| v.unit_number }.max + 1,
284
+ :key => -1,
285
+ :backing => backing_info,
286
+ :capacityInKB => volume.size * 1048576
270
287
  )
271
288
 
272
289
  device_spec = RbVmomi::VIM::VirtualDeviceConfigSpec.new(
273
- :operation => :add,
274
- :device => virtual_disk
290
+ :operation => :add,
291
+ :device => virtual_disk
275
292
  )
276
293
 
277
294
  config_spec = RbVmomi::VIM::VirtualMachineConfigSpec.new(:deviceChange => [device_spec])
@@ -285,15 +302,15 @@ module Dopv
285
302
  volume = node_instance.volumes.all.find { |v| v.filename == volume.id }
286
303
 
287
304
  virtual_disk = RbVmomi::VIM::VirtualDisk.new(
288
- :controllerKey => volume.server.scsi_controller.key,
289
- :unitNumber => volume.unit_number,
290
- :key => volume.key,
291
- :capacityInKB => volume.size
305
+ :controllerKey => volume.server.scsi_controller.key,
306
+ :unitNumber => volume.unit_number,
307
+ :key => volume.key,
308
+ :capacityInKB => volume.size
292
309
  )
293
310
 
294
311
  device_spec = RbVmomi::VIM::VirtualDeviceConfigSpec.new(
295
- :operation => :remove,
296
- :device => virtual_disk
312
+ :operation => :remove,
313
+ :device => virtual_disk
297
314
  )
298
315
 
299
316
  config_spec = RbVmomi::VIM::VirtualMachineConfigSpec.new(:deviceChange => [device_spec])
@@ -306,10 +323,10 @@ module Dopv
306
323
  def record_node_data_volume(volume)
307
324
  ::Dopv::log.debug("Node #{nodename}: Recording volume #{volume.name} into DB.")
308
325
  volume = {
309
- :name => volume.name,
310
- :id => volume.filename,
311
- :pool => volume.datastore,
312
- :size => volume.size * 1048576 # Size must be in gibibytes
326
+ :name => volume.name,
327
+ :id => volume.filename,
328
+ :pool => volume.datastore,
329
+ :size => volume.size * 1048576 # Size must be in gibibytes
313
330
  }
314
331
  super(volume)
315
332
  end
@@ -317,57 +334,57 @@ module Dopv
317
334
  def guest_id_to_os_family(node_instance)
318
335
  # Based on http://pubs.vmware.com/vsphere-50/index.jsp?topic=/com.vmware.wssdk.apiref.doc_50/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html
319
336
  lookup_table = {
320
- :asianux8_64Guest => :linux,
321
- :centos8_64Guest => :linux,
322
- :darwin17_64Guest => :linux,
323
- :darwin18_64Guest => :linux,
324
- :debian6_64Guest => :linux,
325
- :debian6_Guest => :linux,
326
- :freebsd11Guest => :linux,
327
- :freebsd11_64Guest => :linux,
328
- :freebsd12Guest => :linux,
329
- :freebsd12_64Guest => :linux,
330
- :rhel4_64Guest => :linux,
331
- :rhel4Guest => :linux,
332
- :rhel5_64Guest => :linux,
333
- :rhel5Guest => :linux,
334
- :rhel6_64Guest => :linux,
335
- :rhel6Guest => :linux,
336
- :rhel7_64Guest => :linux,
337
- :rhel7Guest => :linux,
338
- :rhel8_64Guest => :linux,
339
- :sles11_64Guest => :linux,
340
- :sles12_64Guest => :linux,
341
- :sles13_64Guest => :linux,
342
- :sles14_64Guest => :linux,
343
- :sles15_64Guest => :linux,
344
- :oracleLinuxGuest => :linux,
345
- :oracleLinux64Guest => :linux,
346
- :oracleLinux8_64Guest => :linux,
347
- :other4xLinux64Guest => :linux,
348
- :other4xLinuxGuest => :linux,
349
- :ubuntu64Guest => :linux,
350
- :ubuntuGuest => :linux,
351
- :windows7_64Guest => :windows,
352
- :windows7Guest => :windows,
353
- :windows7Server64Guest => :windows,
354
- :windows8_64Guest => :windows,
355
- :windows8Guest => :windows,
356
- :windows8Server64Guest => :windows,
357
- :windows9_64Guest => :windows,
358
- :windows9Guest => :windows,
359
- :windows9Server64Guest => :windows,
360
- :windows10_64Guest => :windows,
361
- :windows10Guest => :windows,
362
- :windows10Server64Guest => :windows,
363
- :'windows7srv-64' => :windows,
364
- :'windows8srv-64' => :windows,
365
- :'windows9srv-64' => :windows,
366
- :'windows10srv-64' => :windows
337
+ :asianux8_64Guest => :linux,
338
+ :centos8_64Guest => :linux,
339
+ :darwin17_64Guest => :linux,
340
+ :darwin18_64Guest => :linux,
341
+ :debian6_64Guest => :linux,
342
+ :debian6_Guest => :linux,
343
+ :freebsd11Guest => :linux,
344
+ :freebsd11_64Guest => :linux,
345
+ :freebsd12Guest => :linux,
346
+ :freebsd12_64Guest => :linux,
347
+ :rhel4_64Guest => :linux,
348
+ :rhel4Guest => :linux,
349
+ :rhel5_64Guest => :linux,
350
+ :rhel5Guest => :linux,
351
+ :rhel6_64Guest => :linux,
352
+ :rhel6Guest => :linux,
353
+ :rhel7_64Guest => :linux,
354
+ :rhel7Guest => :linux,
355
+ :rhel8_64Guest => :linux,
356
+ :sles11_64Guest => :linux,
357
+ :sles12_64Guest => :linux,
358
+ :sles13_64Guest => :linux,
359
+ :sles14_64Guest => :linux,
360
+ :sles15_64Guest => :linux,
361
+ :oracleLinuxGuest => :linux,
362
+ :oracleLinux64Guest => :linux,
363
+ :oracleLinux8_64Guest => :linux,
364
+ :other4xLinux64Guest => :linux,
365
+ :other4xLinuxGuest => :linux,
366
+ :ubuntu64Guest => :linux,
367
+ :ubuntuGuest => :linux,
368
+ :windows7_64Guest => :windows,
369
+ :windows7Guest => :windows,
370
+ :windows7Server64Guest => :windows,
371
+ :windows8_64Guest => :windows,
372
+ :windows8Guest => :windows,
373
+ :windows8Server64Guest => :windows,
374
+ :windows9_64Guest => :windows,
375
+ :windows9Guest => :windows,
376
+ :windows9Server64Guest => :windows,
377
+ :windows10_64Guest => :windows,
378
+ :windows10Guest => :windows,
379
+ :windows10Server64Guest => :windows,
380
+ :'windows7srv-64' => :windows,
381
+ :'windows8srv-64' => :windows,
382
+ :'windows9srv-64' => :windows,
383
+ :'windows10srv-64' => :windows
367
384
  }
368
385
 
369
386
  node_instance.guest_id ?
370
- lookup_table[node_instance.guest_id.to_sym] : nil
387
+ lookup_table[node_instance.guest_id.to_sym] : nil
371
388
  end
372
389
 
373
390
  def reconfig_node_task(node_instance, reconfig_spec)
@@ -383,12 +400,12 @@ module Dopv
383
400
  def provider_pubkey_hash
384
401
  unless @provider_pubkey_hash
385
402
  connection = ::RbVmomi::VIM.new(
386
- :host => provider_host,
387
- :port => provider_port,
388
- :ssl => provider_ssl?,
389
- :ns => 'urn:vim25',
390
- :rev => '4.0',
391
- :insecure => true
403
+ :host => provider_host,
404
+ :port => provider_port,
405
+ :ssl => provider_ssl?,
406
+ :ns => 'urn:vim25',
407
+ :rev => '4.0',
408
+ :insecure => true
392
409
  )
393
410
  @provider_pubkey_hash ||= ::Digest::SHA2.hexdigest(connection.http.peer_cert.public_key.to_s)
394
411
  connection.close
@@ -470,7 +487,7 @@ module Dopv
470
487
  # ensure all tags found
471
488
  tags.each do |tag_name|
472
489
  result = found_tags.select { |tag| tag.fetch('name') == tag_name }
473
- ::Dopv::log.warn("Node #{nodename}: Tag '#{tag_name}' not found! (Tag created in '#{provider_host}'? User '#{provider_username}' not authorized?)") if result.empty?
490
+ ::Dopv::log.warn("Node #{nodename}: Tag '#{tag_name}' not found! (Tag created in '#{provider_host}' and User '#{provider_username}' authorized?)") if result.empty?
474
491
  end
475
492
 
476
493
  found_tags.each do |tag|
@@ -1,3 +1,3 @@
1
1
  module Dopv
2
- VERSION = '0.14.2'
2
+ VERSION = '0.14.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dopv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.14.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavol Dilung
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-05-29 00:00:00.000000000 Z
13
+ date: 2019-07-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -161,7 +161,7 @@ dependencies:
161
161
  version: '0.15'
162
162
  - - ">="
163
163
  - !ruby/object:Gem::Version
164
- version: 0.15.2
164
+ version: 0.15.3
165
165
  type: :runtime
166
166
  prerelease: false
167
167
  version_requirements: !ruby/object:Gem::Requirement
@@ -171,7 +171,7 @@ dependencies:
171
171
  version: '0.15'
172
172
  - - ">="
173
173
  - !ruby/object:Gem::Version
174
- version: 0.15.2
174
+ version: 0.15.3
175
175
  - !ruby/object:Gem::Dependency
176
176
  name: fog
177
177
  requirement: !ruby/object:Gem::Requirement
@@ -276,6 +276,54 @@ dependencies:
276
276
  - - "~>"
277
277
  - !ruby/object:Gem::Version
278
278
  version: '1'
279
+ - !ruby/object:Gem::Dependency
280
+ name: hashdiff
281
+ requirement: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - "~>"
284
+ - !ruby/object:Gem::Version
285
+ version: '0.3'
286
+ - - '='
287
+ - !ruby/object:Gem::Version
288
+ version: 0.3.8
289
+ type: :runtime
290
+ prerelease: false
291
+ version_requirements: !ruby/object:Gem::Requirement
292
+ requirements:
293
+ - - "~>"
294
+ - !ruby/object:Gem::Version
295
+ version: '0.3'
296
+ - - '='
297
+ - !ruby/object:Gem::Version
298
+ version: 0.3.8
299
+ - !ruby/object:Gem::Dependency
300
+ name: nokogiri
301
+ requirement: !ruby/object:Gem::Requirement
302
+ requirements:
303
+ - - '='
304
+ - !ruby/object:Gem::Version
305
+ version: 1.8.5
306
+ type: :runtime
307
+ prerelease: false
308
+ version_requirements: !ruby/object:Gem::Requirement
309
+ requirements:
310
+ - - '='
311
+ - !ruby/object:Gem::Version
312
+ version: 1.8.5
313
+ - !ruby/object:Gem::Dependency
314
+ name: fog-xenserver
315
+ requirement: !ruby/object:Gem::Requirement
316
+ requirements:
317
+ - - '='
318
+ - !ruby/object:Gem::Version
319
+ version: 0.2.3
320
+ type: :runtime
321
+ prerelease: false
322
+ version_requirements: !ruby/object:Gem::Requirement
323
+ requirements:
324
+ - - '='
325
+ - !ruby/object:Gem::Version
326
+ version: 0.2.3
279
327
  description: Deployment orchestrator for VMs
280
328
  email:
281
329
  - pavol.dilung@swisscom.com