fog-proxmox 0.5.3 → 0.5.4
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/Gemfile.lock +2 -2
- data/lib/fog/compute/proxmox/models/disk.rb +1 -0
- data/lib/fog/proxmox/version.rb +1 -1
- data/spec/compute_spec.rb +102 -102
- data/spec/fixtures/proxmox/compute/containers.yml +5005 -1143
- data/spec/fixtures/proxmox/compute/identity_ticket.yml +4 -4
- data/spec/fixtures/proxmox/compute/nodes.yml +18 -18
- data/spec/fixtures/proxmox/compute/servers.yml +9298 -2537
- data/spec/fixtures/proxmox/compute/snapshots.yml +838 -288
- data/spec/fixtures/proxmox/compute/storages.yml +16 -16
- data/spec/fixtures/proxmox/compute/tasks.yml +150 -30
- data/spec/identity_spec.rb +20 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0808e35cf05f51aeb72e25ccbfb66c9cb0176364e0d4b298e5e09a9237c0f940'
|
4
|
+
data.tar.gz: 012e341f0dfe2c74108f65fb68d9cc29b03b2003b9ca7335fe6aa1038e930bc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ab7a7772ade522ab830167f8ca3909a4a32cd6eea3954cfec40243cfab9dd345693fe226fd98d552b848c2b0f506393f25c295ca0169fe1df8c4ca95ea7d92b
|
7
|
+
data.tar.gz: 6a87af1859adc1c4deda619d0eb706369384dda48778531f0366cfc934945b20e6ae3230384e25423a82e405d6fd095e7ffad494d18e33e09a1777d5d8ead31c
|
data/Gemfile.lock
CHANGED
data/lib/fog/proxmox/version.rb
CHANGED
data/spec/compute_spec.rb
CHANGED
@@ -41,15 +41,15 @@ describe Fog::Compute::Proxmox do
|
|
41
41
|
node_name = 'pve'
|
42
42
|
node = @service.nodes.find_by_id node_name
|
43
43
|
tasks = node.tasks.search(options)
|
44
|
-
|
45
|
-
|
44
|
+
tasks.wont_be_nil
|
45
|
+
tasks.wont_be_empty
|
46
46
|
# Get task
|
47
47
|
upid = tasks[0].upid
|
48
48
|
task = node.tasks.find_by_id(upid)
|
49
|
-
|
49
|
+
task.wont_be_nil
|
50
50
|
# Stop task
|
51
51
|
task.stop
|
52
|
-
|
52
|
+
task.exitstatus.must_equal 'OK'
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -60,12 +60,12 @@ describe Fog::Compute::Proxmox do
|
|
60
60
|
node = @service.nodes.find_by_id node_name
|
61
61
|
# Get statistics data
|
62
62
|
data = node.statistics
|
63
|
-
|
64
|
-
|
63
|
+
data.wont_be_nil
|
64
|
+
data.wont_be_empty
|
65
65
|
# Get statistics image
|
66
66
|
data = node.statistics('rrd', { timeframe: 'hour', ds: 'cpu,memused', cf: 'AVERAGE' })
|
67
|
-
|
68
|
-
|
67
|
+
data.wont_be_nil
|
68
|
+
data['image'].wont_be_nil
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -76,15 +76,15 @@ describe Fog::Compute::Proxmox do
|
|
76
76
|
node = @service.nodes.find_by_id node_name
|
77
77
|
# List all storages
|
78
78
|
storages = node.storages.all
|
79
|
-
|
80
|
-
|
79
|
+
storages.wont_be_nil
|
80
|
+
storages.wont_be_empty
|
81
81
|
# List by content type
|
82
82
|
storages = node.storages.list_by_content_type 'iso'
|
83
|
-
|
84
|
-
|
83
|
+
storages.wont_be_nil
|
84
|
+
storages.wont_be_empty
|
85
85
|
# Get storage
|
86
86
|
storage = node.storages.find_by_id('local')
|
87
|
-
|
87
|
+
storage.wont_be_nil
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -97,26 +97,26 @@ describe Fog::Compute::Proxmox do
|
|
97
97
|
server_hash = { vmid: vmid }
|
98
98
|
# Check valid vmid
|
99
99
|
valid = node.servers.id_valid? vmid
|
100
|
-
|
100
|
+
valid.must_equal true
|
101
101
|
# Check not valid vmid
|
102
102
|
valid = node.servers.id_valid? 99
|
103
|
-
|
103
|
+
valid.must_equal false
|
104
104
|
# Create 1st time
|
105
105
|
node.servers.create(server_hash)
|
106
106
|
# Check already used vmid
|
107
107
|
valid = node.servers.id_valid? vmid
|
108
|
-
|
108
|
+
valid.must_equal false
|
109
109
|
# Clone server
|
110
110
|
newid = node.servers.next_id
|
111
111
|
# Get server
|
112
112
|
server = node.servers.get vmid
|
113
|
-
|
113
|
+
server.wont_be_nil
|
114
114
|
# Backup it
|
115
115
|
server.backup(compress: 'lzo')
|
116
116
|
# Get this backup image
|
117
117
|
# Find available backup volumes
|
118
118
|
volume = server.backups.first
|
119
|
-
|
119
|
+
volume.wont_be_nil
|
120
120
|
# Restore it
|
121
121
|
server.restore(volume, storage: 'local')
|
122
122
|
# Delete it
|
@@ -141,16 +141,16 @@ describe Fog::Compute::Proxmox do
|
|
141
141
|
clone.template
|
142
142
|
# Get clone disk image
|
143
143
|
image = clone.images.first
|
144
|
-
|
144
|
+
image.wont_be_nil
|
145
145
|
# Delete clone
|
146
146
|
clone.destroy
|
147
|
-
|
148
|
-
|
149
|
-
|
147
|
+
proc do
|
148
|
+
node.servers.get newid
|
149
|
+
end.must_raise Excon::Errors::InternalServerError
|
150
150
|
# Create 2nd time must fails
|
151
|
-
|
152
|
-
|
153
|
-
|
151
|
+
proc do
|
152
|
+
node.servers.create server_hash
|
153
|
+
end.must_raise Excon::Errors::InternalServerError
|
154
154
|
# Update config server
|
155
155
|
# Add empty cdrom
|
156
156
|
config_hash = { ide2: 'none,media=cdrom' }
|
@@ -167,104 +167,104 @@ describe Fog::Compute::Proxmox do
|
|
167
167
|
config_hash = { onboot: 1, keyboard: 'fr', ostype: 'l26', kvm: 0 }
|
168
168
|
server.update(config_hash)
|
169
169
|
# server config
|
170
|
-
|
171
|
-
|
170
|
+
config = server.config
|
171
|
+
config.identity.must_equal vmid
|
172
172
|
disks = server.config.disks
|
173
173
|
nics = server.config.interfaces
|
174
|
-
|
175
|
-
|
174
|
+
nics.wont_be_nil
|
175
|
+
nics.wont_be_empty
|
176
176
|
nics.get('net0').wont_be_nil
|
177
|
-
|
178
|
-
|
177
|
+
disks.wont_be_nil
|
178
|
+
disks.wont_be_empty
|
179
179
|
virtio0 = disks.get('virtio0')
|
180
|
-
|
180
|
+
virtio0.wont_be_nil
|
181
181
|
ide2 = disks.get('ide2')
|
182
|
-
|
182
|
+
ide2.wont_be_nil
|
183
183
|
# Get a mac adress
|
184
184
|
mac_address = server.config.mac_addresses.first
|
185
|
-
|
185
|
+
mac_address.wont_be_nil
|
186
186
|
# all servers
|
187
187
|
servers_all = node.servers.all
|
188
|
-
|
189
|
-
|
190
|
-
|
188
|
+
servers_all.wont_be_nil
|
189
|
+
servers_all.wont_be_empty
|
190
|
+
servers_all.must_include server
|
191
191
|
# server not running exception
|
192
|
-
|
193
|
-
|
194
|
-
|
192
|
+
proc do
|
193
|
+
server.start_console(websocket: 1)
|
194
|
+
end.must_raise Fog::Proxmox::Errors::ServiceError
|
195
195
|
# Start server
|
196
196
|
server.action('start')
|
197
197
|
server.wait_for { ready? }
|
198
198
|
status = server.ready?
|
199
|
-
|
199
|
+
status.must_equal true
|
200
200
|
# server vga not set exception
|
201
|
-
|
202
|
-
|
203
|
-
|
201
|
+
proc do
|
202
|
+
server.start_console(websocket: 1)
|
203
|
+
end.must_raise Fog::Proxmox::Errors::ServiceError
|
204
204
|
# Stop server
|
205
205
|
server.action('stop')
|
206
206
|
server.wait_for { server.status == 'stopped' }
|
207
207
|
status = server.status
|
208
|
-
|
208
|
+
status.must_equal 'stopped'
|
209
209
|
server.update(vga: 'std')
|
210
210
|
# Start server
|
211
211
|
server.action('start')
|
212
212
|
server.wait_for { ready? }
|
213
213
|
status = server.ready?
|
214
|
-
|
214
|
+
status.must_equal true
|
215
215
|
vnc = server.start_console(websocket: 1)
|
216
|
-
|
216
|
+
vnc['cert'].wont_be_nil
|
217
217
|
port = server.connect_vnc(vnc)
|
218
|
-
|
218
|
+
port.wont_be_nil
|
219
219
|
# Stop server
|
220
220
|
server.action('stop')
|
221
221
|
server.wait_for { server.status == 'stopped' }
|
222
222
|
status = server.status
|
223
|
-
|
223
|
+
status.must_equal 'stopped'
|
224
224
|
server.update(serial0: 'socket', vga: 'serial0')
|
225
225
|
# Start server
|
226
226
|
server.action('start')
|
227
227
|
server.wait_for { ready? }
|
228
228
|
status = server.ready?
|
229
|
-
|
229
|
+
status.must_equal true
|
230
230
|
term = server.start_console
|
231
|
-
|
231
|
+
term['ticket'].wont_be_nil
|
232
232
|
# Stop server
|
233
233
|
server.action('stop')
|
234
234
|
server.wait_for { server.status == 'stopped' }
|
235
235
|
status = server.status
|
236
|
-
|
236
|
+
status.must_equal 'stopped'
|
237
237
|
server.update(vga: 'qxl')
|
238
238
|
# Start server
|
239
239
|
server.action('start')
|
240
240
|
server.wait_for { ready? }
|
241
241
|
status = server.ready?
|
242
|
-
|
242
|
+
status.must_equal true
|
243
243
|
spice = server.start_console
|
244
|
-
|
244
|
+
spice['password'].wont_be_nil
|
245
245
|
# Suspend server
|
246
246
|
server.action('suspend')
|
247
247
|
server.wait_for { server.qmpstatus == 'paused' }
|
248
248
|
qmpstatus = server.qmpstatus
|
249
|
-
|
249
|
+
qmpstatus.must_equal 'paused'
|
250
250
|
# Resume server
|
251
251
|
server.action('resume')
|
252
252
|
server.wait_for { ready? }
|
253
253
|
status = server.ready?
|
254
|
-
|
254
|
+
status.must_equal true
|
255
255
|
# Stop server
|
256
256
|
server.action('stop')
|
257
257
|
server.wait_for { server.status == 'stopped' }
|
258
258
|
status = server.status
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
259
|
+
status.must_equal 'stopped'
|
260
|
+
proc do
|
261
|
+
server.action('hello')
|
262
|
+
end.must_raise Fog::Errors::Error
|
263
263
|
# Delete
|
264
264
|
server.destroy
|
265
|
-
|
266
|
-
|
267
|
-
|
265
|
+
proc do
|
266
|
+
node.servers.get vmid
|
267
|
+
end.must_raise Excon::Errors::InternalServerError
|
268
268
|
end
|
269
269
|
end
|
270
270
|
|
@@ -282,15 +282,15 @@ describe Fog::Compute::Proxmox do
|
|
282
282
|
server.snapshots.create(snapshot_hash)
|
283
283
|
# Find by id
|
284
284
|
snapshot = server.snapshots.get snapname
|
285
|
-
|
285
|
+
snapshot.wont_be_nil
|
286
286
|
# Update
|
287
287
|
snapshot.description = 'Snapshot 1'
|
288
288
|
snapshot.update
|
289
289
|
# all snapshots
|
290
290
|
snapshots_all = server.snapshots.all
|
291
|
-
|
292
|
-
|
293
|
-
|
291
|
+
snapshots_all.wont_be_nil
|
292
|
+
snapshots_all.wont_be_empty
|
293
|
+
snapshots_all.must_include snapshot
|
294
294
|
# Delete
|
295
295
|
snapshot.destroy
|
296
296
|
server.destroy
|
@@ -309,26 +309,26 @@ describe Fog::Compute::Proxmox do
|
|
309
309
|
ostemplate: ostemplate, password: 'proxmox01', rootfs: 'local-lvm:1' }
|
310
310
|
# Check valid vmid
|
311
311
|
valid = node.containers.id_valid? vmid
|
312
|
-
|
312
|
+
valid.must_equal true
|
313
313
|
# Check not valid vmid
|
314
314
|
valid = node.containers.id_valid? 99
|
315
|
-
|
315
|
+
valid.must_equal false
|
316
316
|
# Create 1st time
|
317
317
|
node.containers.create(container_hash)
|
318
318
|
# Check already used vmid
|
319
319
|
valid = node.containers.id_valid? vmid
|
320
|
-
|
320
|
+
valid.must_equal false
|
321
321
|
# Clone container
|
322
322
|
newid = node.containers.next_id
|
323
323
|
# Get container
|
324
324
|
container = node.containers.get vmid
|
325
|
-
|
325
|
+
container.wont_be_nil
|
326
326
|
# Backup it
|
327
327
|
container.backup(compress: 'lzo')
|
328
328
|
# Get this backup image
|
329
329
|
# Find available backup volumes
|
330
330
|
backup = container.backups.first
|
331
|
-
|
331
|
+
container.wont_be_nil
|
332
332
|
# Restore it
|
333
333
|
container.restore(backup, storage: 'local-lvm')
|
334
334
|
# Delete it
|
@@ -342,7 +342,7 @@ describe Fog::Compute::Proxmox do
|
|
342
342
|
container.attach(mp0, options)
|
343
343
|
# Fetch mount points
|
344
344
|
mount_points = container.config.mount_points
|
345
|
-
|
345
|
+
mount_points.wont_be_empty
|
346
346
|
mount_points.get('mp0').wont_be_nil
|
347
347
|
# Remove mount points
|
348
348
|
container.detach('mp0')
|
@@ -356,16 +356,16 @@ describe Fog::Compute::Proxmox do
|
|
356
356
|
clone.template
|
357
357
|
# Get clone disk image
|
358
358
|
image = clone.images.first
|
359
|
-
|
359
|
+
image.wont_be_nil
|
360
360
|
# Delete clone
|
361
361
|
clone.destroy
|
362
|
-
|
363
|
-
|
364
|
-
|
362
|
+
proc do
|
363
|
+
node.containers.get newid
|
364
|
+
end.must_raise Excon::Errors::InternalServerError
|
365
365
|
# Create 2nd time must fails
|
366
|
-
|
367
|
-
|
368
|
-
|
366
|
+
proc do
|
367
|
+
node.containers.create container_hash
|
368
|
+
end.must_raise Excon::Errors::InternalServerError
|
369
369
|
# Update config container
|
370
370
|
# Resize rootfs container
|
371
371
|
container.extend('rootfs', '+5M')
|
@@ -380,48 +380,48 @@ describe Fog::Compute::Proxmox do
|
|
380
380
|
container.update(config_hash)
|
381
381
|
# get container config
|
382
382
|
config = container.config
|
383
|
-
|
384
|
-
|
383
|
+
config.wont_be_nil
|
384
|
+
config.identity.must_equal vmid
|
385
385
|
# Get a mac address
|
386
386
|
mac_address = container.config.mac_addresses.first
|
387
|
-
|
387
|
+
mac_address.wont_be_nil
|
388
388
|
# Fetch nics
|
389
389
|
interfaces = container.config.interfaces
|
390
|
-
|
391
|
-
|
390
|
+
interfaces.wont_be_empty
|
391
|
+
interfaces.get('net0').wont_be_nil
|
392
392
|
# all containers
|
393
393
|
containers_all = node.containers.all
|
394
|
-
|
395
|
-
|
396
|
-
|
394
|
+
containers_all.wont_be_nil
|
395
|
+
containers_all.wont_be_empty
|
396
|
+
containers_all.first.vmid.must_equal container.vmid.to_s
|
397
397
|
# Start container
|
398
398
|
container.action('start')
|
399
399
|
container.wait_for { ready? }
|
400
400
|
status = container.ready?
|
401
|
-
|
401
|
+
status.must_equal true
|
402
402
|
# Suspend container not implemented
|
403
|
-
|
404
|
-
|
405
|
-
|
403
|
+
proc do
|
404
|
+
container.action('suspend')
|
405
|
+
end.must_raise Fog::Errors::Error
|
406
406
|
# Resume container not implemented
|
407
|
-
|
408
|
-
|
409
|
-
|
407
|
+
proc do
|
408
|
+
container.action('resume')
|
409
|
+
end.must_raise Fog::Errors::Error
|
410
410
|
# Stop container
|
411
411
|
container.action('stop')
|
412
412
|
container.wait_for { container.status == 'stopped' }
|
413
413
|
status = container.status
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
414
|
+
status.must_equal 'stopped'
|
415
|
+
proc do
|
416
|
+
container.action('hello')
|
417
|
+
end.must_raise Fog::Errors::Error
|
418
418
|
# Delete
|
419
419
|
container.destroy
|
420
420
|
# Delete container does not delete images
|
421
421
|
storage.volumes.each(&:destroy)
|
422
|
-
|
423
|
-
|
424
|
-
|
422
|
+
proc do
|
423
|
+
node.containers.get vmid
|
424
|
+
end.must_raise Excon::Errors::InternalServerError
|
425
425
|
end
|
426
426
|
end
|
427
427
|
end
|