Creating unique interfaceid in KVM (RHEL)
Consider the KVM VM has the below definition:
If you clone this VM using virt-clone utility, then the new VM will have the same interface id
If you need new interfaceid for every clone, then some libvirt py files will need change:
1) /usr/share/virt-manager/virtinst/deviceinterface.py
class VirtualPort(XMLBuilder):
_XML_ROOT_NAME = "virtualport"
type = XMLProperty("./@type")
managerid = XMLProperty("./parameters/@managerid", is_int
typeid = XMLProperty("./parameters/@typeid", is_int=True)
typeidversion = XMLProperty("./parameters/@typeidversion"
instanceid = XMLProperty("./parameters/@instanceid")
interfaceid = XMLProperty("./parameters/@interfaceid") <--- added="" div="" newly="">
--->
2) /usr/share/virt-manager/virtinst/cloner.py
import uuid
and following line:
for iface in self._guest.get_devices("interface"):
iface.target_dev = None
if clone_macs:
mac = clone_macs.pop()
else:
mac = VirtualNetworkInterface.generate_mac(self.conn)
iface.macaddr = mac
if iface.virtualport.type:
if iface.virtualport.type:
iface.virtualport.interfaceid = uuid.uuid4() <--- added="" div="" newly="">
--->