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

Feature #3778: New ds-id param in oca and cli

This commit is contained in:
Carlos Martín 2015-04-29 15:23:37 +02:00
parent b7e12a5a9f
commit 98af16330c
3 changed files with 15 additions and 8 deletions

View File

@ -463,15 +463,18 @@ cmd=CommandParser::CmdParser.new(ARGV) do
States: RUNNING
EOT
command :migrate, migrate_desc, [:range,:vmid_list], :hostid,
command :migrate, migrate_desc, [:range,:vmid_list], :hostid, [:datastoreid,nil],
:options=>[ENFORCE, OneVMHelper::LIVE] do
host_id = args[1]
verbose = "migrating to #{host_id}"
ds_id = args[2].nil? ? -1 : args[2]
helper.perform_actions(args[0],options,verbose) do |vm|
vm.migrate( host_id,
options[:live]==true,
options[:enforce]==true)
options[:enforce]==true,
ds_id)
end
end

View File

@ -591,11 +591,13 @@ public class VirtualMachine extends PoolElement{
* @param enforce 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
* @param ds_id The System Datastore where to migrate the VM. To use the
* current one, set it to -1
* @return If an error occurs the error message contains the reason.
*/
public OneResponse migrate(int hostId, boolean live, boolean enforce)
public OneResponse migrate(int hostId, boolean live, boolean enforce, int ds_id)
{
return client.call(MIGRATE, id, hostId, live, enforce);
return client.call(MIGRATE, id, hostId, live, enforce, ds_id);
}
/**
@ -608,7 +610,7 @@ public class VirtualMachine extends PoolElement{
*/
public OneResponse migrate(int hostId, boolean live)
{
return migrate(hostId, live, false);
return migrate(hostId, live, false, -1);
}
/**
@ -620,7 +622,7 @@ public class VirtualMachine extends PoolElement{
*/
public OneResponse migrate(int hostId)
{
return migrate(hostId, false, false);
return migrate(hostId, false, false, -1);
}
/**

View File

@ -432,12 +432,14 @@ module OpenNebula
# @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
# @param ds_id [Integer] The System Datastore where to migrate the VM.
# To use the current one, set it to -1
#
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
def migrate(host_id, live=false, enforce=false)
def migrate(host_id, live=false, enforce=false, ds_id=-1)
call(VM_METHODS[:migrate], @pe_id, host_id.to_i, live==true,
enforce)
enforce, ds_id.to_i)
end
# @deprecated use {#migrate} instead