[ovirt-users] Re: Find MAC for VM

2019-09-18 Thread Colin Coe
Ignore, I was missing [0]. Working solution is: --- nics_service = vms_service.vm_service(vm.id).nics_service() nic = nics_service.list(query={"search": "name=nic1"})[0] print('host ',sys.argv[2],' {', sep='') print('hardware ethernet ',nic.mac.address,';', sep='') print('fixed-ad

[ovirt-users] Re: Find MAC for VM

2019-09-18 Thread Colin Coe
Hi Joey Thank you, I'm further along now. I need to get the MAC address of the interface. I've now got: --- nics_service = vms_service.vm_service(vm.id).nics_service() nic = nics_service.list(query={"search": "name=nic1"}) #nic = nics_service.list(search='name=nic1')[0] print('host ',sys.argv[2

[ovirt-users] Re: Find MAC for VM

2019-09-17 Thread Joey Ma
Hi Colin, The VmNicsService.list method in Python sdk v4.1.7 dose not support search parameter, while instead you could try: nics_service.list(query={"search": "name=nic1"} which is exactly the underlying implementation of search parameter. On Wed, Sep 18, 2019 at 6:42 AM Colin Coe wrote: >

[ovirt-users] Re: Find MAC for VM

2019-09-17 Thread Colin Coe
Hi Joey The error I get is: File "createVmFromTemplate.py", line 40, in nic = nics_service.list(search='name=nic1')[0] TypeError: list() got an unexpected keyword argument 'search' The SDK versions I have are: - ovirt-engine-sdk-python-3.6.9.1-1.el7ev.noarch - python-ovirt-engine-sdk

[ovirt-users] Re: Find MAC for VM

2019-09-17 Thread Joey Ma
Hi Colin, I tested the above snippets with the latest Python SDK v4.3.3 (Python 3.7.4) on Engine v4.1.9.1 and everything works fine. Could you please provide the versions of Python/SDK/Engine in your local environment, as well as the error output? Regards, Joey On Mon, Sep 16, 2019 at 9:40 AM C