Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward bridge networks not supported #62

Open
szethh opened this issue Oct 1, 2024 · 1 comment
Open

Forward bridge networks not supported #62

szethh opened this issue Oct 1, 2024 · 1 comment

Comments

@szethh
Copy link

szethh commented Oct 1, 2024

Hi. I was trying to set up a simple bridge network (see below), but I ran into the following error:

[ERROR]   stderr) okt 01 22:29:54 flat nixvirt-start[12725]: NixVirt: libvirt error: unsupported configuration: Unsupported <mac> element in network bridged-network with forward mode='bridge'

Now this is weird because my definition does not contain any <mac> element:

<network>
  <name>bridged-network</name>
  <uuid>cc7439ed-36af-4696-a6f2-1d0c4474d87e</uuid>
  <forward mode="bridge" />
  <bridge name="br0" />
</network>

The nix side of things just imports the file as-is:

networks = [
  {
    definition = ./network.xml;
    active = true;
  }
];

I think it might be because of this snippet? It seems to expect a <mac> entry to exist in every network, and adds it if not found. This should probably not apply for bridge networks.

NixVirt/tool/nixvirt.py

Lines 175 to 185 in 1d5c17c

def _fixDefinitionETree(self,objid,specDefETree):
addresses = specDefETree.xpath("/network/mac/@address")
if len(addresses) == 0:
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

@AshleyYakeley
Copy link
Owner

This is surprising. As you can see from the snippet, the code already checks the "mode" attribute and should not futz around with the MAC address if it's set to "bridge".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants