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',
),
),
)