[ovirt-users] Ovirt 4.2 - Help adding VM to numa node via python SDK

Don Dupuis dondster at gmail.com
Fri Jan 26 23:13:13 UTC 2018


HI Yaniv

I looked at your reference and it looks like I have almost the same thing,
but I was looking to take it a step further with virtual numa node. Is it
necessary to really do it for extra performance? Below is my code snippet,
it is not cleaned up yet, but works. I am also looking at programatically
added host devices such as a GPU. Do you have an example of doing that?

# Get the "vms" service
vms_service = connection.system_service().vms_service()

# Create vm
vms_service.add(
    types.Vm(
        name='test',
        type=types.VmType('high_performance'),
        memory=20 * 2**30,
        memory_policy=types.MemoryPolicy(guaranteed=20 * 2**30,
ballooning=False, max=20 * 2**30),
        os=types.OperatingSystem(boot=types.Boot(devices=[types.BootDevice.NETWORK,
types.BootDevice.HD]), type='LINUX'),
        #time_zone=types.TimeZone('GMT-06:00'),
        numa_tune_mode=types.NumaTuneMode('preferred'),
        io=types.Io(threads=1),
        cpu=types.Cpu(topology=types.CpuTopology(cores=1, sockets=4,
threads=1), mode=types.CpuMode('host_passthrough'),
                 cpu_tune=types.CpuTune(vcpu_pins=[types.VcpuPin('24', 0),
types.VcpuPin('25', 1), types.VcpuPin('26', 2), types.VcpuPin('27', 3)])),

        placement_policy=types.VmPlacementPolicy(affinity=types.VmAffinity('pinned'),
hosts=[types.Host(name='lab5')]),
        custom_properties=[types.CustomProperty('hugepages', 'hugepages',
'1048576')],
        cluster=types.Cluster(
            name='lab5-Local',
        ),
        template=types.Template(
            name='Blank',
        ),
    ),
)

Thanks

Don

On Fri, Jan 26, 2018 at 11:04 AM, Yaniv Kaul <ykaul at redhat.com> wrote:

>
>
> On Wed, Jan 24, 2018 at 11:18 PM, Don Dupuis <dondster at gmail.com> wrote:
>
>> I am able to create a vm using the sdk with nic and disks using the
>> python sdk, but having trouble understanding how to assign it to virtual
>> numanode onto the physical numanode via python sdk. Any help in this area
>> would be greatly appreciated
>>
>
> Please see line 165 @ [1], I think it's what you are looking for.
> Y.
>
> [1] https://gerrit.ovirt.org/#/c/86715/3/basic-suite-master/
> test-scenarios/004_basic_sanity.py
>
>
>>
>> Thanks
>>
>> Don
>>
>> _______________________________________________
>> Users mailing list
>> Users at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20180126/e988edb7/attachment.html>


More information about the Users mailing list