mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-19 06:50:07 +03:00
feature #1797: change migrate and livemigrate in ruby OCA
This commit is contained in:
parent
2304bf84ad
commit
06abfef245
@ -400,15 +400,10 @@ cmd=CommandParser::CmdParser.new(ARGV) 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[:live]
|
||||
vm.live_migrate(*params)
|
||||
else
|
||||
vm.migrate(*params)
|
||||
end
|
||||
vm.migrate( host_id,
|
||||
options[:live]==true,
|
||||
options[:enforce]==true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -326,32 +326,27 @@ module OpenNebula
|
||||
action('unresched')
|
||||
end
|
||||
|
||||
# Saves a running VM and starts it again in the specified host
|
||||
# Moves a running VM to the specified host. With live=true the
|
||||
# migration is done withdout downtime.
|
||||
#
|
||||
# @param host_id [Interger] The host id (hid) of the target host where
|
||||
# the VM will be migrated.
|
||||
# @param live [true|false] If true the migration is done without
|
||||
# downtime. Defaults to false
|
||||
# @param enforce [true|false] If it is set to true, the host capacity
|
||||
# will be checked, and the deployment will fail if the host is
|
||||
# overcommited. Defaults to false
|
||||
#
|
||||
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
||||
# otherwise
|
||||
def migrate(host_id, enforce=false)
|
||||
return call(VM_METHODS[:migrate], @pe_id, host_id.to_i, false, enforce)
|
||||
def migrate(host_id, live=false, enforce=false)
|
||||
call(VM_METHODS[:migrate], @pe_id, host_id.to_i, live==true,
|
||||
enforce)
|
||||
end
|
||||
|
||||
# Migrates a running VM to another host without downtime
|
||||
#
|
||||
# @param host_id [Interger] The host id (hid) of the target host where
|
||||
# the VM will be migrated.
|
||||
# @param enforce [true|false] If it is set to true, the host capacity
|
||||
# will be checked, and the deployment will fail if the host is
|
||||
# overcommited. Defaults to false
|
||||
#
|
||||
# @return [nil, OpenNebula::Error] nil in case of success, Error
|
||||
# otherwise
|
||||
# @deprecated use {#migrate} instead
|
||||
def live_migrate(host_id, enforce=false)
|
||||
return call(VM_METHODS[:migrate], @pe_id, host_id.to_i, true, enforce)
|
||||
migrate(host_id, true, enforce)
|
||||
end
|
||||
|
||||
# Set the specified vm's disk to be saved in a new image
|
||||
|
Loading…
x
Reference in New Issue
Block a user