Hello list!
I have been trying to rename a disk alias that defaults to
"some_template_name-Disk1" to something more logical by using ovirtsdk4 (in my
example to "vm2_disk_0"). On the list itself, I saw a couple of examples for
older version of SDK. Basically, I am trying to create a VM and then update its
properties, notably "alias" attribute that can be found in types.Disk. The
first portion of the code works well (vm provisioning), but second one (alias
update) does not, causing the TypeError exception. Obviously, I am doing
something wrong here. I have spent most of the time trying to figure out how to
actually do this. I would kindly ask for some hint.
Thank you in advance!
Regards,
Branimir
*******************************
# create a vm
vms_service = connection.system_service().vms_service()
vms_service.add(
types.Vm(
# --- vm name
name='vm2',
# --- vCpus
cpu=types.Cpu(
topology=types.CpuTopology(cores=2, sockets=1)
),
# --- memory
memory = 512*1024*1024,
# -- oVirt cluster
cluster = types.Cluster(
name='cluster_1',
),
# -- template to use
template = types.Template(
name='centos7-tmplt-compute-node-v1'),
# -- boot device
os =
types.OperatingSystem(boot=types.Boot(devices=[types.BootDevice.HD])),
),
)
# update the vm in terms of disk name
vm = vms_service.list(search='name=vm2')[0]
vm_service = vms_service.vm_service(vm.id)
updated_vm = vm_service.update(
types.Vm(
disk_attachment = types.Disk(alias='vm2_disk_0')
)
)
_______________________________________________
Users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct:
https://www.ovirt.org/community/about/community-guidelines/
List Archives:
https://lists.ovirt.org/archives/list/[email protected]/message/JWUFND4JXIJMZ4HY5LPBSKIBBN4GEL5V/