qemu: remove qemuDomainSupportsNetdev

Now that we assume QEMU_CAPS_NETDEV, the only thing left to check
is whether we need to use the legacy -net syntax because of
a non-conforming armchitecture.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Ján Tomko 2018-03-29 01:36:20 +02:00
parent f62b1bccf9
commit d3ad6b95f2
5 changed files with 15 additions and 31 deletions

View File

@ -8236,9 +8236,9 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver,
unsigned int queues = net->driver.virtio.queues; unsigned int queues = net->driver.virtio.queues;
char *nic = NULL; char *nic = NULL;
if (!qemuDomainSupportsNetdev(def, qemuCaps, net)) { if (!qemuDomainSupportsNicdev(def, net)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Netdev support unavailable")); "%s", _("Nicdev support unavailable"));
goto error; goto error;
} }
@ -8574,20 +8574,19 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
/* Possible combinations: /* Possible combinations:
* *
* 1. Old way: -net nic,model=e1000,vlan=1 -net tap,vlan=1 * 1. Old way: -net nic,model=e1000,vlan=1 -net tap,vlan=1
* 2. Semi-new: -device e1000,vlan=1 -net tap,vlan=1 * 2. New way: -netdev type=tap,id=netdev1 -device e1000,id=netdev1
* 3. Best way: -netdev type=tap,id=netdev1 -device e1000,id=netdev1
* *
* NB, no support for -netdev without use of -device * NB: The backend and frontend are reversed above
*/ */
if (qemuDomainSupportsNetdev(def, qemuCaps, net)) {
if (qemuDomainSupportsNicdev(def, net)) {
if (!(host = qemuBuildHostNetStr(net, driver, if (!(host = qemuBuildHostNetStr(net, driver,
',', vlan, ',', vlan,
tapfdName, tapfdSize, tapfdName, tapfdSize,
vhostfdName, vhostfdSize))) vhostfdName, vhostfdSize)))
goto cleanup; goto cleanup;
virCommandAddArgList(cmd, "-netdev", host, NULL); virCommandAddArgList(cmd, "-netdev", host, NULL);
}
if (qemuDomainSupportsNicdev(def, net)) {
if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex, if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
vhostfdSize, qemuCaps))) vhostfdSize, qemuCaps)))
goto cleanup; goto cleanup;
@ -8596,8 +8595,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
if (!(nic = qemuBuildNicStr(net, "nic,", vlan))) if (!(nic = qemuBuildNicStr(net, "nic,", vlan)))
goto cleanup; goto cleanup;
virCommandAddArgList(cmd, "-net", nic, NULL); virCommandAddArgList(cmd, "-net", nic, NULL);
}
if (!qemuDomainSupportsNetdev(def, qemuCaps, net)) {
if (!(host = qemuBuildHostNetStr(net, driver, if (!(host = qemuBuildHostNetStr(net, driver,
',', vlan, ',', vlan,
tapfdName, tapfdSize, tapfdName, tapfdSize,
@ -8676,8 +8674,8 @@ qemuBuildNetCommandLine(virQEMUDriverPtr driver,
virDomainNetDefPtr net = def->nets[i]; virDomainNetDefPtr net = def->nets[i];
int vlan; int vlan;
/* VLANs are not used with -netdev, so don't record them */ /* VLANs are not used with -netdev and -device, so don't record them */
if (qemuDomainSupportsNetdev(def, qemuCaps, net)) if (qemuDomainSupportsNicdev(def, net))
vlan = -1; vlan = -1;
else else
vlan = i; vlan = i;

View File

@ -9176,16 +9176,6 @@ qemuDomainSupportsNicdev(virDomainDefPtr def,
return true; return true;
} }
bool
qemuDomainSupportsNetdev(virDomainDefPtr def,
virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,
virDomainNetDefPtr net)
{
if (!qemuDomainSupportsNicdev(def, net))
return false;
return true;
}
bool bool
qemuDomainNetSupportsMTU(virDomainNetType type) qemuDomainNetSupportsMTU(virDomainNetType type)
{ {

View File

@ -799,10 +799,6 @@ int qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver,
bool qemuDomainSupportsNicdev(virDomainDefPtr def, bool qemuDomainSupportsNicdev(virDomainDefPtr def,
virDomainNetDefPtr net); virDomainNetDefPtr net);
bool qemuDomainSupportsNetdev(virDomainDefPtr def,
virQEMUCapsPtr qemuCaps,
virDomainNetDefPtr net);
bool qemuDomainNetSupportsMTU(virDomainNetType type); bool qemuDomainNetSupportsMTU(virDomainNetType type);
int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver, int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,

View File

@ -956,9 +956,9 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
queueSize = net->driver.virtio.queues; queueSize = net->driver.virtio.queues;
if (!queueSize) if (!queueSize)
queueSize = 1; queueSize = 1;
if (!qemuDomainSupportsNetdev(vm->def, priv->qemuCaps, net)) { if (!qemuDomainSupportsNicdev(vm->def, net)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Netdev support unavailable")); "%s", _("Nicdev support unavailable"));
goto cleanup; goto cleanup;
} }

View File

@ -642,11 +642,11 @@ qemuInterfaceOpenVhostNet(virDomainDefPtr def,
return 0; return 0;
} }
/* If qemu doesn't support vhost-net mode (including the -netdev command /* If qemu doesn't support vhost-net mode (including the -netdev and
* option), don't try to open the device. * -device command options), don't try to open the device.
*/ */
if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOST_NET) && if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOST_NET) &&
qemuDomainSupportsNetdev(def, qemuCaps, net))) { qemuDomainSupportsNicdev(def, net))) {
if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) { if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("vhost-net is not supported with " "%s", _("vhost-net is not supported with "