diff --git a/src/scheduler/include/HostXML.h b/src/scheduler/include/HostXML.h index 50515daaaf..6c9800f6a7 100644 --- a/src/scheduler/include/HostXML.h +++ b/src/scheduler/include/HostXML.h @@ -46,7 +46,7 @@ public: * @param memory the host free memory * @param threshold to consider the host totally free */ - void get_capacity(int& cpu, int& memory, int threshold) const; + void get_capacity(int& cpu, int& memory, float threshold) const; /** * Tests whether a new VM can be hosted by the host or not @@ -80,9 +80,7 @@ public: }; -protected: - - // TODO Check if any of these are not needed, and delete them. +private: int oid; // Host share values @@ -98,13 +96,8 @@ protected: int free_mem; /**< Free memory from the IM monitor */ int free_cpu; /**< Free cpu from the IM monitor */ - int used_disk; /**< Used disk from the IM monitor */ - int used_mem; /**< Used memory from the IM monitor */ - int used_cpu; /**< Used cpu from the IM monitor */ - int running_vms; /**< Number of running VMs in this Host */ - void init_attributes(); }; diff --git a/src/scheduler/src/pool/HostXML.cc b/src/scheduler/src/pool/HostXML.cc index bde76da7a7..b91015ab4e 100644 --- a/src/scheduler/src/pool/HostXML.cc +++ b/src/scheduler/src/pool/HostXML.cc @@ -18,19 +18,17 @@ #include "HostXML.h" -void HostXML::get_capacity(int& cpu, int& memory, int threshold) const +void HostXML::get_capacity(int& cpu, int& memory, float threshold) const { - int total_cpu; vector result; memory = free_mem; cpu = free_cpu; - total_cpu = max_cpu; /* eg. 96.7 >= 0.9 * 100, We need to round */ - if ( cpu >= threshold * total_cpu ) + if ( cpu >= static_cast(threshold * static_cast(max_cpu)) ) { - cpu = (int) ceil((float)cpu/100.0) * 100; + cpu = static_cast(ceil(static_cast(cpu)/100.0) * 100); } } @@ -53,10 +51,6 @@ void HostXML::init_attributes() free_mem = atoi(((*this)["/HOST/HOST_SHARE/FREE_MEM"])[0].c_str()); free_cpu = atoi(((*this)["/HOST/HOST_SHARE/FREE_CPU"])[0].c_str()); - used_disk = atoi(((*this)["/HOST/HOST_SHARE/USED_DISK"])[0].c_str()); - used_mem = atoi(((*this)["/HOST/HOST_SHARE/USED_MEM"])[0].c_str()); - used_cpu = atoi(((*this)["/HOST/HOST_SHARE/USED_CPU"])[0].c_str()); - running_vms = atoi(((*this)["/HOST/HOST_SHARE/RUNNING_VMS"])[0].c_str()); }