[PATCH] qemu: s/VIR_ERR_NO_SUPPORT/VIR_ERR_OPERATION_UNSUPPORTED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The VIR_ERR_NO_SUPPORT error code is reserved for cases where an
API is not implemented in a driver. It definitely should not be
used when an API execution fails due to unsupported operation.
---
 src/qemu/qemu_driver.c       |  2 +-
 src/qemu/qemu_hotplug.c      | 30 +++++++++++++++---------------
 src/qemu/qemu_monitor.c      |  2 +-
 src/qemu/qemu_monitor_text.c |  2 +-
 src/qemu/qemu_process.c      |  2 +-
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9cd9e44..c6e579f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3141,7 +3141,7 @@ static int qemuDumpToFd(virQEMUDriverPtr driver, virDomainObjPtr vm,
     int ret = -1;
 
     if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DUMP_GUEST_MEMORY)) {
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("dump-guest-memory is not supported"));
         return -1;
     }
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 044f8cd..de9edd4 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1468,7 +1468,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
     int ret = -1;
 
     if (!devslot || !(olddev = *devslot)) {
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                        _("cannot find existing network device to modify"));
         goto cleanup;
     }
@@ -1476,7 +1476,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
     oldType = virDomainNetGetActualType(olddev);
     if (oldType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
         /* no changes are possible to a type='hostdev' interface */
-        virReportError(VIR_ERR_NO_SUPPORT,
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                        _("cannot change config of '%s' network type"),
                        virDomainNetTypeToString(oldType));
         goto cleanup;
@@ -1499,7 +1499,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
     if (virMacAddrCmp(&olddev->mac, &newdev->mac)) {
         char oldmac[VIR_MAC_STRING_BUFLEN], newmac[VIR_MAC_STRING_BUFLEN];
 
-        virReportError(VIR_ERR_NO_SUPPORT,
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                        _("cannot change network interface mac address "
                          "from %s to %s"),
                        virMacAddrFormat(&olddev->mac, oldmac),
@@ -1508,7 +1508,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
     }
 
     if (STRNEQ_NULLABLE(olddev->model, newdev->model)) {
-        virReportError(VIR_ERR_NO_SUPPORT,
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                        _("cannot modify network device model from %s to %s"),
                        olddev->model ? olddev->model : "(default)",
                        newdev->model ? newdev->model : "(default)");
@@ -1520,7 +1520,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
          olddev->driver.virtio.txmode != newdev->driver.virtio.txmode ||
          olddev->driver.virtio.ioeventfd != newdev->driver.virtio.ioeventfd ||
          olddev->driver.virtio.event_idx != newdev->driver.virtio.event_idx)) {
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("cannot modify virtio network device driver attributes"));
         goto cleanup;
     }
@@ -1534,7 +1534,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
     }
 
     if (STRNEQ_NULLABLE(olddev->script, newdev->script)) {
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("cannot modify network device script attribute"));
         goto cleanup;
     }
@@ -1546,7 +1546,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
         goto cleanup;
     }
     if (STRNEQ_NULLABLE(olddev->ifname, newdev->ifname)) {
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("cannot modify network device tap name"));
         goto cleanup;
     }
@@ -1564,7 +1564,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
     }
     if (!virDevicePCIAddressEqual(&olddev->info.addr.pci,
                                   &newdev->info.addr.pci)) {
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("cannot modify network device guest PCI address"));
         goto cleanup;
     }
@@ -1575,22 +1575,22 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
         goto cleanup;
     }
     if (STRNEQ_NULLABLE(olddev->info.alias, newdev->info.alias)) {
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("cannot modify network device alias"));
         goto cleanup;
     }
     if (olddev->info.rombar != newdev->info.rombar) {
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("cannot modify network device rom bar setting"));
         goto cleanup;
     }
     if (STRNEQ_NULLABLE(olddev->info.romfile, newdev->info.romfile)) {
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("cannot modify network rom file"));
         goto cleanup;
     }
     if (olddev->info.bootIndex != newdev->info.bootIndex) {
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("cannot modify network device boot index setting"));
         goto cleanup;
     }
@@ -1617,7 +1617,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
 
     if (newType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
         /* can't turn it into a type='hostdev' interface */
-        virReportError(VIR_ERR_NO_SUPPORT,
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                        _("cannot change network interface type to '%s'"),
                        virDomainNetTypeToString(newType));
         goto cleanup;
@@ -1675,7 +1675,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
             break;
 
         default:
-            virReportError(VIR_ERR_NO_SUPPORT,
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                            _("unable to change config on '%s' network type"),
                            virDomainNetTypeToString(newdev->type));
             break;
@@ -1746,7 +1746,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
     /* FINALLY - actually perform the required actions */
 
     if (needReconnect) {
-        virReportError(VIR_ERR_NO_SUPPORT,
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                        _("unable to change config on '%s' network type"),
                        virDomainNetTypeToString(newdev->type));
         goto cleanup;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 175aa57..30f7820 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2121,7 +2121,7 @@ qemuMonitorDumpToFd(qemuMonitorPtr mon, int fd)
         /* We don't have qemuMonitorTextDump(), so we should check mon->json
          * here.
          */
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("dump-guest-memory is not supported in text mode"));
         return -1;
     }
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 1b6efba..68df49d 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -470,7 +470,7 @@ int qemuMonitorTextSetLink(qemuMonitorPtr mon, const char *name, enum virDomainN
 
     /* check if set_link command is supported */
     if (strstr(info, "\nunknown ")) {
-        virReportError(VIR_ERR_NO_SUPPORT,
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                        "%s",
                        _("\'set_link\' not supported by this qemu"));
         goto error;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2465938..0e1c286 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2021,7 +2021,7 @@ qemuProcessSetLinkStates(virDomainObjPtr vm)
             VIR_DEBUG("Setting link state: %s", def->nets[i]->info.alias);
 
             if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) {
-                virReportError(VIR_ERR_NO_SUPPORT, "%s",
+                virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                                _("Setting of link state is not supported by this qemu"));
                 return -1;
             }
-- 
1.8.1.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]