RHEV 3.2 API changing IP on hypervisor bond sub-int reqs re-passing bond opts
Environment
Red Hat Enterprise Virtualization
3.2, 3.3
Issue
Using the RHEV 3.2 python SDK/API(assuming the later) to change the IP addressing on a hypervisor bonding NIC sub-interface causes the bonding NIC and slave NIC configs to be re-written/re-configured(understandably so, especially if we attach a new sub-interface with a larger MTU). If the desired bonding options for the bonding NIC aren't passed with the sub-interface IP settings, the bonding NIC options will revert to the default settings. This shouldn't be necessary and it requires that one detect that they're working with a sub-interface and capture the existing bonding options to submit with the IP change.
This is the sub-interface IP address changing sequence that's being used:
host = API().hosts.get(name=hostName)
nic = host.nics.get(name=nicName)
nic.set_boot_protocol("static")
nic.set_ip(params.IP(address=ip, netmask=mask, gateway=gw))
nic = nic.update()
The current behavior requires us to also do something like this prior to the update():
rem = re.match(r"^(bond\d+)\.\d+$", nic.name)
parentNicName = rem.group(1)
parentNic = host.nics.get(name=parentNicName)
nic.set_bonding(parentNic.bonding)
Resolution
Workaround Prior To 3.4 Release
rem = re.match(r"^(bond\d+)\.\d+$", nic.name)
parentNicName = rem.group(1)
parentNic = host.nics.get(name=parentNicName)
nic.set_bonding(parentNic.bonding)
Upgrade To 3.4
Root Cause
Previously, using the Red Hat Enterprise Virtualization API to change options on a NIC (network interface card) sub-interface erased and reverted to default settings any pre-configured bonding options. Now, bonding options are preserved.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments