1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

F #1843: Added memory and factor to calculate of the ds_usage attribute

This commit is contained in:
juanmont 2018-03-20 16:43:00 +01:00 committed by Ruben S. Montero
parent 038d7289a9
commit a1e90f1a0b
3 changed files with 16 additions and 1 deletions

View File

@ -21,6 +21,7 @@
#include "DatastorePoolXML.h"
#include "NebulaUtil.h"
#include "History.h"
#include "RankScheduler.h"
void VirtualMachineXML::init_attributes()
{
@ -347,6 +348,12 @@ void VirtualMachineXML::init_storage_usage()
}
}
float factor = Scheduler::getInstance<RankScheduler>().get_mem_factor();
if (this->memory > 0 && factor >= 0)
{
system_ds_usage += this->memory * factor;
}
for (int i = 0; i < num ; i++)
{
delete disks[i];
@ -358,7 +365,7 @@ void VirtualMachineXML::init_storage_usage()
void VirtualMachineXML::log(const string &st)
{
if (user_template == 0 || st.empty())
if ( user_template == 0 || st.empty())
{
return;
}

View File

@ -155,6 +155,8 @@ void Scheduler::start()
conf.get("LIVE_RESCHEDS", live_rescheds);
conf.get("FACTOR", factor);
// -----------------------------------------------------------
// Log system & Configuration File
// -----------------------------------------------------------

View File

@ -109,6 +109,12 @@ void SchedulerTemplate::set_conf_default()
vattribute = new VectorAttribute("DEFAULT_DS_SCHED",vvalue);
conf_default.insert(make_pair(vattribute->name(),vattribute));
//FACTOR
value = "0";
attribute = new SingleAttribute("FACTOR",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//LOG CONFIGURATION
vvalue.clear();
vvalue.insert(make_pair("SYSTEM","file"));