]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: remove qemuDomainSupportsNetdev
authorJán Tomko <jtomko@redhat.com>
Wed, 28 Mar 2018 23:36:20 +0000 (01:36 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 12 Apr 2018 15:17:16 +0000 (17:17 +0200)
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>
src/qemu/qemu_command.c
src/qemu/qemu_domain.c
src/qemu/qemu_domain.h
src/qemu/qemu_hotplug.c
src/qemu/qemu_interface.c

index 71cb091ee1b5b83c4c9c908e164307cfd8b9bd1b..5d4385b81e46c58133acf882961ddb6080eebc13 100644 (file)
@@ -8236,9 +8236,9 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver,
     unsigned int queues = net->driver.virtio.queues;
     char *nic = NULL;
 
-    if (!qemuDomainSupportsNetdev(def, qemuCaps, net)) {
+    if (!qemuDomainSupportsNicdev(def, net)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("Netdev support unavailable"));
+                       "%s", _("Nicdev support unavailable"));
         goto error;
     }
 
@@ -8574,20 +8574,19 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
     /* Possible combinations:
      *
      *  1. Old way:   -net nic,model=e1000,vlan=1 -net tap,vlan=1
-     *  2. Semi-new:  -device e1000,vlan=1        -net tap,vlan=1
-     *  3. Best way:  -netdev type=tap,id=netdev1 -device e1000,id=netdev1
+     *  2. New 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,
                                          ',', vlan,
                                          tapfdName, tapfdSize,
                                          vhostfdName, vhostfdSize)))
             goto cleanup;
         virCommandAddArgList(cmd, "-netdev", host, NULL);
-    }
-    if (qemuDomainSupportsNicdev(def, net)) {
+
         if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
                                        vhostfdSize, qemuCaps)))
             goto cleanup;
@@ -8596,8 +8595,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
         if (!(nic = qemuBuildNicStr(net, "nic,", vlan)))
             goto cleanup;
         virCommandAddArgList(cmd, "-net", nic, NULL);
-    }
-    if (!qemuDomainSupportsNetdev(def, qemuCaps, net)) {
+
         if (!(host = qemuBuildHostNetStr(net, driver,
                                          ',', vlan,
                                          tapfdName, tapfdSize,
@@ -8676,8 +8674,8 @@ qemuBuildNetCommandLine(virQEMUDriverPtr driver,
             virDomainNetDefPtr net = def->nets[i];
             int vlan;
 
-            /* VLANs are not used with -netdev, so don't record them */
-            if (qemuDomainSupportsNetdev(def, qemuCaps, net))
+            /* VLANs are not used with -netdev and -device, so don't record them */
+            if (qemuDomainSupportsNicdev(def, net))
                 vlan = -1;
             else
                 vlan = i;
index 4f7726f76acfa6408d77a29cf7b6a418fd7a26fe..7000de6a912e24d4c717a7a1945ce57e2cb7f59e 100644 (file)
@@ -9176,16 +9176,6 @@ qemuDomainSupportsNicdev(virDomainDefPtr def,
     return true;
 }
 
-bool
-qemuDomainSupportsNetdev(virDomainDefPtr def,
-                         virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,
-                         virDomainNetDefPtr net)
-{
-    if (!qemuDomainSupportsNicdev(def, net))
-        return false;
-    return true;
-}
-
 bool
 qemuDomainNetSupportsMTU(virDomainNetType type)
 {
index ce8f69d336c85c7420e760d4f97739e2fac43fa7..be9aff180b1caf86f59c1da6ca0733b9d47476b6 100644 (file)
@@ -799,10 +799,6 @@ int qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver,
 bool qemuDomainSupportsNicdev(virDomainDefPtr def,
                               virDomainNetDefPtr net);
 
-bool qemuDomainSupportsNetdev(virDomainDefPtr def,
-                              virQEMUCapsPtr qemuCaps,
-                              virDomainNetDefPtr net);
-
 bool qemuDomainNetSupportsMTU(virDomainNetType type);
 
 int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
index c145c42bcdd5ae5b29ee2b9233746be01abbb204..9c52bccdf13acbef709d652de3fb92bbc1ca3899 100644 (file)
@@ -956,9 +956,9 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
         queueSize = net->driver.virtio.queues;
         if (!queueSize)
             queueSize = 1;
-        if (!qemuDomainSupportsNetdev(vm->def, priv->qemuCaps, net)) {
+        if (!qemuDomainSupportsNicdev(vm->def, net)) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
-                           "%s", _("Netdev support unavailable"));
+                           "%s", _("Nicdev support unavailable"));
             goto cleanup;
         }
 
index cebb490221a6e9f2de907421064e6efefde90a22..2a11cda5c9e6ef7214119cb9513b653da29fb3f6 100644 (file)
@@ -642,11 +642,11 @@ qemuInterfaceOpenVhostNet(virDomainDefPtr def,
         return 0;
     }
 
-    /* If qemu doesn't support vhost-net mode (including the -netdev command
-     * option), don't try to open the device.
+    /* If qemu doesn't support vhost-net mode (including the -netdev and
+     * -device command options), don't try to open the device.
      */
     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) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            "%s", _("vhost-net is not supported with "