mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-19 03:12:55 +09:00
Feature #1103: Add hold param to ruby & java oca, and cli.
onetemplate instantiate needs to be done also
This commit is contained in:
1 parent
cec1f87689
commit
8d8da16758
4 files changed
+33
-6
No files matched your search
@@ -51,6 +51,12 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
||||
}
|
||||
}
|
||||
|
||||
HOLD = {
|
||||
:name => "hold",
|
||||
:large => "--hold",
|
||||
:description => "Creates the new VM on hold state instead of pending"
|
||||
}
|
||||
|
||||
def self.rname
|
||||
"VM"
|
||||
end
|
||||
|
||||
+5
-2
@@ -125,7 +125,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
EOT
|
||||
|
||||
command :create, create_desc, [:file, nil], :options =>
|
||||
[OneVMHelper::MULTIPLE]+OpenNebulaHelper::TEMPLATE_OPTIONS_VM do
|
||||
[OneVMHelper::MULTIPLE, OneVMHelper::HOLD]+
|
||||
OpenNebulaHelper::TEMPLATE_OPTIONS_VM do
|
||||
|
||||
number = options[:multiple] || 1
|
||||
exit_code = nil
|
||||
@@ -160,9 +161,11 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
exit 0
|
||||
end
|
||||
|
||||
on_hold = options[:hold] != nil
|
||||
|
||||
number.times do
|
||||
exit_code = helper.create_resource(options) do |vm|
|
||||
error = vm.allocate(template)
|
||||
error = vm.allocate(template, on_hold)
|
||||
end
|
||||
|
||||
break if exit_code == -1
|
||||
|
||||
@@ -150,7 +150,22 @@ public class VirtualMachine extends PoolElement{
|
||||
*/
|
||||
public static OneResponse allocate(Client client, String description)
|
||||
{
|
||||
return client.call(ALLOCATE, description);
|
||||
return allocate(client, description, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a new VM in OpenNebula.
|
||||
*
|
||||
* @param client XML-RPC Client.
|
||||
* @param description A string containing the template of the vm.
|
||||
* @param onHold False to create this VM in pending state, true on hold
|
||||
* @return If successful the message contains the associated
|
||||
* id generated for this VM.
|
||||
*/
|
||||
public static OneResponse allocate(Client client, String description,
|
||||
boolean onHold)
|
||||
{
|
||||
return client.call(ALLOCATE, description, onHold);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -134,9 +134,12 @@ module OpenNebula
|
||||
|
||||
# Allocates a new VirtualMachine in OpenNebula
|
||||
#
|
||||
# +description+ A string containing the template of the VirtualMachine.
|
||||
def allocate(description)
|
||||
super(VM_METHODS[:allocate],description)
|
||||
# @param description [String] A string containing the template of
|
||||
# the VirtualMachine.
|
||||
# @param hold [true,false] false to create the VM in pending state,
|
||||
# true to create it on hold
|
||||
def allocate(description, hold=false)
|
||||
super(VM_METHODS[:allocate], description, hold)
|
||||
end
|
||||
|
||||
# Initiates the instance of the VM on the target host.
|
||||
|
||||
Reference in new issue
Block a user