Steve
THANKS!!! That did the trick.
I was originally trying it like this
vm_cpu = params.CPU(topology=[params.CpuTopology(cores=4, sockets=1)])
Don
On Tue, Sep 25, 2012 at 9:50 AM, Steve Gordon <sgordon(a)redhat.com> wrote:
----- Original Message -----
> From: "Steve Gordon" <sgordon(a)redhat.com>
> To: "Don Dupuis" <dondster(a)gmail.com>
> Cc: users(a)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(a)gmail.com>
> > To: "Itamar Heim" <iheim(a)redhat.com>
> > Cc: users(a)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