opennebula-cli 4.12.1 → 4.13.80.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NOTICE +1 -6
- data/bin/oneacl +1 -1
- data/bin/oneflow +1 -1
- data/bin/onehost +13 -0
- data/bin/oneimage +31 -1
- data/bin/onevcenter +6 -76
- data/bin/onevm +154 -59
- data/lib/one_helper.rb +3 -3
- data/lib/one_helper/oneacct_helper.rb +29 -7
- data/lib/one_helper/onehost_helper.rb +41 -0
- data/lib/one_helper/oneimage_helper.rb +47 -2
- data/lib/one_helper/onequota_helper.rb +3 -3
- data/lib/one_helper/onevm_helper.rb +364 -21
- data/lib/one_helper/onevnet_helper.rb +4 -4
- data/lib/one_helper/onezone_helper.rb +5 -5
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d11d3a159c5097cd0867e860e3830a6caf5847b9
|
4
|
+
data.tar.gz: 096c01365fc81804718fe90037c31d4fdbbe76cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93738a9b287d2bf42334703b3de47516b2c9f2dcc77212bd98548f08e624bd125a7f399c314f9d68ed01cce0e29ccf96d47ecffc7eef0b698e0a2d2f670662d0
|
7
|
+
data.tar.gz: e15e685a4061d48d2e81b1baa99edd11ee22665dc49f3f0db42283d229a73d05e18595a21bc047bf153c9d6916231581cc75310aaaff76a98ce9e1b3c88daf9c
|
data/NOTICE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
OpenNebula Open Source Project
|
2
2
|
--------------------------------------------------------------------------------
|
3
|
-
Copyright 2002-
|
3
|
+
Copyright 2002-2015, OpenNebula Project, OpenNebula Systems (formerly C12G Labs)
|
4
4
|
--------------------------------------------------------------------------------
|
5
5
|
|
6
6
|
You can find more information about the project, release notes and
|
@@ -21,11 +21,6 @@ The following people have contributed to the development of the technology
|
|
21
21
|
- Daniel Molina Aranda (dmolina@opennebula.org)
|
22
22
|
- Hector Sanjuan Redondo (hsanjuan@opennebula.org)
|
23
23
|
|
24
|
-
The new features for service elasticity (oneFlow) introduced in OpenNebula 4.2
|
25
|
-
were funded by BlackBerry in the context of the Fund a Feature Program.
|
26
|
-
|
27
|
-
OpenNebula Project also acknowledges the contributions of C12G Labs developers.
|
28
|
-
|
29
24
|
LICENSE
|
30
25
|
|
31
26
|
OpenNebula is licensed under the Apache License, Version 2.0 (the
|
data/bin/oneacl
CHANGED
data/bin/oneflow
CHANGED
data/bin/onehost
CHANGED
@@ -239,4 +239,17 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
239
239
|
o.rename(args[1])
|
240
240
|
end
|
241
241
|
end
|
242
|
+
|
243
|
+
importvm_desc = <<-EOT.unindent
|
244
|
+
Import VM to OpenNebula
|
245
|
+
EOT
|
246
|
+
|
247
|
+
command :importvm, importvm_desc, :hostid, :name do
|
248
|
+
helper.perform_action(args[0], options, "imported") do |o|
|
249
|
+
rc = o.info
|
250
|
+
next rc if OpenNebula.is_error?(rc)
|
251
|
+
|
252
|
+
o.import_wild(args[1])
|
253
|
+
end
|
254
|
+
end
|
242
255
|
end
|
data/bin/oneimage
CHANGED
@@ -97,7 +97,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
97
97
|
|
98
98
|
oneimage create -d default centOS.tmpl
|
99
99
|
|
100
|
-
- new image "arch" using a path
|
100
|
+
- new image "arch" using a path:
|
101
101
|
|
102
102
|
oneimage create -d default --name arch --path /tmp/arch.img
|
103
103
|
|
@@ -301,6 +301,36 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
301
301
|
end
|
302
302
|
end
|
303
303
|
|
304
|
+
snapshot_delete_desc = <<-EOT.unindent
|
305
|
+
Deletes a snapshot from the image
|
306
|
+
EOT
|
307
|
+
|
308
|
+
command :"snapshot-delete", snapshot_delete_desc, :imageid, :snapshot_id do
|
309
|
+
helper.perform_action(args[0], options, "snapshot deleted") do |o|
|
310
|
+
o.snapshot_delete(args[1].to_i)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
snapshot_revert_desc = <<-EOT.unindent
|
315
|
+
Reverts image state to a snapshot
|
316
|
+
EOT
|
317
|
+
|
318
|
+
command :"snapshot-revert", snapshot_revert_desc, :imageid, :snapshot_id do
|
319
|
+
helper.perform_action(args[0], options, "image state reverted") do |o|
|
320
|
+
o.snapshot_revert(args[1].to_i)
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
snapshot_flatten_desc = <<-EOT.unindent
|
325
|
+
Flattens the snapshot and removes all other snapshots in the image
|
326
|
+
EOT
|
327
|
+
|
328
|
+
command :"snapshot-flatten", snapshot_flatten_desc, :imageid, :snapshot_id do
|
329
|
+
helper.perform_action(args[0], options, "snapshot flattened") do |o|
|
330
|
+
o.snapshot_flatten(args[1].to_i)
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
304
334
|
list_desc = <<-EOT.unindent
|
305
335
|
Lists Images in the pool
|
306
336
|
EOT
|
data/bin/onevcenter
CHANGED
@@ -216,84 +216,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
216
216
|
end
|
217
217
|
|
218
218
|
vms_desc = <<-EOT.unindent
|
219
|
-
|
219
|
+
Deprecated action in onevcenter, please use onehost importvm instead
|
220
220
|
EOT
|
221
221
|
|
222
222
|
command :vms, vms_desc, :options=>[ VCENTER, USER, PASS ] do
|
223
|
-
|
224
|
-
|
225
|
-
options[:vcenter].nil?
|
226
|
-
STDERR.puts "vCenter connection parameters are mandatory to import"\
|
227
|
-
" VM templates:\n"\
|
228
|
-
"\t --vcenter vCenter hostname\n"\
|
229
|
-
"\t --vuser username to login in vcenter\n"\
|
230
|
-
"\t --vpass password for the user"
|
231
|
-
exit -1
|
232
|
-
end
|
233
|
-
|
234
|
-
begin
|
235
|
-
STDOUT.print "\nConnecting to vCenter: #{options[:vcenter]}..."
|
236
|
-
|
237
|
-
vc = VCenterDriver::VIClient.new_connection(
|
238
|
-
:user => options[:vuser],
|
239
|
-
:password => options[:vpass],
|
240
|
-
:host => options[:vcenter])
|
241
|
-
|
242
|
-
STDOUT.print "done!\n\n"
|
243
|
-
|
244
|
-
STDOUT.print "Looking for running Virtual Machines..."
|
245
|
-
|
246
|
-
rs = vc.running_vms
|
247
|
-
|
248
|
-
STDOUT.print "done!\n"
|
249
|
-
|
250
|
-
rs.each {|dc, tmps|
|
251
|
-
STDOUT.print "\nDo you want to process datacenter #{dc} [y/n]? "
|
223
|
+
STDERR.puts "Deprecated action in onevcenter, please use onehost "\
|
224
|
+
"importvm instead"
|
252
225
|
|
253
|
-
|
254
|
-
|
255
|
-
if tmps.empty?
|
256
|
-
STDOUT.print " No new running Virtual Machines found in"\
|
257
|
-
" #{dc}...\n\n"
|
258
|
-
next
|
259
|
-
end
|
260
|
-
|
261
|
-
tmps.each{ |v|
|
262
|
-
STDOUT.print "\n * Running Virtual Machine found:\n"\
|
263
|
-
" - Name : #{v[:name]}\n"\
|
264
|
-
" - UUID : #{v[:uuid]}\n"\
|
265
|
-
" - Cluster: #{v[:host]}\n"\
|
266
|
-
" Import this Virtual Machine [y/n]? "
|
267
|
-
|
268
|
-
next if STDIN.gets.strip.downcase != 'y'
|
269
|
-
|
270
|
-
one_v = ::OpenNebula::VirtualMachine.new(
|
271
|
-
::OpenNebula::VirtualMachine.build_xml, vc.one)
|
272
|
-
|
273
|
-
rc = one_v.allocate(v[:one])
|
274
|
-
|
275
|
-
if ::OpenNebula.is_error?(rc)
|
276
|
-
STDOUT.puts " Error creating Virtual Machine: "\
|
277
|
-
"#{rc.message}\n"
|
278
|
-
end
|
279
|
-
|
280
|
-
rc = one_v.deploy v[:host_id]
|
281
|
-
|
282
|
-
if ::OpenNebula.is_error?(rc)
|
283
|
-
STDOUT.puts " Error creating Virtual Machine: "\
|
284
|
-
"#{rc.message}\n"
|
285
|
-
else
|
286
|
-
STDOUT.puts " OpenNebula VM #{one_v.id} "\
|
287
|
-
"created!\n"
|
288
|
-
end
|
289
|
-
}
|
290
|
-
}
|
291
|
-
rescue Exception => e
|
292
|
-
STDOUT.puts "error: #{e.message}"
|
293
|
-
exit -1
|
294
|
-
end
|
295
|
-
|
296
|
-
exit 0
|
226
|
+
exit -1
|
297
227
|
end
|
298
228
|
|
299
229
|
network_desc = <<-EOT.unindent
|
@@ -418,14 +348,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
418
348
|
::OpenNebula::Template.build_xml, vc.one)
|
419
349
|
|
420
350
|
vnet_template = n[:one] + ar_str
|
421
|
-
|
351
|
+
|
422
352
|
rc = one_vn.allocate(vnet_template)
|
423
353
|
|
424
354
|
if ::OpenNebula.is_error?(rc)
|
425
355
|
STDOUT.puts " Error creating virtual network: " +
|
426
356
|
" #{rc.message}\n"
|
427
357
|
else
|
428
|
-
STDOUT.puts " OpenNebula virtual network " +
|
358
|
+
STDOUT.puts " OpenNebula virtual network " +
|
429
359
|
"#{one_vn.id} created with size #{size}!\n"
|
430
360
|
end
|
431
361
|
}
|
data/bin/onevm
CHANGED
@@ -56,6 +56,13 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
56
56
|
:description => "Device where the image will be attached"
|
57
57
|
}
|
58
58
|
|
59
|
+
PREFIX={
|
60
|
+
:name => "prefix",
|
61
|
+
:large => "--prefix prefix",
|
62
|
+
:format => String,
|
63
|
+
:description => "Overrides the DEV_PREFIX of the image"
|
64
|
+
}
|
65
|
+
|
59
66
|
IP={
|
60
67
|
:name => "ip",
|
61
68
|
:short => "-i ip",
|
@@ -72,6 +79,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
72
79
|
" writeback, directsync or unsafe. (Only KVM driver)"
|
73
80
|
}
|
74
81
|
|
82
|
+
DISCARD={
|
83
|
+
:name => "discard",
|
84
|
+
:large => "--discard discard_mode",
|
85
|
+
:format => String,
|
86
|
+
:description => "Hypervisor discard mode: ignore or unmap."<<
|
87
|
+
" (Only KVM driver)"
|
88
|
+
}
|
89
|
+
|
75
90
|
ENFORCE={
|
76
91
|
:name => "enforce",
|
77
92
|
:short => "-e",
|
@@ -91,11 +106,25 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
91
106
|
:description => "Recover a VM by failing the pending action"
|
92
107
|
}
|
93
108
|
|
94
|
-
|
95
|
-
:name
|
96
|
-
:
|
97
|
-
:
|
98
|
-
|
109
|
+
RETRY={
|
110
|
+
:name => "retry",
|
111
|
+
:large => "--retry",
|
112
|
+
:description => "Recover a VM by retrying the last failed action"
|
113
|
+
}
|
114
|
+
|
115
|
+
INTERACTIVE={
|
116
|
+
:name => "interactive",
|
117
|
+
:large => "--interactive",
|
118
|
+
:description => "Enables interactive recovery. Only works alongside "<<
|
119
|
+
" the --retry option."
|
120
|
+
}
|
121
|
+
|
122
|
+
SNAP={
|
123
|
+
:name => "snapshot",
|
124
|
+
:short => "-s snapshot",
|
125
|
+
:large => "--snapshot snapshot",
|
126
|
+
:format => String,
|
127
|
+
:description => "ID of the Snapshot to save."
|
99
128
|
}
|
100
129
|
|
101
130
|
########################################################################
|
@@ -292,29 +321,36 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
292
321
|
end
|
293
322
|
end
|
294
323
|
|
295
|
-
|
296
|
-
|
297
|
-
created immediately,
|
298
|
-
|
299
|
-
'onevm delete')
|
300
|
-
|
301
|
-
If '--live' is specified, the Image will be saved immediately.
|
324
|
+
disk_saveas_desc = <<-EOT.unindent
|
325
|
+
Saves the specified VM disk as a new Image. The Image is
|
326
|
+
created immediately, and the contents of the VM disk will be saved to
|
327
|
+
it.
|
302
328
|
|
303
329
|
States: ANY
|
304
330
|
EOT
|
305
331
|
|
306
|
-
command :"disk-
|
307
|
-
:options=>[TYPE,
|
308
|
-
disk_id = args[1].to_i
|
309
|
-
image_name = args[2]
|
310
|
-
image_type = options[:type] || ""
|
332
|
+
command :"disk-saveas", disk_saveas_desc, :vmid, :diskid, :img_name,
|
333
|
+
:options=>[TYPE, SNAP] do
|
311
334
|
|
312
|
-
|
313
|
-
|
335
|
+
disk_id = args[1].to_i
|
336
|
+
image_name = args[2]
|
337
|
+
image_type = options[:type] || ""
|
338
|
+
snapshot_id = options[:snapshot]
|
339
|
+
|
340
|
+
if snapshot_id.nil? || snapshot_id.empty?
|
341
|
+
snapshot_id = -1
|
342
|
+
|
343
|
+
verbose = "disk #{disk_id} prepared to be saved in " <<
|
344
|
+
"the image #{image_name}"
|
345
|
+
else
|
346
|
+
snapshot_id = snapshot_id.to_i
|
347
|
+
|
348
|
+
verbose = "disk #{disk_id} snapshot #{snapshot_id} prepared to " <<
|
349
|
+
"be saved in the image #{image_name}"
|
350
|
+
end
|
314
351
|
|
315
352
|
helper.perform_action(args[0],options,verbose) do |vm|
|
316
|
-
res = vm.
|
317
|
-
options[:live]==true, options[:clonetemplate]==true)
|
353
|
+
res = vm.disk_saveas(disk_id, image_name, image_type, snapshot_id)
|
318
354
|
|
319
355
|
if !OpenNebula.is_error?(res)
|
320
356
|
puts "Image ID: #{res}"
|
@@ -421,7 +457,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
421
457
|
deployment, in a standard installation the Scheduler is in charge
|
422
458
|
of this decision
|
423
459
|
|
424
|
-
States: PENDING
|
460
|
+
States: PENDING, HOLD, STOPPED, UNDEPLOYED
|
425
461
|
EOT
|
426
462
|
|
427
463
|
command :deploy, deploy_desc, [:range,:vmid_list], :hostid, [:datastoreid,nil],
|
@@ -444,32 +480,18 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
444
480
|
States: RUNNING
|
445
481
|
EOT
|
446
482
|
|
447
|
-
command :migrate, migrate_desc, [:range,:vmid_list], :hostid,
|
483
|
+
command :migrate, migrate_desc, [:range,:vmid_list], :hostid, [:datastoreid,nil],
|
448
484
|
:options=>[ENFORCE, OneVMHelper::LIVE] do
|
449
485
|
host_id = args[1]
|
450
486
|
verbose = "migrating to #{host_id}"
|
451
487
|
|
488
|
+
ds_id = args[2].nil? ? -1 : args[2]
|
489
|
+
|
452
490
|
helper.perform_actions(args[0],options,verbose) do |vm|
|
453
491
|
vm.migrate( host_id,
|
454
492
|
options[:live]==true,
|
455
|
-
options[:enforce]==true
|
456
|
-
|
457
|
-
end
|
458
|
-
|
459
|
-
boot_desc = <<-EOT.unindent
|
460
|
-
Boots the given VM.
|
461
|
-
|
462
|
-
States: UNKNOWN, BOOT
|
463
|
-
EOT
|
464
|
-
|
465
|
-
command :boot, boot_desc, [:range,:vmid_list],
|
466
|
-
:options => [OneVMHelper::SCHEDULE] do
|
467
|
-
if (!options[:schedule].nil?)
|
468
|
-
helper.schedule_actions(args[0], options, @comm_name)
|
469
|
-
else
|
470
|
-
helper.perform_actions(args[0],options,"booting") do |vm|
|
471
|
-
vm.boot
|
472
|
-
end
|
493
|
+
options[:enforce]==true,
|
494
|
+
ds_id)
|
473
495
|
end
|
474
496
|
end
|
475
497
|
|
@@ -514,7 +536,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
514
536
|
resume_desc = <<-EOT.unindent
|
515
537
|
Resumes the execution of the a saved VM
|
516
538
|
|
517
|
-
States: STOPPED, SUSPENDED, UNDEPLOYED, POWEROFF
|
539
|
+
States: STOPPED, SUSPENDED, UNDEPLOYED, POWEROFF, UNKNOWN
|
518
540
|
EOT
|
519
541
|
|
520
542
|
command :resume, resume_desc, [:range,:vmid_list],
|
@@ -530,32 +552,40 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
530
552
|
|
531
553
|
recover_desc = <<-EOT.unindent
|
532
554
|
Recovers a stuck VM that is waiting for a driver operation. The recovery
|
533
|
-
may be done by failing or
|
555
|
+
may be done by failing, succeeding or retrying the current operation. YOU NEED
|
534
556
|
TO MANUALLY CHECK THE VM STATUS ON THE HOST, to decide if the operation
|
535
|
-
was successful or not.
|
557
|
+
was successful or not, or if it can be retried.
|
536
558
|
|
537
559
|
Example: A VM is stuck in "migrate" because of a hardware failure. You
|
538
560
|
need to check if the VM is running in the new host or not to recover
|
539
561
|
the vm with --success or --failure, respectively.
|
540
562
|
|
541
|
-
States: Any ACTIVE state.
|
563
|
+
States for success/failure recovers: Any ACTIVE state.
|
564
|
+
States for a retry recover: Any *FAILURE state
|
542
565
|
EOT
|
543
566
|
|
544
567
|
command :recover, recover_desc, [:range,:vmid_list],
|
545
|
-
:options => [SUCCESS, FAILURE] do
|
568
|
+
:options => [SUCCESS, FAILURE, RETRY, INTERACTIVE] do
|
546
569
|
if !options[:success].nil?
|
547
|
-
result =
|
570
|
+
result = 1
|
548
571
|
elsif !options[:failure].nil?
|
549
|
-
result =
|
572
|
+
result = 0
|
573
|
+
elsif !options[:retry].nil?
|
574
|
+
result = 2
|
550
575
|
else
|
551
576
|
STDERR.puts "Need to specify the result of the pending action."
|
552
577
|
STDERR.puts "\t--success recover the VM by succeeding the missing action."
|
553
578
|
STDERR.puts "\t--failure recover the VM by failing the missing action."
|
579
|
+
STDERR.puts "\t--retry recover the VM by retrying the last failed action."
|
554
580
|
exit -1
|
555
581
|
end
|
556
582
|
|
557
583
|
helper.perform_actions(args[0], options, "recovering") do |vm|
|
558
|
-
|
584
|
+
if options[:retry] && options[:interactive]
|
585
|
+
helper.recover_retry_interactive(vm)
|
586
|
+
else
|
587
|
+
vm.recover(result)
|
588
|
+
end
|
559
589
|
end
|
560
590
|
end
|
561
591
|
|
@@ -563,12 +593,12 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
563
593
|
Attaches a disk to a running VM. When using --file add only one
|
564
594
|
DISK instance.
|
565
595
|
|
566
|
-
States: RUNNING
|
596
|
+
States: RUNNING, POWEROFF
|
567
597
|
EOT
|
568
598
|
|
569
599
|
command :"disk-attach", disk_attach_desc, :vmid,
|
570
600
|
:options => [OneVMHelper::FILE, OneVMHelper::IMAGE,
|
571
|
-
TARGET, CACHE] do
|
601
|
+
TARGET, CACHE, DISCARD, PREFIX] do
|
572
602
|
|
573
603
|
if options[:file].nil? and options[:image].nil?
|
574
604
|
STDERR.puts "Provide a template file or an image:"
|
@@ -581,19 +611,25 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
581
611
|
template = File.read(options[:file])
|
582
612
|
else
|
583
613
|
image_id = options[:image]
|
584
|
-
target
|
614
|
+
target = options[:target]
|
615
|
+
prefix = options[:prefix] || "sd"
|
616
|
+
|
585
617
|
if target
|
586
618
|
template =
|
587
619
|
"DISK = [ IMAGE_ID = #{image_id}, TARGET = #{target}"
|
588
620
|
else
|
589
|
-
template =
|
590
|
-
|
621
|
+
template = "DISK = [ IMAGE_ID = #{image_id}"
|
622
|
+
template << ", DEV_PREFIX = #{prefix}"
|
591
623
|
end
|
592
624
|
|
593
625
|
if options[:cache]
|
594
626
|
template<<", CACHE = \"#{options[:cache]}\""
|
595
627
|
end
|
596
628
|
|
629
|
+
if options[:discard]
|
630
|
+
template<<", DISCARD = \"#{options[:discard]}\""
|
631
|
+
end
|
632
|
+
|
597
633
|
template << " ]"
|
598
634
|
end
|
599
635
|
|
@@ -605,7 +641,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
605
641
|
disk_detach_desc = <<-EOT.unindent
|
606
642
|
Detaches a disk from a running VM
|
607
643
|
|
608
|
-
States: RUNNING
|
644
|
+
States: RUNNING, POWEROFF
|
609
645
|
EOT
|
610
646
|
|
611
647
|
command :"disk-detach", disk_detach_desc, :vmid, :diskid do
|
@@ -620,7 +656,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
620
656
|
Attaches a NIC to a running VM. When using --file add only one
|
621
657
|
NIC instance.
|
622
658
|
|
623
|
-
States: RUNNING
|
659
|
+
States: RUNNING, POWEROFF
|
624
660
|
EOT
|
625
661
|
|
626
662
|
command :"nic-attach", nic_attach_desc, :vmid,
|
@@ -653,7 +689,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
653
689
|
nic_detach_desc = <<-EOT.unindent
|
654
690
|
Detaches a NIC from a running VM
|
655
691
|
|
656
|
-
States: RUNNING
|
692
|
+
States: RUNNING, POWEROFF
|
657
693
|
EOT
|
658
694
|
|
659
695
|
command :"nic-detach", nic_detach_desc, :vmid, :nicid do
|
@@ -772,6 +808,45 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
772
808
|
end
|
773
809
|
end
|
774
810
|
|
811
|
+
disk_snapshot_create_desc = <<-EOT.unindent
|
812
|
+
Takes a new snapshot of the given disk. This operation needs support
|
813
|
+
from the Datastore drivers: QCOW2 or Ceph.
|
814
|
+
|
815
|
+
States: POWEROFF
|
816
|
+
EOT
|
817
|
+
|
818
|
+
command :"disk-snapshot-create", disk_snapshot_create_desc,
|
819
|
+
:vmid, :diskid, :name do
|
820
|
+
helper.perform_action(args[0],options,"disk snapshot created") do |o|
|
821
|
+
o.disk_snapshot_create(args[1].to_i, args[2])
|
822
|
+
end
|
823
|
+
end
|
824
|
+
|
825
|
+
disk_snapshot_revert_desc = <<-EOT.unindent
|
826
|
+
Reverts disk state to a previously taken snapshot.
|
827
|
+
|
828
|
+
States: POWEROFF
|
829
|
+
EOT
|
830
|
+
|
831
|
+
command :"disk-snapshot-revert", disk_snapshot_revert_desc,
|
832
|
+
:vmid, :diskid, :snapshot_id do
|
833
|
+
helper.perform_action(args[0],options,"disk snapshot reverted") do |o|
|
834
|
+
o.disk_snapshot_revert(args[1].to_i, args[2].to_i)
|
835
|
+
end
|
836
|
+
end
|
837
|
+
|
838
|
+
disk_snapshot_delete_desc = <<-EOT.unindent
|
839
|
+
Deletes a disk snapshot.
|
840
|
+
|
841
|
+
States: POWEROFF
|
842
|
+
EOT
|
843
|
+
command :"disk-snapshot-delete", disk_snapshot_delete_desc,
|
844
|
+
:vmid, :diskid, :snapshot_id do
|
845
|
+
helper.perform_action(args[0],options,"disk snapshot deleted") do |o|
|
846
|
+
o.disk_snapshot_delete(args[1].to_i, args[2].to_i)
|
847
|
+
end
|
848
|
+
end
|
849
|
+
|
775
850
|
list_desc = <<-EOT.unindent
|
776
851
|
Lists VMs in the pool
|
777
852
|
EOT
|
@@ -834,14 +909,34 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
834
909
|
end
|
835
910
|
end
|
836
911
|
|
912
|
+
save_desc = <<-EOT.unindent
|
913
|
+
Clones the VM's source Template, replacing the disks with live snapshots
|
914
|
+
of the current disks. The VM capacity and NICs are also preserved
|
915
|
+
|
916
|
+
States: POWEROFF
|
917
|
+
EOT
|
918
|
+
|
919
|
+
command :save, save_desc, :vmid, :name do
|
920
|
+
helper.perform_action(args[0],options,"Saving VM") do |vm|
|
921
|
+
res = vm.save_as_template(args[1])
|
922
|
+
|
923
|
+
if !OpenNebula.is_error?(res)
|
924
|
+
puts "Template ID: #{res}"
|
925
|
+
end
|
926
|
+
|
927
|
+
res
|
928
|
+
end
|
929
|
+
end
|
930
|
+
|
837
931
|
# Deprecated commands
|
838
932
|
|
839
933
|
deprecated_command(:attachdisk, 'disk-attach')
|
840
934
|
deprecated_command(:detachdisk, 'disk-detach')
|
841
|
-
deprecated_command(:
|
935
|
+
deprecated_command(:'disk-snapshot', 'disk-saveas')
|
842
936
|
deprecated_command(:livemigrate, 'migrate --live')
|
843
937
|
deprecated_command(:cancel, 'shutdown --hard')
|
844
938
|
deprecated_command(:reset, 'reboot --hard')
|
845
|
-
deprecated_command(:restart, '
|
939
|
+
deprecated_command(:restart, 'recover --retry')
|
940
|
+
deprecated_command(:boot, 'recover --retry')
|
846
941
|
deprecated_command(:resubmit, 'delete --recreate')
|
847
942
|
end
|