opennebula-4.12.1-addcpumodel.diff

Add a "CPU_MODEL" virtual machine attribute - Roy Keene, 11/16/2015 03:13 PM

Download (1.94 KB)

View differences:

opennebula-4.12.1-addcpumodel/src/vm/VirtualMachine.cc 2015-08-11 02:41:48.078871060 -0500
308 308
    // Check for CPU, VCPU and MEMORY attributes
309 309
    // ------------------------------------------------------------------------
310 310

  
311
    /* CPU Model */
312
    user_obj_template->get("CPU_MODEL", value);
313
    if ( value.empty() == false )
314
    {
315
        user_obj_template->erase("CPU_MODEL");
316
        obj_template->add("CPU_MODEL", value);
317
    }
318

  
319
    /* Memory */
311 320
    if ( user_obj_template->get("MEMORY", ivalue) == false || ivalue <= 0 )
312 321
    {
313 322
        goto error_memory;
opennebula-4.12.1-addcpumodel/src/vmm/LibVirtDriverKVM.cc 2015-08-11 02:27:31.756936514 -0500
92 92
    int                         num;
93 93
    vector<const Attribute *>   attrs;
94 94

  
95
    string  cpuModel;
95 96
    string  vcpu;
96 97
    float   cpu;
97 98
    int     memory;
......
219 220
    // CPU & Memory
220 221
    // ------------------------------------------------------------------------
221 222

  
223
    vm->get_template_attribute("CPU_MODEL", cpuModel);
224
    if (cpuModel.empty()) {
225
        get_default("CPU_MODEL", cpuModel);
226
    }
227

  
228
    if (!cpuModel.empty()) {
229
        file << "\t<qemu:commandline><qemu:arg value='-cpu'/><qemu:arg value=" << wrapper_attribute(cpuModel) << "/></qemu:commandline>" << endl;
230
    }
231

  
222 232
    vm->get_template_attribute("VCPU", vcpu);
223 233

  
224 234
    if(vcpu.empty())