Bug 5110 (#527): changed type for memory value to deal with >2TB hosts

(cherry picked from commit 248b750945)
This commit is contained in:
juanmont authored and Ruben S. Montero committed 2017-10-13 12:44:05 +02:00
1 parent 31830b62a7
commit 906d03a4e4
5 files changed
+12 -12

No files matched your search

+1 -1
View File
@@ -341,7 +341,7 @@ public:
* @param disk not used
* @return 0 on success
*/
void update_capacity(int cpu, int mem, int disk)
void update_capacity(int cpu, long int mem, int disk)
{
host_share.update(cpu,mem,disk);
};
+3 -3
View File
@@ -1021,7 +1021,7 @@ public:
*
* @return 0 on success
*/
int check_resize(float cpu, int memory, int vcpu, string& error_str);
int check_resize(float cpu, long int memory, int vcpu, string& error_str);
/**
* Resize the VM capacity
@@ -1032,7 +1032,7 @@ public:
*
* @return 0 on success
*/
int resize(float cpu, int memory, int vcpu, string& error_str);
int resize(float cpu, long int memory, int vcpu, string& error_str);
// ------------------------------------------------------------------------
// Virtual Machine Disks
@@ -1672,7 +1672,7 @@ private:
/**
* Memory in Kilobytes used by the VM
*/
int memory;
long int memory;
/**
* CPU usage (percent)
+2 -2
View File
@@ -149,7 +149,7 @@ public:
* @param m memory in kb
* @param d in mb (system ds usage)
*/
void add_requirements(float c, int m, long long d);
void add_requirements(float c, long int m, long long d);
/**
* Adds (logical AND) new placement requirements to the current ones
@@ -402,7 +402,7 @@ protected:
int state;
int memory;
long int memory;
float cpu;
long long system_ds_usage;
+2 -2
View File
@@ -38,7 +38,7 @@ void VirtualMachineXML::init_attributes()
xpath(state, "/VM/STATE", -1);
xpath(memory, "/VM/TEMPLATE/MEMORY", 0);
xpath<long int>(memory, "/VM/TEMPLATE/MEMORY", 0);
xpath<float>(cpu, "/VM/TEMPLATE/CPU", 0);
// ------------------------ RANK & DS_RANK ---------------------------------
@@ -204,7 +204,7 @@ ostream& operator<<(ostream& os, VirtualMachineXML& vm)
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void VirtualMachineXML::add_requirements(float c, int m, long long d)
void VirtualMachineXML::add_requirements(float c, long int m, long long d)
{
cpu += c;
memory += m;
+4 -4
View File
@@ -736,8 +736,8 @@ int VirtualMachine::insert(SqlDB * db, string& error_str)
string prefix;
string value;
int ivalue;
float fvalue;
long int ivalue;
float fvalue;
set<int> cluster_ids;
vector<Template *> quotas;
@@ -1752,7 +1752,7 @@ void VirtualMachine::get_requirements (int& cpu, int& memory, int& disk,
/* -------------------------------------------------------------------------- */
int VirtualMachine::check_resize (
float cpu, int memory, int vcpu, string& error_str)
float cpu, long int memory, int vcpu, string& error_str)
{
if (cpu < 0)
{
@@ -1778,7 +1778,7 @@ int VirtualMachine::check_resize (
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int VirtualMachine::resize(float cpu, int memory, int vcpu, string& error_str)
int VirtualMachine::resize(float cpu, long int memory, int vcpu, string& error_str)
{
ostringstream oss;