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],' {', sep='')
print(' hardware ethernet ',nic.mac.address,';', sep='')
print(' fixed-address x.x.x.x;')
print(' option host-name "',sys.argv[2],'";',
sep='')
print('}')
---
In RHV 4.3, I can use nic.mac.address but that doesn't seem to work here.
Any ideas how to get that last puzzle piece?
Thanks
On Wed, Sep 18, 2019 at 1:10 PM Joey Ma <majunjiev(a)gmail.com> wrote:
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 <colin.coe(a)gmail.com> wrote:
> Hi Joey
>
> The error I get is:
>
> File "createVmFromTemplate.py", line 40, in <module>
>
> 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-sdk4-4.1.7-1.el7ev.x86_64
>
>
> Attempting to remove the v3.6 SDK results in yum trying to remove RHV...
>
>
> Thanks
>
>
>
>
> On Tue, Sep 17, 2019 at 3:03 PM Joey Ma <majunjiev(a)gmail.com> wrote:
>
>> 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 Colin Coe <colin.coe(a)gmail.com> wrote:
>>
>>> Hi all
>>>
>>> I've got the following Python snippet which works fine under 4.3 but I
>>> need it to work under 4.1 as well.
>>> ---
>>> nics_service = vms_service.vm_service(vm.id).nics_service()
>>> nic = nics_service.list(search='name=nic1')[0]
>>> ---
>>>
>>> Under 4.1, it barfs on
"nics_service.list(search='name=nic1')[0]".
>>>
>>> What do I need to do to make it work under 4.1?
>>>
>>> Thanks
>>> _______________________________________________
>>> Users mailing list -- users(a)ovirt.org
>>> To unsubscribe send an email to users-leave(a)ovirt.org
>>> 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/users@ovirt.org/message/AIULSYOC4SN...
>>>
>>