qemuNetworkIfaceConnect() used to have a special case for
actualType='network' (a network with forward mode of route, nat, or
isolated) to call the libvirt public API to retrieve the bridge being
used by a network. That is no longer necessary - since all network
types that use a bridge and tap device now get the bridge name stored
in the ActualNetDef, we can just always use
virDomainNetGetActualBridgeName() instead.
---
Change from V1: This can now actually be applied with no ill side
effects, due to Patch 4/9 setting actual.brname during a libvirtd
restart)
src/lxc/lxc_driver.c | 32 ++------------------------------
src/lxc/lxc_process.c | 32 +-------------------------------
2 files changed, 3 insertions(+), 61 deletions(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 93db1ee..51c664f 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -4161,7 +4161,8 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
actualType = virDomainNetGetActualType(net);
switch (actualType) {
- case VIR_DOMAIN_NET_TYPE_BRIDGE: {
+ case VIR_DOMAIN_NET_TYPE_BRIDGE:
+ case VIR_DOMAIN_NET_TYPE_NETWORK: {
const char *brname = virDomainNetGetActualBridgeName(net);
if (!brname) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -4174,35 +4175,6 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
brname)))
goto cleanup;
} break;
- case VIR_DOMAIN_NET_TYPE_NETWORK: {
- virNetworkPtr network;
- char *brname = NULL;
- bool fail = false;
- virErrorPtr errobj;
-
- if (!(network = virNetworkLookupByName(conn, net->data.network.name)))
- goto cleanup;
- if (!(brname = virNetworkGetBridgeName(network)))
- fail = true;
-
- /* Make sure any above failure is preserved */
- errobj = virSaveLastError();
- virNetworkFree(network);
- virSetError(errobj);
- virFreeError(errobj);
-
- if (fail)
- goto cleanup;
-
- if (!(veth = virLXCProcessSetupInterfaceBridged(conn,
- vm->def,
- net,
- brname))) {
- VIR_FREE(brname);
- goto cleanup;
- }
- VIR_FREE(brname);
- } break;
case VIR_DOMAIN_NET_TYPE_DIRECT: {
if (!(veth = virLXCProcessSetupInterfaceDirect(conn,
vm->def,
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 9208f02..632fc17 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -382,37 +382,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
type = virDomainNetGetActualType(net);
switch (type) {
- case VIR_DOMAIN_NET_TYPE_NETWORK: {
- virNetworkPtr network;
- char *brname = NULL;
- bool fail = false;
- virErrorPtr errobj;
-
- if (!(network = virNetworkLookupByName(conn,
- net->data.network.name)))
- goto cleanup;
- if (!(brname = virNetworkGetBridgeName(network)))
- fail = true;
-
- /* Make sure any above failure is preserved */
- errobj = virSaveLastError();
- virNetworkFree(network);
- virSetError(errobj);
- virFreeError(errobj);
-
- if (fail)
- goto cleanup;
-
- if (!(veth = virLXCProcessSetupInterfaceBridged(conn,
- def,
- net,
- brname))) {
- VIR_FREE(brname);
- goto cleanup;
- }
- VIR_FREE(brname);
- break;
- }
+ case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_BRIDGE: {
const char *brname = virDomainNetGetActualBridgeName(net);
if (!brname) {
--
1.9.3