[Users] How to change number of cpu cores in Ovirt 3.1 with the python sdk.

Steve Gordon sgordon at redhat.com
Tue Sep 25 14:50:21 UTC 2012


----- Original Message -----
> From: "Steve Gordon" <sgordon at redhat.com>
> To: "Don Dupuis" <dondster at gmail.com>
> Cc: users at ovirt.org
> Sent: Tuesday, September 25, 2012 10:44:31 AM
> Subject: Re: [Users] How to change number of cpu cores in Ovirt 3.1 with the python sdk.
> 
> ----- Original Message -----
> > From: "Don Dupuis" <dondster at gmail.com>
> > To: "Itamar Heim" <iheim at redhat.com>
> > Cc: users at ovirt.org
> > Sent: Monday, September 24, 2012 8:08:40 PM
> > Subject: Re: [Users] How to change number of cpu cores in Ovirt 3.1
> > with the python sdk.
> > 
> > I know the layout of the xml stuff, but I am trying to use the
> > python
> > sdk code such as an example
> > 
> > vm_os = params.OperatingSystems(boot=[params.Boot(dev="hd")])
> > 
> > Don
> 
> I think you want params.CpuTopology. I can't work out how to actually
> add that to the VM creation request though, I assigned it to the cpu
> parameter and didn't get an error but I also didn't get a VM with
> the assigned number of cores/sockets.
> 
> Steve

Worked it out. You need to define the CPU topology parameters:

    vm_cpu_top = params.CpuTopology(cores=2, sockets=2)

Then use that to define the CPU parameters:

    vm_cpu = params.CPU(topology=vm_cpu_top)

Finally you pass that in your VM creation request (assume here that I have set the other vm_* variables referenced earlier):

    vm_request = params.VM(name=vm_name, memory=vm_memory, cluster=vm_cluster, template=vm_template, os=vm_os, cpu=vm_cpu)
    vm = api.vms.add(vm_request)

Steve



More information about the Users mailing list