1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

feature #1797: merge onevm migrate and livemigrate

This commit is contained in:
Javi Fontan 2013-03-13 19:09:48 +01:00
parent 0c5fa0575f
commit 934abab379
2 changed files with 10 additions and 26 deletions

View File

@ -85,7 +85,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
LIVE = {
:name =>"live",
:large => "--live",
:description => "The Image will be saved immediately"
:description => "Do the action with the VM running"
}
def self.rname

View File

@ -385,42 +385,26 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
end
livemigrate_desc = <<-EOT.unindent
Migrates the given running VM to another Host without downtime
States: RUNNING
EOT
command :livemigrate, livemigrate_desc, [:range,:vmid_list], :hostid,
:options=>[ENFORCE] do
host_id = args[1]
verbose = "live migrating to #{host_id}"
helper.perform_actions(args[0],options,verbose) do |vm|
if !options[:enforce].nil?
vm.live_migrate(host_id, options[:enforce])
else
vm.live_migrate(host_id)
end
end
end
migrate_desc = <<-EOT.unindent
Saves the given running VM and starts it again in the specified Host
Migrates the given running VM to another Host. If used with --live
parameter the miration is done without downtime.
States: RUNNING
EOT
command :migrate, migrate_desc, [:range,:vmid_list], :hostid,
:options=>[ENFORCE] do
:options=>[ENFORCE, OneVMHelper::LIVE] do
host_id = args[1]
verbose = "migrating to #{host_id}"
params = [host_id]
params << options[:enforce] if !options[:enforce].nil?
helper.perform_actions(args[0],options,verbose) do |vm|
if !options[:enforce].nil?
vm.migrate(host_id, options[:enforce])
if options[:live]
vm.live_migrate(*params)
else
vm.migrate(host_id)
vm.migrate(*params)
end
end
end