On Thu, Nov 21, 2019 at 9:00 AM <serphentos@sharedlink.tk> wrote:
Hello.
Can someone explain how to attach logical network to host via ovirtsdk?

As a python snippet, attaching a network looks like this:

hosts_service = connection.system_service().hosts_service()
host = hosts_service.list(search='name=ovirt-node-ng-image-20190129-1')[0]
host_service = hosts_service.host_service(host.id)
host_service.setup_networks(
    modified_network_attachments=[
        types.NetworkAttachment(
            network=types.Network(
                name='ovirtmgmt',
            ),
            host_nic=types.HostNic(
                name='eth0',
            ),
            ip_address_assignments=[
                types.IpAddressAssignment(
                    assignment_method=types.BootProtocol.STATIC,
                    ip=types.Ip(
                        address='192.168.122.22',
                        netmask='255.255.255.0',
                        gateway='192.168.122.1'
                    ),
                ),
            ],
        ),
    ]
)

Please find the documentation in
http://ovirt.github.io/ovirt-engine-api-model/4.3/#services/host/methods/setup_networks


 
I saw a example of attaching networks to cluster or dc, but not a host
https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/assign_network_to_cluster.py
_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-leave@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/6OH7ONBLNBN6NC52YWA3ARR7ZZLW6EKH/