Feature #1712: Add Ds id to deploy action, cli, ruby & java oca

This commit is contained in:
Carlos Martín committed 2013-09-09 18:32:34 +02:00
1 parent 9eb140e38b
commit fe2d710146
3 files changed
+18 -11

No files matched your search

+9 -6
View File
@@ -111,6 +111,10 @@ cmd=CommandParser::CmdParser.new(ARGV) do
OpenNebulaHelper.rname_to_id(arg, "USER")
end
set :format, :datastoreid, OpenNebulaHelper.rname_to_id_desc("DATASTORE") do |arg|
OpenNebulaHelper.rname_to_id(arg, "DATASTORE")
end
set :format, :vmid, OneVMHelper.to_id_desc do |arg|
helper.to_id(arg)
end
@@ -413,17 +417,16 @@ cmd=CommandParser::CmdParser.new(ARGV) do
States: PENDING
EOT
command :deploy, deploy_desc, [:range,:vmid_list], :hostid,
command :deploy, deploy_desc, [:range,:vmid_list], :hostid, [:datastoreid,nil],
:options=>[ENFORCE] do
host_id = args[1]
verbose = "deploying in host #{host_id}"
enforce = options[:enforce].nil? ? false : options[:enforce]
ds_id = args[2].nil? ? -1 : args[2]
helper.perform_actions(args[0],options,verbose) do |vm|
if !options[:enforce].nil?
vm.deploy(host_id, options[:enforce])
else
vm.deploy(host_id)
end
vm.deploy(host_id, enforce, ds_id)
end
end
@@ -491,11 +491,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 dsId The System Datastore where to deploy the VM. To use the
* default, set it to -1
* @return If an error occurs the error message contains the reason.
*/
public OneResponse deploy(int hostId, boolean enforce)
public OneResponse deploy(int hostId, boolean enforce, int dsId)
{
return client.call(DEPLOY, id, hostId, enforce);
return client.call(DEPLOY, id, hostId, enforce, dsId);
}
/**
@@ -507,7 +509,7 @@ public class VirtualMachine extends PoolElement{
*/
public OneResponse deploy(int hostId)
{
return deploy(hostId, false);
return deploy(hostId, false, -1);
}
/**
+4 -2
View File
@@ -216,11 +216,13 @@ 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 deploy the VM. To
# use the default, set it to -1
#
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
def deploy(host_id, enforce=false)
return call(VM_METHODS[:deploy], @pe_id, host_id.to_i, enforce)
def deploy(host_id, enforce=false, ds_id=-1)
return call(VM_METHODS[:deploy], @pe_id, host_id.to_i, enforce, ds_id)
end
# Shutdowns an already deployed VM