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 +4 -4
- data/ChangeLog.md +23 -0
- data/Gemfile.lock +55 -51
- data/dopv.gemspec +7 -1
- data/lib/dopv/infrastructure/providers/base.rb +17 -13
- data/lib/dopv/infrastructure/providers/openstack.rb +2 -2
- data/lib/dopv/infrastructure/providers/ovirt.rb +2 -2
- data/lib/dopv/infrastructure/providers/vsphere.rb +162 -145
- data/lib/dopv/version.rb +1 -1
- metadata +52 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e80201d8c4d76c0ff9b55a00f21ff12aac7d5fe2
|
|
4
|
+
data.tar.gz: 23fcc0486069c037fd1f6d2c6f1a7250642e7179
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff25f44003926b0d6e18fdb2710ba9bb7467b1015d7c2d8dcbb2e5867eea0984aa6a8f05426e23b20598cc7b21c0d259b12a01466aaa70112a3562182f2aa665
|
|
7
|
+
data.tar.gz: e39cf771c243a4c359f6c48d41f66f88c4e00f84c9b148f4a3b018ba7428a9b1a00854fc0ee6d5bb4131c78c7a7e459ef011022c327b350e62d5ddac967afdc0
|
data/ChangeLog.md
CHANGED
|
@@ -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]
|
data/Gemfile.lock
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
dopv (0.14.
|
|
5
|
-
dop_common (~> 0.15, >= 0.15.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
30
|
-
|
|
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.
|
|
60
|
-
fog-core
|
|
61
|
-
fog-json
|
|
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.
|
|
73
|
-
|
|
76
|
+
fog-brightbox (0.16.1)
|
|
77
|
+
dry-inflector
|
|
78
|
+
fog-core
|
|
74
79
|
fog-json
|
|
75
|
-
|
|
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
|
|
92
|
-
fog-core
|
|
96
|
+
fog-json (1.2.0)
|
|
97
|
+
fog-core
|
|
93
98
|
multi_json (~> 1.10)
|
|
94
|
-
fog-local (0.
|
|
99
|
+
fog-local (0.6.0)
|
|
95
100
|
fog-core (>= 1.27, < 3.0)
|
|
96
|
-
fog-powerdns (0.
|
|
97
|
-
fog-core
|
|
98
|
-
fog-json
|
|
99
|
-
fog-xml
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
166
|
-
mime-types (3.
|
|
169
|
+
method_source (0.9.2)
|
|
170
|
+
mime-types (3.2.2)
|
|
167
171
|
mime-types-data (~> 3.2015)
|
|
168
|
-
mime-types-data (3.
|
|
172
|
+
mime-types-data (3.2019.0331)
|
|
169
173
|
mini_portile2 (2.3.0)
|
|
170
|
-
mixlib-shellout (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.
|
|
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.
|
|
180
|
-
pry (0.
|
|
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.
|
|
190
|
+
rake (12.3.2)
|
|
187
191
|
rb-fsevent (0.10.3)
|
|
188
|
-
rb-inotify (0.
|
|
189
|
-
ffi (
|
|
190
|
-
rbovirt (0.1.
|
|
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.
|
|
202
|
-
rspec-core (~> 3.
|
|
203
|
-
rspec-expectations (~> 3.
|
|
204
|
-
rspec-mocks (~> 3.
|
|
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.
|
|
210
|
-
rspec-support (~> 3.
|
|
211
|
-
rspec-expectations (3.
|
|
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.
|
|
214
|
-
rspec-its (1.
|
|
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.
|
|
221
|
+
rspec-mocks (3.8.1)
|
|
218
222
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
219
|
-
rspec-support (~> 3.
|
|
220
|
-
rspec-support (3.
|
|
223
|
+
rspec-support (~> 3.8.0)
|
|
224
|
+
rspec-support (3.8.2)
|
|
221
225
|
shellany (0.0.1)
|
|
222
|
-
simplecov (0.
|
|
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.
|
|
228
|
-
trollop (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.
|
|
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.
|
|
255
|
+
1.17.3
|
data/dopv.gemspec
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
37
|
-
|
|
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
|
-
|
|
54
|
-
|
|
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
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
124
|
-
|
|
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
|
-
|
|
134
|
-
|
|
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
|
-
|
|
144
|
-
|
|
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
|
-
|
|
153
|
-
|
|
158
|
+
:plainText => true,
|
|
159
|
+
:value => customization_domain_password(domain)
|
|
154
160
|
) rescue nil)
|
|
155
161
|
customization_id = RbVmomi::VIM::CustomizationIdentification.new(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
-
|
|
168
|
+
:joinWorkgroup => workgroup
|
|
163
169
|
)
|
|
164
170
|
else
|
|
165
171
|
customization_id = RbVmomi::VIM::CustomizationIdentification.new(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
172
|
+
:domainAdmin => nil,
|
|
173
|
+
:domainAdminPassword => nil,
|
|
174
|
+
:joinDomain => nil
|
|
169
175
|
)
|
|
170
176
|
end
|
|
171
177
|
|
|
172
178
|
RbVmomi::VIM::CustomizationSysprep.new(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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
|
-
|
|
199
|
-
|
|
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
|
-
|
|
226
|
-
|
|
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
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
|
|
260
|
-
|
|
261
|
-
|
|
276
|
+
:datastore => volume.pool,
|
|
277
|
+
:fileName => volume.id,
|
|
278
|
+
:diskMode => 'persistent'
|
|
262
279
|
)
|
|
263
280
|
|
|
264
281
|
virtual_disk = RbVmomi::VIM::VirtualDisk.new(
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
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
|
-
|
|
274
|
-
|
|
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
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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
|
-
|
|
296
|
-
|
|
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
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
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
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
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
|
-
|
|
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
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
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}'
|
|
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|
|
data/lib/dopv/version.rb
CHANGED
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.
|
|
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:
|
|
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.
|
|
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.
|
|
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
|