opennebula-5.2.1-addcpumodel.diff
opennebula-5.2.1-addcpumodel/src/vm/VirtualMachine.cc 2017-03-03 13:10:21.046955688 -0600 | ||
---|---|---|
487 | 487 |
// Check for CPU, VCPU and MEMORY attributes |
488 | 488 |
// ------------------------------------------------------------------------ |
489 | 489 | |
490 |
/* CPU Model */ |
|
491 |
user_obj_template->get("CPU_MODEL", value); |
|
492 |
if ( value.empty() == false ) |
|
493 |
{ |
|
494 |
user_obj_template->erase("CPU_MODEL"); |
|
495 |
obj_template->add("CPU_MODEL", value); |
|
496 |
} |
|
497 | ||
498 |
/* Memory */ |
|
490 | 499 |
if ( user_obj_template->get("MEMORY", ivalue) == false || (ivalue * 1024) <= 0 ) |
491 | 500 |
{ |
492 | 501 |
goto error_memory; |
opennebula-5.2.1-addcpumodel/src/vmm/LibVirtDriverKVM.cc 2017-03-03 14:00:33.844102647 -0600 | ||
---|---|---|
93 | 93 | |
94 | 94 |
int num; |
95 | 95 | |
96 |
string cpuModel; |
|
96 | 97 |
string vcpu; |
97 | 98 |
float cpu; |
98 | 99 |
int memory; |
... | ... | |
252 | 253 |
// CPU & Memory |
253 | 254 |
// ------------------------------------------------------------------------ |
254 | 255 | |
256 |
vm->get_template_attribute("CPU_MODEL", cpuModel); |
|
257 |
if (cpuModel.empty()) { |
|
258 |
get_default("CPU_MODEL", cpuModel); |
|
259 |
} |
|
260 | ||
261 |
if (!cpuModel.empty()) { |
|
262 |
if (cpuModel == "host") { |
|
263 |
cpuModel.assign("host-model"); |
|
264 |
} |
|
265 | ||
266 |
if (cpuModel == "host-model" || cpuModel == "host-passthrough") { |
|
267 |
file << "\t<cpu mode=" << one_util::escape_xml_attr(cpuModel) << "/>" << endl; |
|
268 |
} else { |
|
269 |
file << "\t<cpu mode='custom'>" << endl; |
|
270 |
file << "\t\t<model>" << one_util::escape_xml(cpuModel) << "</model>" << endl; |
|
271 |
file << "\t</cpu>" << endl; |
|
272 |
} |
|
273 |
} |
|
274 | ||
255 | 275 |
vm->get_template_attribute("VCPU", vcpu); |
256 | 276 | |
257 | 277 |
if(vcpu.empty()) |