mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-22 22:03:39 +03:00
feature #1722: Use the right units for host update. Fix enforce in onevm command
This commit is contained in:
parent
126af25bb7
commit
19e90ec530
@ -339,7 +339,7 @@ public:
|
||||
*/
|
||||
bool test_capacity(int cpu, int mem, int disk)
|
||||
{
|
||||
return host_share.test(cpu,mem,disk);
|
||||
return host_share.test(cpu, mem, disk);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -670,12 +670,12 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
EOT
|
||||
|
||||
command :resize, resize_desc, :vmid, :options =>
|
||||
OpenNebulaHelper::CAPACITY_OPTIONS_VM + [ENFORCE]do
|
||||
OpenNebulaHelper::CAPACITY_OPTIONS_VM + [ENFORCE] do
|
||||
|
||||
cpu = options[:cpu] || 0
|
||||
memory = options[:memory] || 0
|
||||
vcpu = options[:vcpu] || 0
|
||||
enforce = options[:enforce] || true
|
||||
enforce = options[:enforce] || false
|
||||
|
||||
helper.perform_action(args[0], options, "Resizing VM") do |vm|
|
||||
vm.resize(cpu, memory, vcpu, enforce)
|
||||
|
@ -1241,6 +1241,9 @@ void VirtualMachineResize::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
|
||||
if (hid != -1)
|
||||
{
|
||||
int dcpu_host = (int) (dcpu * 100);//now in 100%
|
||||
int dmem_host = dmemory * 1024; //now in Kilobytes
|
||||
|
||||
host = hpool->get(hid, true);
|
||||
|
||||
if (host == 0)
|
||||
@ -1254,7 +1257,7 @@ void VirtualMachineResize::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
return ;
|
||||
}
|
||||
|
||||
if ( enforce && host->test_capacity(dcpu, dmemory, 0) == false )
|
||||
if ( enforce && host->test_capacity(dcpu_host, dmem_host, 0) == false)
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
@ -1270,7 +1273,7 @@ void VirtualMachineResize::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
return;
|
||||
}
|
||||
|
||||
host->update_capacity(dcpu, dmemory, 0);
|
||||
host->update_capacity(dcpu_host, dmem_host, 0);
|
||||
|
||||
hpool->update(host);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user