[PATCH V2 1/3] qemu: report properer error number when change graphics failed

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

 



It's not supported to change some graphics arguments with '--live'.
Replace some error code VIR_ERR_INTERNAL_ERROR and VIR_ERR_INVALID_ARG
with VIR_ERR_OPERATION_UNSUPPORTED.

Signed-off-by: Wang Rui <moon.wangrui@xxxxxxxxxx>
---
 src/qemu/qemu_hotplug.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 9467d7d..d1767bb 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2330,7 +2330,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
     }
 
     if (dev->nListens != olddev->nListens) {
-        virReportError(VIR_ERR_INVALID_ARG, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("cannot change the number of listen addresses"));
         goto cleanup;
     }
@@ -2340,7 +2340,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
         virDomainGraphicsListenDefPtr oldlisten = &olddev->listens[i];
 
         if (newlisten->type != oldlisten->type) {
-            virReportError(VIR_ERR_INVALID_ARG, "%s",
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                            _("cannot change the type of listen address"));
             goto cleanup;
         }
@@ -2348,7 +2348,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
         switch ((virDomainGraphicsListenType) newlisten->type) {
         case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
             if (STRNEQ_NULLABLE(newlisten->address, oldlisten->address)) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                                dev->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC ?
                                _("cannot change listen address setting on vnc graphics") :
                                _("cannot change listen address setting on spice graphics"));
@@ -2358,7 +2358,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
 
         case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
             if (STRNEQ_NULLABLE(newlisten->network, oldlisten->network)) {
-                virReportError(VIR_ERR_INVALID_ARG, "%s",
+                virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                                dev->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC ?
                            _("cannot change listen network setting on vnc graphics") :
                            _("cannot change listen network setting on spice graphics"));
@@ -2378,12 +2378,12 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
         if ((olddev->data.vnc.autoport != dev->data.vnc.autoport) ||
             (!dev->data.vnc.autoport &&
              (olddev->data.vnc.port != dev->data.vnc.port))) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                            _("cannot change port settings on vnc graphics"));
             goto cleanup;
         }
         if (STRNEQ_NULLABLE(olddev->data.vnc.keymap, dev->data.vnc.keymap)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                            _("cannot change keymap setting on vnc graphics"));
             goto cleanup;
         }
@@ -2424,13 +2424,13 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
              (olddev->data.spice.port != dev->data.spice.port)) ||
             (!dev->data.spice.autoport &&
              (olddev->data.spice.tlsPort != dev->data.spice.tlsPort))) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                            _("cannot change port settings on spice graphics"));
             goto cleanup;
         }
         if (STRNEQ_NULLABLE(olddev->data.spice.keymap,
                             dev->data.spice.keymap)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                             _("cannot change keymap setting on spice graphics"));
             goto cleanup;
         }
-- 
1.7.12.4


--
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]