Skip to content

Commit

Permalink
Merge pull request #44 from pranjalv123/dont-always-add-mac
Browse files Browse the repository at this point in the history
Don't create MAC address for networks that don't allow it
  • Loading branch information
AshleyYakeley authored Jun 13, 2024
2 parents b2084fc + fe1fd10 commit 2396ff5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tool/nixvirt.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,14 @@ def _getDependents(self,obj):
def _fixDefinitionETree(self,objid,specDefETree):
addresses = specDefETree.xpath("/network/mac/@address")
if len(addresses) == 0:
addr = self._assignMacAddress(objid,0)
mac = lxml.etree.Element("mac")
mac.attrib["address"] = addr
specDefETree.append(mac)
return specDefETree
else:
return None
fwdMode = specDefETree.xpath("/network/forward/@mode")
if fwdMode in [None, 'route', 'nat']:
addr = self._assignMacAddress(objid,0)
mac = lxml.etree.Element("mac")
mac.attrib["address"] = addr
specDefETree.append(mac)
return specDefETree
return None

# https://libvirt.org/html/libvirt-libvirt-storage.html
class PoolConnection(ObjectConnection):
Expand Down

0 comments on commit 2396ff5

Please sign in to comment.