0006-Altus-change-reserved_cpu-mem-to-reserved_cpu-mem_pe.patch
include/Cluster.h | ||
---|---|---|
176 | 176 |
* @param cpu reserved cpu (in percentage) |
177 | 177 |
* @param mem reserved mem (in KB) |
178 | 178 |
*/ |
179 |
void get_reserved_capacity(long long &cpu, long long& mem)
|
|
179 |
void get_reserved_capacity(long long& cpu, long long& mem)
|
|
180 | 180 |
{ |
181 |
get_template_attribute("RESERVED_CPU", cpu); |
|
181 |
get_template_attribute("RESERVED_CPU_PERCENTAGE", cpu);
|
|
182 | 182 | |
183 |
get_template_attribute("RESERVED_MEM", mem); |
|
183 |
get_template_attribute("RESERVED_MEM_PERCENTAGE", mem);
|
|
184 | 184 |
} |
185 | 185 | |
186 | 186 |
// ************************************************************************* |
include/Host.h | ||
---|---|---|
279 | 279 |
* @param cpu reserved cpu (in percentage) |
280 | 280 |
* @param mem reserved mem (in KB) |
281 | 281 |
*/ |
282 |
void get_reserved_capacity(long long &cpu, long long& mem)
|
|
282 |
void get_reserved_capacity(long long& cpu, long long& mem)
|
|
283 | 283 |
{ |
284 | 284 |
long long tcpu; |
285 | 285 |
long long tmem; |
286 | 286 | |
287 |
if (get_template_attribute("RESERVED_CPU", tcpu)) |
|
287 |
if (get_template_attribute("RESERVED_CPU_PERCENTAGE", tcpu))
|
|
288 | 288 |
{ |
289 | 289 |
cpu = tcpu; |
290 | 290 |
} |
291 | 291 |
else |
292 | 292 |
{ |
293 |
replace_template_attribute("RESERVED_CPU", ""); |
|
293 |
replace_template_attribute("RESERVED_CPU_PERCENTAGE", "");
|
|
294 | 294 |
} |
295 | 295 | |
296 |
if (get_template_attribute("RESERVED_MEM", tmem)) |
|
296 |
if (get_template_attribute("RESERVED_MEM_PERCENTAGE", tmem))
|
|
297 | 297 |
{ |
298 | 298 |
mem = tmem; |
299 | 299 |
} |
300 | 300 |
else |
301 | 301 |
{ |
302 |
replace_template_attribute("RESERVED_MEM", ""); |
|
302 |
replace_template_attribute("RESERVED_MEM_PERCENTAGE", "");
|
|
303 | 303 |
} |
304 | 304 |
} |
305 | 305 |
src/cluster/Cluster.cc | ||
---|---|---|
59 | 59 |
string default_cpu; //TODO - Get these two from oned.conf |
60 | 60 |
string default_mem; |
61 | 61 | |
62 |
add_template_attribute("RESERVED_CPU", default_cpu); |
|
63 |
add_template_attribute("RESERVED_MEM", default_cpu);
|
|
62 |
add_template_attribute("RESERVED_CPU_PERCENTAGE", default_cpu);
|
|
63 |
add_template_attribute("RESERVED_MEM_PERCENTAGE", default_mem);
|
|
64 | 64 |
} |
65 | 65 | |
66 | 66 |
/* -------------------------------------------------------------------------- */ |
src/host/Host.cc | ||
---|---|---|
49 | 49 | |
50 | 50 |
obj_template = new HostTemplate; |
51 | 51 | |
52 |
add_template_attribute("RESERVED_CPU", default_cpu); |
|
53 |
add_template_attribute("RESERVED_MEM", default_cpu);
|
|
52 |
add_template_attribute("RESERVED_CPU_PERCENTAGE", default_cpu);
|
|
53 |
add_template_attribute("RESERVED_MEM_PERCENTAGE", default_mem);
|
|
54 | 54 |
} |
55 | 55 | |
56 | 56 |
Host::~Host() |
... | ... | |
300 | 300 |
get_reserved_capacity(reserved_cpu, reserved_mem); |
301 | 301 | |
302 | 302 |
erase_template_attribute("TOTALCPU", val); |
303 |
host_share.max_cpu = val - reserved_cpu;
|
|
303 |
host_share.max_cpu = val * (1 + -reserved_cpu / 100.0 );
|
|
304 | 304 |
erase_template_attribute("TOTALMEMORY", val); |
305 |
host_share.max_mem = val - reserved_mem;
|
|
305 |
host_share.max_mem = val * (1 + -reserved_mem / 100.0 );
|
|
306 | 306 |
erase_template_attribute("DS_LOCATION_TOTAL_MB", val); |
307 | 307 |
host_share.max_disk = val; |
308 | 308 |