return -1;
}
+ /* Older libvirtd uses actualType==network, but we now
+ * just use actualType==bridge, as nothing needs to
+ * distinguish the two cases, and this simplifies virt
+ * drive code */
+ if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
+ net->data.network.actual != NULL &&
+ net->data.network.actual->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
+ char mac[VIR_MAC_STRING_BUFLEN];
+ virMacAddrFormat(&net->mac, mac);
+ VIR_DEBUG("Updating NIC %s actual type to bridge", mac);
+ net->data.network.actual->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
+ }
+
return 0;
}
}
bandwidth_node = virXPathNode("./bandwidth", ctxt);
- if (bandwidth_node &&
- virNetDevBandwidthParse(&actual->bandwidth,
- bandwidth_node,
- actual->type == VIR_DOMAIN_NET_TYPE_NETWORK) < 0)
- goto error;
+ if (bandwidth_node) {
+ /* type == NETWORK is legacy config, converted to BRIDGE
+ * in post-parse function, but this code runs before
+ * post-parse logic, so we must account for configs still
+ * using legacy type == NETWORK
+ */
+ bool allowFloor =
+ (actual->type == VIR_DOMAIN_NET_TYPE_NETWORK) ||
+ (actual->type == VIR_DOMAIN_NET_TYPE_BRIDGE &&
+ actual->data.bridge.brname != NULL);
+ if (virNetDevBandwidthParse(&actual->bandwidth,
+ bandwidth_node,
+ allowFloor) < 0)
+ goto error;
+ }
vlanNode = virXPathNode("./vlan", ctxt);
if (vlanNode && virNetDevVlanParse(vlanNode, ctxt, &actual->vlan) < 0)
case VIR_NETWORK_FORWARD_NAT:
case VIR_NETWORK_FORWARD_ROUTE:
case VIR_NETWORK_FORWARD_OPEN:
- /* for these forward types, the actual net type really *is*
- * NETWORK; we just keep the info from the portgroup in
- * iface->data.network.actual
- */
- iface->data.network.actual->type = VIR_DOMAIN_NET_TYPE_NETWORK;
+ iface->data.network.actual->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
/* we also store the bridge device and macTableManager settings
* in iface->data.network.actual->data.bridge for later use
virNetDevBandwidthPtr ifaceBand;
unsigned long long old_floor, new_floor;
- if (virDomainNetGetActualType(iface) != VIR_DOMAIN_NET_TYPE_NETWORK &&
- (virDomainNetGetActualType(iface) != VIR_DOMAIN_NET_TYPE_BRIDGE ||
- iface->data.network.actual->data.bridge.brname == NULL)) {
+ if (virDomainNetGetActualType(iface) != VIR_DOMAIN_NET_TYPE_BRIDGE ||
+ iface->data.network.actual->data.bridge.brname == NULL) {
/* This is not an interface that's plugged into a network.
* We don't care. Thus from our POV bandwidth change is allowed. */
return false;
syncNicRxFilterDeviceOptions(def->ifname, guestFilter, hostFilter);
}
- if (virDomainNetGetActualType(def) == VIR_DOMAIN_NET_TYPE_NETWORK) {
+ if (virDomainNetGetActualType(def) == VIR_DOMAIN_NET_TYPE_BRIDGE) {
const char *brname = virDomainNetGetActualBridgeName(def);
/* For libivrt network connections, set the following TUN/TAP network
<interface type='network'>
<mac address='52:54:00:36:bd:3b'/>
<source network='default'/>
- <actual type='network'>
+ <actual type='bridge'>
<source bridge='virbr0'/>
</actual>
<target dev='vnet0'/>
<interface type='network'>
<mac address='52:54:00:59:59:91'/>
<source network='default'/>
- <actual type='network'>
+ <actual type='bridge'>
<source bridge='virbr0'/>
</actual>
<target dev='vnet0'/>
<interface type='network'>
<mac address='52:54:00:36:bd:3b'/>
<source network='default'/>
- <actual type='network'>
+ <actual type='bridge'>
<source bridge='virbr0'/>
</actual>
<target dev='vnet0'/>
<interface type='network'>
<mac address='52:54:00:36:bd:3b'/>
<source network='default'/>
- <actual type='network'>
+ <actual type='bridge'>
<source bridge='virbr0'/>
</actual>
<target dev='vnet0'/>
<interface type='network'>
<mac address='52:54:00:59:59:91'/>
<source network='default'/>
- <actual type='network'>
+ <actual type='bridge'>
<source bridge='virbr0'/>
</actual>
<target dev='vnet0'/>
<interface type='network'>
<mac address='52:54:00:36:bd:3b'/>
<source network='default'/>
- <actual type='network'>
+ <actual type='bridge'>
<source bridge='virbr0'/>
</actual>
<target dev='vnet0'/>