gogetit 0.20.2 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gogetit/util.rb +85 -0
- data/lib/gogetit/version.rb +1 -1
- data/lib/providers/libvirt.rb +17 -2
- data/lib/providers/lxd.rb +60 -141
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3c995acc5f536c6cd8b860e0c025d5da14d55a5b00cba8fae71cba612a81aa0
|
4
|
+
data.tar.gz: 512981119248e95559725188ce2203ba85b520e224d4948691ebbb30ce6f39f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76757d10c32ed818bbff5749259ba0031b0025d2bad170dcab8d79396c3a09a259ddc9f7254ea4a5e3dcee48b702c591a8b4401f4401d6d60b34d3a3aa5a4866
|
7
|
+
data.tar.gz: 9a56506d5b228f248105f456306bb342728ce4f966a50c7cfb8f4310692c8216a08287cb794137dad9c89e7ada8c6159fb2b49b840af86cd1c3b5ff2dfb8306d
|
data/lib/gogetit/util.rb
CHANGED
@@ -261,5 +261,90 @@ module Gogetit
|
|
261
261
|
end
|
262
262
|
end
|
263
263
|
end
|
264
|
+
|
265
|
+
def generate_cloud_init_config(options, config, user_data = {})
|
266
|
+
logger.info("Calling <#{__method__.to_s}>")
|
267
|
+
|
268
|
+
# apt
|
269
|
+
user_data['apt'] = {}
|
270
|
+
# preserve source list for a while
|
271
|
+
user_data['apt']['preserve_sources_list'] = true
|
272
|
+
|
273
|
+
if options['no-maas']
|
274
|
+
# When there is no MAAS, containers should be able to resolve
|
275
|
+
# their name with hosts file.
|
276
|
+
user_data['manage_etc_hosts'] = true
|
277
|
+
end
|
278
|
+
|
279
|
+
# To add truested root CA certificates
|
280
|
+
# https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
281
|
+
# #configure-an-instances-trusted-ca-certificates
|
282
|
+
#
|
283
|
+
if config[:cloud_init] && config[:cloud_init][:ca_certs]
|
284
|
+
user_data['ca-certs'] = {}
|
285
|
+
certs = []
|
286
|
+
|
287
|
+
config[:cloud_init][:ca_certs].each do |ca|
|
288
|
+
content = get_http_content(ca)
|
289
|
+
certs.push(
|
290
|
+
/^-----BEGIN CERTIFICATE-----.*-/m.match(content).to_s
|
291
|
+
) if content
|
292
|
+
end
|
293
|
+
|
294
|
+
user_data['ca-certs'] = { 'trusted' => certs }
|
295
|
+
end
|
296
|
+
|
297
|
+
# To get CA public key to be used for SSH authentication
|
298
|
+
# https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
299
|
+
# #writing-out-arbitrary-files
|
300
|
+
if config[:cloud_init] && config[:cloud_init][:ssh_ca_public_key]
|
301
|
+
user_data['write_files'] = []
|
302
|
+
content = get_http_content(config[:cloud_init][:ssh_ca_public_key][:key_url])
|
303
|
+
if content
|
304
|
+
file = {
|
305
|
+
'content' => content.chop!,
|
306
|
+
'path' => config[:cloud_init][:ssh_ca_public_key][:key_path],
|
307
|
+
'owner' => config[:cloud_init][:ssh_ca_public_key][:owner],
|
308
|
+
'permissions' => config[:cloud_init][:ssh_ca_public_key][:permissions]
|
309
|
+
}
|
310
|
+
user_data['write_files'].push(file)
|
311
|
+
user_data['bootcmd'] = []
|
312
|
+
user_data['bootcmd'].push(
|
313
|
+
"cloud-init-per once ssh-ca-pub-key \
|
314
|
+
echo \"TrustedUserCAKeys #{file['path']}\" >> /etc/ssh/sshd_config"
|
315
|
+
)
|
316
|
+
end
|
317
|
+
|
318
|
+
if config[:cloud_init][:ssh_ca_public_key][:revocation_url]
|
319
|
+
content = get_http_content(config[:cloud_init][:ssh_ca_public_key][:revocation_url])
|
320
|
+
if content
|
321
|
+
user_data['bootcmd'].push(
|
322
|
+
"cloud-init-per once download-key-revocation-list \
|
323
|
+
curl -o #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]} \
|
324
|
+
#{config[:cloud_init][:ssh_ca_public_key][:revocation_url]}"
|
325
|
+
)
|
326
|
+
user_data['bootcmd'].push(
|
327
|
+
"cloud-init-per once ssh-user-key-revocation-list \
|
328
|
+
echo \"RevokedKeys #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]}\" \
|
329
|
+
>> /etc/ssh/sshd_config"
|
330
|
+
)
|
331
|
+
end
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
# To add users
|
336
|
+
# https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
337
|
+
# #including-users-and-groups
|
338
|
+
if config[:cloud_init] && config[:cloud_init][:users]
|
339
|
+
user_data['users'] = []
|
340
|
+
user_data['users'].push('default')
|
341
|
+
|
342
|
+
config[:cloud_init][:users].each do |user|
|
343
|
+
user_data['users'].push(Hashie.stringify_keys user)
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
return user_data
|
348
|
+
end
|
264
349
|
end
|
265
350
|
end
|
data/lib/gogetit/version.rb
CHANGED
data/lib/providers/libvirt.rb
CHANGED
@@ -3,6 +3,7 @@ require 'securerandom'
|
|
3
3
|
require 'oga'
|
4
4
|
require 'rexml/document'
|
5
5
|
require 'gogetit/util'
|
6
|
+
require 'yaml'
|
6
7
|
|
7
8
|
module Gogetit
|
8
9
|
class GogetLibvirt
|
@@ -249,8 +250,22 @@ module Gogetit
|
|
249
250
|
distro = options[:distro]
|
250
251
|
end
|
251
252
|
|
252
|
-
|
253
|
-
|
253
|
+
require 'base64'
|
254
|
+
user_data = Base64.encode64(
|
255
|
+
"#cloud-config\n" +
|
256
|
+
YAML.dump(generate_cloud_init_config(options, config))[4..-1]
|
257
|
+
)
|
258
|
+
|
259
|
+
maas.conn.request(
|
260
|
+
:post,
|
261
|
+
['machines', system_id],
|
262
|
+
{
|
263
|
+
'op' => 'deploy',
|
264
|
+
'distro_series' => distro,
|
265
|
+
'user_data' => user_data
|
266
|
+
}
|
267
|
+
)
|
268
|
+
|
254
269
|
maas.wait_until_state(system_id, 'Deployed')
|
255
270
|
|
256
271
|
fqdn = name + '.' + maas.get_domain
|
data/lib/providers/lxd.rb
CHANGED
@@ -46,157 +46,76 @@ module Gogetit
|
|
46
46
|
end
|
47
47
|
|
48
48
|
# to generate 'user.user-data'
|
49
|
-
def generate_user_data(
|
49
|
+
def generate_user_data(lxd_params, options)
|
50
50
|
logger.info("Calling <#{__method__.to_s}>")
|
51
51
|
|
52
|
-
|
52
|
+
lxd_params[:config] = {}
|
53
53
|
|
54
54
|
if options['no-maas']
|
55
|
-
|
55
|
+
lxd_params[:config][:"user.user-data"] = {}
|
56
56
|
else
|
57
57
|
sshkeys = maas.get_sshkeys
|
58
58
|
pkg_repos = maas.get_package_repos
|
59
59
|
|
60
|
-
|
60
|
+
lxd_params[:config][:'user.user-data'] = { 'ssh_authorized_keys' => [] }
|
61
61
|
|
62
62
|
sshkeys.each do |key|
|
63
|
-
|
63
|
+
lxd_params[:config][:'user.user-data']['ssh_authorized_keys'].push(key['key'])
|
64
64
|
end
|
65
65
|
|
66
66
|
pkg_repos.each do |repo|
|
67
67
|
if repo['name'] == 'main_archive'
|
68
|
-
|
68
|
+
lxd_params[:config][:'user.user-data']['apt_mirror'] = repo['url']
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
|
73
|
-
|
72
|
+
lxd_params[:config][:"user.user-data"]['source_image_alias'] = lxd_params[:alias]
|
73
|
+
lxd_params[:config][:"user.user-data"]['maas'] = true
|
74
74
|
end
|
75
75
|
|
76
76
|
if options['maas-on-lxc']
|
77
|
-
|
77
|
+
lxd_params[:config][:"security.privileged"] = "true"
|
78
78
|
end
|
79
79
|
|
80
80
|
if options['lxd-in-lxd']
|
81
|
-
|
81
|
+
lxd_params[:config][:"security.nesting"] = "true"
|
82
82
|
end
|
83
83
|
|
84
|
-
|
84
|
+
lxd_params[:config][:"user.user-data"]['gogetit'] = true
|
85
85
|
|
86
86
|
# To disable to update apt database on first boot
|
87
87
|
# so chef client can keep doing its job.
|
88
|
-
|
89
|
-
|
88
|
+
lxd_params[:config][:'user.user-data']['package_update'] = false
|
89
|
+
lxd_params[:config][:'user.user-data']['package_upgrade'] = false
|
90
90
|
|
91
|
-
generate_cloud_init_config(
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
return args
|
97
|
-
end
|
98
|
-
|
99
|
-
def generate_cloud_init_config(options, config, args)
|
100
|
-
logger.info("Calling <#{__method__.to_s}>")
|
101
|
-
|
102
|
-
# apt
|
103
|
-
args[:config][:'user.user-data']['apt'] = {}
|
104
|
-
# preserve source list for a while
|
105
|
-
args[:config][:'user.user-data']['apt']['preserve_sources_list'] = true
|
106
|
-
|
107
|
-
if options['no-maas']
|
108
|
-
# When there is no MAAS, containers should be able to resolve
|
109
|
-
# their name with hosts file.
|
110
|
-
args[:config][:'user.user-data']['manage_etc_hosts'] = true
|
111
|
-
end
|
112
|
-
|
113
|
-
# To add truested root CA certificates
|
114
|
-
# https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
115
|
-
# #configure-an-instances-trusted-ca-certificates
|
116
|
-
#
|
117
|
-
if config[:cloud_init] && config[:cloud_init][:ca_certs]
|
118
|
-
args[:config][:'user.user-data']['ca-certs'] = {}
|
119
|
-
certs = []
|
120
|
-
|
121
|
-
config[:cloud_init][:ca_certs].each do |ca|
|
122
|
-
content = get_http_content(ca)
|
123
|
-
certs.push(
|
124
|
-
/^-----BEGIN CERTIFICATE-----.*-/m.match(content).to_s
|
125
|
-
) if content
|
126
|
-
end
|
127
|
-
|
128
|
-
args[:config][:'user.user-data']['ca-certs'] = { 'trusted' => certs }
|
129
|
-
end
|
130
|
-
|
131
|
-
# To get CA public key to be used for SSH authentication
|
132
|
-
# https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
133
|
-
# #writing-out-arbitrary-files
|
134
|
-
if config[:cloud_init] && config[:cloud_init][:ssh_ca_public_key]
|
135
|
-
args[:config][:'user.user-data']['write_files'] = []
|
136
|
-
content = get_http_content(config[:cloud_init][:ssh_ca_public_key][:key_url])
|
137
|
-
if content
|
138
|
-
file = {
|
139
|
-
'content' => content.chop!,
|
140
|
-
'path' => config[:cloud_init][:ssh_ca_public_key][:key_path],
|
141
|
-
'owner' => config[:cloud_init][:ssh_ca_public_key][:owner],
|
142
|
-
'permissions' => config[:cloud_init][:ssh_ca_public_key][:permissions]
|
143
|
-
}
|
144
|
-
args[:config][:'user.user-data']['write_files'].push(file)
|
145
|
-
args[:config][:'user.user-data']['bootcmd'] = []
|
146
|
-
args[:config][:'user.user-data']['bootcmd'].push(
|
147
|
-
"cloud-init-per once ssh-ca-pub-key \
|
148
|
-
echo \"TrustedUserCAKeys #{file['path']}\" >> /etc/ssh/sshd_config"
|
149
|
-
)
|
150
|
-
end
|
151
|
-
|
152
|
-
if config[:cloud_init][:ssh_ca_public_key][:revocation_url]
|
153
|
-
content = get_http_content(config[:cloud_init][:ssh_ca_public_key][:revocation_url])
|
154
|
-
if content
|
155
|
-
args[:config][:'user.user-data']['bootcmd'].push(
|
156
|
-
"cloud-init-per once download-key-revocation-list \
|
157
|
-
curl -o #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]} \
|
158
|
-
#{config[:cloud_init][:ssh_ca_public_key][:revocation_url]}"
|
159
|
-
)
|
160
|
-
args[:config][:'user.user-data']['bootcmd'].push(
|
161
|
-
"cloud-init-per once ssh-user-key-revocation-list \
|
162
|
-
echo \"RevokedKeys #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]}\" \
|
163
|
-
>> /etc/ssh/sshd_config"
|
164
|
-
)
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
# To add users
|
170
|
-
# https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
171
|
-
# #including-users-and-groups
|
172
|
-
if config[:cloud_init] && config[:cloud_init][:users]
|
173
|
-
args[:config][:'user.user-data']['users'] = []
|
174
|
-
args[:config][:'user.user-data']['users'].push('default')
|
91
|
+
lxd_params[:config][:'user.user-data'] = generate_cloud_init_config(
|
92
|
+
options,
|
93
|
+
config,
|
94
|
+
lxd_params[:config][:'user.user-data']
|
95
|
+
)
|
175
96
|
|
176
|
-
|
177
|
-
|
178
|
-
end
|
179
|
-
end
|
97
|
+
lxd_params[:config][:"user.user-data"] = \
|
98
|
+
"#cloud-config\n" + YAML.dump(lxd_params[:config][:"user.user-data"])[4..-1]
|
180
99
|
|
181
|
-
return
|
100
|
+
return lxd_params
|
182
101
|
end
|
183
102
|
|
184
|
-
def generate_network_config(
|
103
|
+
def generate_network_config(lxd_params, options)
|
185
104
|
logger.info("Calling <#{__method__.to_s}>")
|
186
105
|
|
187
106
|
if options['no-maas']
|
188
|
-
|
107
|
+
lxd_params[:config][:'user.network-config'] = \
|
189
108
|
YAML.load_file(options['file'])['network']
|
190
109
|
|
191
110
|
# physical device will be the gate device
|
192
|
-
|
111
|
+
lxd_params[:config][:"user.network-config"]['config'].each do |iface|
|
193
112
|
if iface['type'] == "physical"
|
194
113
|
options['ip_to_access'] = iface['subnets'][0]['address'].split('/')[0]
|
195
114
|
end
|
196
115
|
end
|
197
116
|
|
198
|
-
|
199
|
-
YAML.dump(
|
117
|
+
lxd_params[:config][:"user.network-config"] = \
|
118
|
+
YAML.dump(lxd_params[:config][:"user.network-config"])[4..-1]
|
200
119
|
|
201
120
|
elsif options['ipaddresses']
|
202
121
|
options[:ifaces] = check_ip_available(options['ipaddresses'], maas)
|
@@ -205,7 +124,7 @@ echo \"RevokedKeys #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]}\
|
|
205
124
|
abort("There is no gateway specified for the gateway network.") \
|
206
125
|
unless options[:ifaces][0]['gateway_ip']
|
207
126
|
|
208
|
-
|
127
|
+
lxd_params[:config][:'user.network-config'] = {
|
209
128
|
'version' => 1,
|
210
129
|
'config' => [
|
211
130
|
{
|
@@ -266,26 +185,26 @@ echo \"RevokedKeys #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]}\
|
|
266
185
|
end
|
267
186
|
end
|
268
187
|
|
269
|
-
|
188
|
+
lxd_params[:config][:'user.network-config']['config'].push(iface_conf)
|
270
189
|
end
|
271
190
|
|
272
|
-
|
273
|
-
YAML.dump(
|
191
|
+
lxd_params[:config][:"user.network-config"] = \
|
192
|
+
YAML.dump(lxd_params[:config][:"user.network-config"])[4..-1]
|
274
193
|
end
|
275
194
|
|
276
|
-
return
|
195
|
+
return lxd_params
|
277
196
|
end
|
278
197
|
|
279
198
|
# To configure devices
|
280
|
-
def generate_devices(
|
199
|
+
def generate_devices(lxd_params, options)
|
281
200
|
logger.info("Calling <#{__method__.to_s}>")
|
282
|
-
|
201
|
+
lxd_params[:devices] = {}
|
283
202
|
|
284
203
|
if options['no-maas']
|
285
|
-
|
204
|
+
lxd_params[:devices] = YAML.load_file(options['file'])['devices']
|
286
205
|
|
287
206
|
# Now, LXD API can handle integer as a value of a map
|
288
|
-
|
207
|
+
lxd_params[:devices].each do |k, v|
|
289
208
|
v.each do |kk, vv|
|
290
209
|
if vv.is_a? Integer
|
291
210
|
v[kk] = vv.to_s
|
@@ -293,13 +212,13 @@ echo \"RevokedKeys #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]}\
|
|
293
212
|
end
|
294
213
|
end
|
295
214
|
|
296
|
-
|
215
|
+
lxd_params[:devices] = (Hashie.symbolize_keys lxd_params[:devices])
|
297
216
|
|
298
217
|
elsif options['ipaddresses']
|
299
218
|
options[:ifaces].each_with_index do |iface,index|
|
300
219
|
if index == 0
|
301
220
|
if iface['vlan']['name'] == 'untagged' # or vid == 0
|
302
|
-
|
221
|
+
lxd_params[:devices][:"eth#{index}"] = {
|
303
222
|
mtu: iface['vlan']['mtu'].to_s, #This must be string
|
304
223
|
name: "eth#{index}",
|
305
224
|
nictype: 'bridged',
|
@@ -307,7 +226,7 @@ echo \"RevokedKeys #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]}\
|
|
307
226
|
type: 'nic'
|
308
227
|
}
|
309
228
|
elsif iface['vlan']['name'] != 'untagged' # or vid != 0
|
310
|
-
|
229
|
+
lxd_params[:devices][:"eth#{index}"] = {
|
311
230
|
mtu: iface['vlan']['mtu'].to_s, #This must be string
|
312
231
|
name: "eth#{index}",
|
313
232
|
nictype: 'bridged',
|
@@ -319,7 +238,7 @@ echo \"RevokedKeys #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]}\
|
|
319
238
|
# it does not need to generate more devices
|
320
239
|
# since it will configure the IPs with tagged VLANs.
|
321
240
|
elsif options[:ifaces][0]['vlan']['name'] != 'untagged'
|
322
|
-
|
241
|
+
lxd_params[:devices][:"eth#{index}"] = {
|
323
242
|
mtu: iface['vlan']['mtu'].to_s, #This must be string
|
324
243
|
name: "eth#{index}",
|
325
244
|
nictype: 'bridged',
|
@@ -346,8 +265,8 @@ echo \"RevokedKeys #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]}\
|
|
346
265
|
end
|
347
266
|
end
|
348
267
|
|
349
|
-
|
350
|
-
|
268
|
+
lxd_params[:devices] = {}
|
269
|
+
lxd_params[:devices][:"eth0"] = {
|
351
270
|
mtu: root_bridge_mtu.to_s, #This must be string
|
352
271
|
name: 'eth0',
|
353
272
|
nictype: 'bridged',
|
@@ -360,13 +279,13 @@ echo \"RevokedKeys #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]}\
|
|
360
279
|
# https://docs.maas.io/2.4/en/installconfig-lxd-install
|
361
280
|
for i in 0..7
|
362
281
|
i = i.to_s
|
363
|
-
|
364
|
-
|
365
|
-
|
282
|
+
lxd_params[:devices]["loop" + i] = {}
|
283
|
+
lxd_params[:devices]["loop" + i]["path"] = "/dev/loop" + i
|
284
|
+
lxd_params[:devices]["loop" + i]["type"] = "unix-block"
|
366
285
|
end
|
367
286
|
end
|
368
287
|
|
369
|
-
return
|
288
|
+
return lxd_params
|
370
289
|
end
|
371
290
|
|
372
291
|
def reserve_ips(name, options, container)
|
@@ -417,24 +336,24 @@ echo \"RevokedKeys #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]}\
|
|
417
336
|
abort("Domain #{name}.#{maas.get_domain} already exists!") \
|
418
337
|
if maas.domain_name_exists?(name) unless options['no-maas']
|
419
338
|
|
420
|
-
|
339
|
+
lxd_params = {}
|
421
340
|
|
422
341
|
if options['alias'].nil? or options['alias'].empty?
|
423
|
-
|
342
|
+
lxd_params[:alias] = config[:lxd][:default_alias]
|
424
343
|
else
|
425
|
-
|
344
|
+
lxd_params[:alias] = options['alias']
|
426
345
|
end
|
427
346
|
|
428
|
-
|
429
|
-
|
430
|
-
|
347
|
+
lxd_params = generate_user_data(lxd_params, options)
|
348
|
+
lxd_params = generate_network_config(lxd_params, options)
|
349
|
+
lxd_params = generate_devices(lxd_params, options)
|
431
350
|
|
432
|
-
|
351
|
+
lxd_params[:sync] ||= true
|
433
352
|
|
434
|
-
conn.create_container(name,
|
353
|
+
conn.create_container(name, lxd_params)
|
435
354
|
container = conn.container(name)
|
436
355
|
|
437
|
-
container.devices =
|
356
|
+
container.devices = lxd_params[:devices].merge!(container.devices.to_hash)
|
438
357
|
|
439
358
|
# https://github.com/jeffshantz/hyperkit/blob/master/lib/hyperkit/client/containers.rb#L240
|
440
359
|
# Adding configurations that are necessary for shipping MAAS on lxc
|
@@ -471,7 +390,7 @@ lxc.cgroup.devices.allow = b 7:* rwm"
|
|
471
390
|
default_user = config[:default][:user]
|
472
391
|
end
|
473
392
|
|
474
|
-
|
393
|
+
lxd_params[:default_user] = default_user
|
475
394
|
|
476
395
|
wait_until_available(ip_or_fqdn, default_user)
|
477
396
|
logger.info("#{name} has been created.")
|
@@ -482,19 +401,19 @@ lxc.cgroup.devices.allow = b 7:* rwm"
|
|
482
401
|
puts "ssh #{default_user}@#{name}"
|
483
402
|
end
|
484
403
|
|
485
|
-
{ result: true, info:
|
404
|
+
{ result: true, info: lxd_params }
|
486
405
|
end
|
487
406
|
|
488
|
-
def destroy(name,
|
407
|
+
def destroy(name, lxd_params = {})
|
489
408
|
logger.info("Calling <#{__method__.to_s}>")
|
490
409
|
|
491
410
|
container = conn.container(name)
|
492
|
-
|
411
|
+
lxd_params[:sync] ||= true
|
493
412
|
|
494
413
|
info = container.to_hash
|
495
414
|
|
496
415
|
if get_state(name) == 'Running'
|
497
|
-
conn.stop_container(name,
|
416
|
+
conn.stop_container(name, lxd_params)
|
498
417
|
end
|
499
418
|
|
500
419
|
wait_until_state(name, 'Stopped')
|
@@ -524,7 +443,7 @@ lxc.cgroup.devices.allow = b 7:* rwm"
|
|
524
443
|
maas.delete_dns_record(name)
|
525
444
|
end
|
526
445
|
|
527
|
-
conn.delete_container(name,
|
446
|
+
conn.delete_container(name, lxd_params)
|
528
447
|
|
529
448
|
# When multiple static IPs were reserved, it will not delete anything
|
530
449
|
# since they are deleted when releasing the IPs above.
|