mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
feature #1722: 0 means keep current size for any attribute
This commit is contained in:
parent
19e90ec530
commit
96c00ab9e5
@ -672,7 +672,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
command :resize, resize_desc, :vmid, :options =>
|
||||
OpenNebulaHelper::CAPACITY_OPTIONS_VM + [ENFORCE] do
|
||||
|
||||
cpu = options[:cpu] || 0
|
||||
cpu = options[:cpu] || 0.0
|
||||
memory = options[:memory] || 0
|
||||
vcpu = options[:vcpu] || 0
|
||||
enforce = options[:enforce] || false
|
||||
|
@ -1069,6 +1069,7 @@ void VirtualMachineResize::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
|
||||
float ocpu, dcpu;
|
||||
int omemory, dmemory;
|
||||
int ovcpu;
|
||||
|
||||
Nebula& nd = Nebula::instance();
|
||||
UserPool* upool = nd.get_upool();
|
||||
@ -1102,6 +1103,22 @@ void VirtualMachineResize::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
|
||||
vm->get_template_attribute("MEMORY", omemory);
|
||||
vm->get_template_attribute("CPU", ocpu);
|
||||
vm->get_template_attribute("VCPU", ovcpu);
|
||||
|
||||
if (nmemory == 0)
|
||||
{
|
||||
nmemory = omemory;
|
||||
}
|
||||
|
||||
if (ncpu == 0)
|
||||
{
|
||||
ncpu = ocpu;
|
||||
}
|
||||
|
||||
if (nvcpu == 0)
|
||||
{
|
||||
nvcpu = ovcpu;
|
||||
}
|
||||
|
||||
dcpu = ncpu - ocpu;
|
||||
dmemory = nmemory - omemory;
|
||||
|
Loading…
x
Reference in New Issue
Block a user