1
0
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:
Ruben S. Montero 2013-02-24 13:26:37 +01:00
parent 19e90ec530
commit 96c00ab9e5
2 changed files with 18 additions and 1 deletions

View File

@ -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

View File

@ -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;