----- Original Message -----
> From: "Steve Gordon" <[email protected]>
> To: "Don Dupuis" <[email protected]>
> Cc: [email protected]
> 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" <[email protected]>
> > To: "Itamar Heim" <[email protected]>
> > Cc: [email protected]
> > 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
_______________________________________________
Users mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/users

Reply via email to