提交 e007e8ba 编写于 作者: D Daniel P. Berrangé

Revert "virt drivers: don't handle type=network after resolving actual network type"

This reverts commit 2f5e6502.
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 5d5e7875
......@@ -1353,10 +1353,25 @@ libxlMakeNic(virDomainDefPtr def,
}
break;
case VIR_DOMAIN_NET_TYPE_NETWORK:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unexpectedly found type=network for actual NIC type"));
goto cleanup;
{
if (!(conn = virConnectOpen("xen:///system")))
goto cleanup;
if (!(network =
virNetworkLookupByName(conn, l_nic->data.network.name))) {
goto cleanup;
}
if (l_nic->guestIP.nips > 0) {
x_nic->ip = xenMakeIPList(&l_nic->guestIP);
if (!x_nic->ip)
goto cleanup;
}
if (!(x_nic->bridge = virNetworkGetBridgeName(network)))
goto cleanup;
break;
}
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_SERVER:
......
......@@ -3848,7 +3848,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",
......@@ -3866,10 +3867,6 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
if (!(veth = virLXCProcessSetupInterfaceDirect(conn, vm->def, net)))
goto cleanup;
} break;
case VIR_DOMAIN_NET_TYPE_NETWORK:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unexpectedly found type=network for actual NIC type"));
goto cleanup;
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
case VIR_DOMAIN_NET_TYPE_SERVER:
......@@ -3915,6 +3912,7 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
} else if (veth) {
switch (actualType) {
case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_ETHERNET:
ignore_value(virNetDevVethDelete(veth));
break;
......@@ -3923,7 +3921,6 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
ignore_value(virNetDevMacVLanDelete(veth));
break;
case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
case VIR_DOMAIN_NET_TYPE_SERVER:
......@@ -4355,6 +4352,7 @@ lxcDomainDetachDeviceNetLive(virDomainObjPtr vm,
switch (actualType) {
case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_ETHERNET:
if (virNetDevVethDelete(detach->ifname) < 0) {
virDomainAuditNet(vm, detach, NULL, "detach", false);
......@@ -4362,11 +4360,6 @@ lxcDomainDetachDeviceNetLive(virDomainObjPtr vm,
}
break;
case VIR_DOMAIN_NET_TYPE_NETWORK:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unexpectedly found type=network for actual NIC type"));
goto cleanup;
/* It'd be nice to support this, but with macvlan
* once assigned to a container nothing exists on
* the host side. Further the container can change
......
......@@ -8797,6 +8797,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
}
switch (actualType) {
case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_BRIDGE:
tapfdSize = net->driver.virtio.queues;
if (!tapfdSize)
......@@ -8874,11 +8875,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
break;
case VIR_DOMAIN_NET_TYPE_NETWORK:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unexpectedly found type=network for actual NIC type"));
goto cleanup;
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_SERVER:
case VIR_DOMAIN_NET_TYPE_CLIENT:
......@@ -8895,6 +8891,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
*/
switch ((virDomainNetType)actualType) {
case VIR_DOMAIN_NET_TYPE_ETHERNET:
case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_DIRECT:
{
......@@ -8912,7 +8909,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
break;
}
case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
case VIR_DOMAIN_NET_TYPE_SERVER:
......
......@@ -1450,6 +1450,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
switch (actualType) {
case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_NETWORK:
tapfdSize = vhostfdSize = net->driver.virtio.queues;
if (!tapfdSize)
tapfdSize = vhostfdSize = 1;
......@@ -1541,11 +1542,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
/* No preparation needed. */
break;
case VIR_DOMAIN_NET_TYPE_NETWORK:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unexpectedly found type=network for actual NIC type"));
goto cleanup;
case VIR_DOMAIN_NET_TYPE_SERVER:
case VIR_DOMAIN_NET_TYPE_CLIENT:
case VIR_DOMAIN_NET_TYPE_MCAST:
......@@ -3666,13 +3662,8 @@ qemuDomainChangeNetFilter(virDomainObjPtr vm,
switch (virDomainNetGetActualType(newdev)) {
case VIR_DOMAIN_NET_TYPE_ETHERNET:
case VIR_DOMAIN_NET_TYPE_BRIDGE:
break;
case VIR_DOMAIN_NET_TYPE_NETWORK:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unexpectedly found type=network for actual NIC type"));
return -1;
break;
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
case VIR_DOMAIN_NET_TYPE_SERVER:
......
......@@ -58,6 +58,7 @@ qemuInterfaceStartDevice(virDomainNetDefPtr net)
switch (actualType) {
case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_NETWORK:
if (virDomainNetGetActualBridgeMACTableManager(net)
== VIR_NETWORK_BRIDGE_MAC_TABLE_MANAGER_LIBVIRT) {
/* libvirt is managing the FDB of the bridge this device
......@@ -110,11 +111,6 @@ qemuInterfaceStartDevice(virDomainNetDefPtr net)
break;
case VIR_DOMAIN_NET_TYPE_NETWORK:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unexpectedly found type=network for actual NIC type"));
goto cleanup;
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
case VIR_DOMAIN_NET_TYPE_SERVER:
......@@ -168,6 +164,7 @@ qemuInterfaceStopDevice(virDomainNetDefPtr net)
switch (actualType) {
case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_NETWORK:
if (virDomainNetGetActualBridgeMACTableManager(net)
== VIR_NETWORK_BRIDGE_MAC_TABLE_MANAGER_LIBVIRT) {
/* remove the FDB entries that were added during
......@@ -201,11 +198,6 @@ qemuInterfaceStopDevice(virDomainNetDefPtr net)
break;
}
case VIR_DOMAIN_NET_TYPE_NETWORK:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unexpectedly found type=network for actual NIC type"));
goto cleanup;
case VIR_DOMAIN_NET_TYPE_ETHERNET:
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
......
......@@ -7302,15 +7302,12 @@ void qemuProcessStop(virQEMUDriverPtr driver,
}
break;
case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_NETWORK:
#ifdef VIR_NETDEV_TAP_REQUIRE_MANUAL_CLEANUP
if (!(vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH))
ignore_value(virNetDevTapDelete(net->ifname, net->backend.tap));
#endif
break;
case VIR_DOMAIN_NET_TYPE_NETWORK:
VIR_WARN("Unexpectedly found type=network for actual NIC type");
break;
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
case VIR_DOMAIN_NET_TYPE_SERVER:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册