Re: [PATCH 19/23] Replace use of qemuReportError with virReportError

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

 



On 07/18/12 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Update the QEMU driver to use virReportError instead of
the qemuReportError custom macro

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
  cfg.mk                       |    1 -
  src/qemu/qemu_agent.c        |  142 ++--
  src/qemu/qemu_capabilities.c |   16 +-
  src/qemu/qemu_cgroup.c       |   26 +-
  src/qemu/qemu_command.c      | 1066 ++++++++++++------------
  src/qemu/qemu_conf.c         |   26 +-
  src/qemu/qemu_conf.h         |    4 -
  src/qemu/qemu_domain.c       |   94 +--
  src/qemu/qemu_driver.c       | 1834 +++++++++++++++++++++---------------------
  src/qemu/qemu_hostdev.c      |   59 +-
  src/qemu/qemu_hotplug.c      |  362 ++++-----
  src/qemu/qemu_migration.c    |  284 +++----
  src/qemu/qemu_monitor.c      |  384 ++++-----
  src/qemu/qemu_monitor_json.c |  546 ++++++-------
  src/qemu/qemu_monitor_text.c |  532 ++++++------
  src/qemu/qemu_process.c      |  216 ++---
  16 files changed, 2795 insertions(+), 2797 deletions(-)


ACK, mechanic, but *HUGE*. While reviewing I found some places that would require polishing but are pre-existing. I'm attatching the patch for that.

Peter

>From 071801e62511cc9db451f18a87d1f0ab772687d3 Mon Sep 17 00:00:00 2001
Message-Id: <071801e62511cc9db451f18a87d1f0ab772687d3.1342695008.git.pkrempa@xxxxxxxxxx>
From: Peter Krempa <pkrempa@xxxxxxxxxx>
Date: Thu, 19 Jul 2012 12:48:12 +0200
Subject: [PATCH] qemu: Add missing "%s" before translation macros and break
 long lines.

This patch cleans up some missing "%s" before translation macros, breaks
long lines and some other style cleanups found while reviewing DanPB's
massive cleanup for virReportError.
---
 src/qemu/qemu_agent.c        |   27 +++++----
 src/qemu/qemu_cgroup.c       |   11 ++--
 src/qemu/qemu_command.c      |  138 +++++++++++++++++++++++++++---------------
 src/qemu/qemu_domain.c       |   10 ++-
 src/qemu/qemu_driver.c       |   27 ++++----
 src/qemu/qemu_hostdev.c      |    4 +-
 src/qemu/qemu_hotplug.c      |   26 ++++----
 src/qemu/qemu_migration.c    |    4 +-
 src/qemu/qemu_monitor.c      |   10 ++--
 src/qemu/qemu_monitor_text.c |   12 +---
 src/qemu/qemu_process.c      |    2 +-
 11 files changed, 156 insertions(+), 115 deletions(-)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 12b9499..4289e91 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -198,20 +198,20 @@ qemuAgentOpenUnix(const char *monitor, pid_t cpid, bool *inProgress)
     *inProgress = false;

     if ((monfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
-        virReportSystemError(errno,
-                             "%s", _("failed to create socket"));
+        virReportSystemError(errno, "%s",
+                             _("failed to create socket"));
         return -1;
     }

     if (virSetNonBlock(monfd) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("Unable to put monitor into non-blocking mode"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("Unable to put monitor into non-blocking mode"));
         goto error;
     }

     if (virSetCloseExec(monfd) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("Unable to set monitor close-on-exec flag"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("Unable to set monitor close-on-exec flag"));
         goto error;
     }

@@ -649,7 +649,7 @@ qemuAgentIO(int watch, int fd, int events, void *opaque) {

         if (!error &&
             events & VIR_EVENT_HANDLE_HANGUP) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("End of file from monitor"));
             eof = 1;
             events &= ~VIR_EVENT_HANDLE_HANGUP;
@@ -657,8 +657,9 @@ qemuAgentIO(int watch, int fd, int events, void *opaque) {

         if (!error && !eof &&
             events & VIR_EVENT_HANDLE_ERROR) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Invalid file descriptor while waiting for monitor"));
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                           _("Invalid file descriptor while waiting "
+                             "for monitor"));
             eof = 1;
             events &= ~VIR_EVENT_HANDLE_ERROR;
         }
@@ -677,7 +678,7 @@ qemuAgentIO(int watch, int fd, int events, void *opaque) {
         } else {
             virErrorPtr err = virGetLastError();
             if (!err)
-                virReportError(VIR_ERR_INTERNAL_ERROR,
+                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                _("Error while processing monitor IO"));
             virCopyLastError(&mon->lastError);
             virResetLastError();
@@ -1179,7 +1180,8 @@ qemuAgentMakeCommand(const char *cmdname,

         if (strlen(key) < 3) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("argument key '%s' is too short, missing type prefix"),
+                           _("argument key '%s' is too short, "
+                             "missing type prefix"),
                            key);
             goto error;
         }
@@ -1233,7 +1235,8 @@ qemuAgentMakeCommand(const char *cmdname,
         }   break;
         default:
             virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("unsupported data type '%c' for arg '%s'"), type, key - 2);
+                           _("unsupported data type '%c' for arg '%s'"),
+                           type, key - 2);
             goto error;
         }
         if (ret < 0)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index cedbc95..8dff86e 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -333,8 +333,9 @@ int qemuSetupCgroup(struct qemud_driver *driver,
                 }
             }
         } else {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("Block I/O tuning is not available on this host"));
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("Block I/O tuning is not available "
+                             "on this host"));
             goto cleanup;
         }
     }
@@ -372,7 +373,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
                 }
             }
         } else {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("Memory cgroup is not available on this host"));
         }
     }
@@ -387,7 +388,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
                 goto cleanup;
             }
         } else {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("CPU tuning is not available on this host"));
         }
     }
@@ -405,7 +406,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
             mask = virDomainCpuSetFormat(vm->def->numatune.memory.nodemask,
                                          VIR_DOMAIN_CPUMASK_LEN);
         if (!mask) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("failed to convert memory nodemask"));
             goto cleanup;
         }
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 93a9be4..6b6704f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -554,9 +554,11 @@ qemuAssignDeviceNetAlias(virDomainDefPtr def, virDomainNetDefPtr net, int idx)
                 /* type='hostdev' interfaces have a hostdev%d alias */
                continue;
             }
-            if ((thisidx = qemuDomainDeviceAliasIndex(&def->nets[i]->info, "net")) < 0) {
+            if ((thisidx = qemuDomainDeviceAliasIndex(&def->nets[i]->info,
+                                                      "net")) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to determine device index for network device"));
+                               _("Unable to determine device index for "
+                                 "network device"));
                 return -1;
             }
             if (thisidx >= idx)
@@ -574,16 +576,20 @@ qemuAssignDeviceNetAlias(virDomainDefPtr def, virDomainNetDefPtr net, int idx)


 int
-qemuAssignDeviceHostdevAlias(virDomainDefPtr def, virDomainHostdevDefPtr hostdev, int idx)
+qemuAssignDeviceHostdevAlias(virDomainDefPtr def,
+                             virDomainHostdevDefPtr hostdev,
+                             int idx)
 {
     if (idx == -1) {
         int i;
         idx = 0;
         for (i = 0 ; i < def->nhostdevs ; i++) {
             int thisidx;
-            if ((thisidx = qemuDomainDeviceAliasIndex(def->hostdevs[i]->info, "hostdev")) < 0) {
+            if ((thisidx = qemuDomainDeviceAliasIndex(def->hostdevs[i]->info,
+                                                      "hostdev")) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to determine device index for hostdev device"));
+                               _("Unable to determine device index for "
+                                 "hostdev device"));
                 return -1;
             }
             if (thisidx >= idx)
@@ -601,16 +607,20 @@ qemuAssignDeviceHostdevAlias(virDomainDefPtr def, virDomainHostdevDefPtr hostdev


 int
-qemuAssignDeviceRedirdevAlias(virDomainDefPtr def, virDomainRedirdevDefPtr redirdev, int idx)
+qemuAssignDeviceRedirdevAlias(virDomainDefPtr def,
+                              virDomainRedirdevDefPtr redirdev,
+                              int idx)
 {
     if (idx == -1) {
         int i;
         idx = 0;
         for (i = 0 ; i < def->nredirdevs ; i++) {
             int thisidx;
-            if ((thisidx = qemuDomainDeviceAliasIndex(&def->redirdevs[i]->info, "redir")) < 0) {
+            if ((thisidx = qemuDomainDeviceAliasIndex(&def->redirdevs[i]->info,
+                                                      "redir")) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("Unable to determine device index for redirected device"));
+                               _("Unable to determine device index for "
+                                 "redirected device"));
                 return -1;
             }
             if (thisidx >= idx)
@@ -955,11 +965,13 @@ static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
         if (info->addr.pci.function != 0) {
             virReportError(VIR_ERR_XML_ERROR,
                            _("Attempted double use of PCI Address '%s' "
-                             "(may need \"multifunction='on'\" for device on function 0)"),
+                             "(may need \"multifunction='on'\" "
+                             "for device on function 0)"),
                            addr);
         } else {
             virReportError(VIR_ERR_XML_ERROR,
-                           _("Attempted double use of PCI Address '%s'"), addr);
+                           _("Attempted double use of PCI Address '%s'"),
+                           addr);
         }
         goto cleanup;
     }
@@ -972,11 +984,11 @@ static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
     if ((info->addr.pci.function == 0) &&
         (info->addr.pci.multi != VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_ON)) {
         /* a function 0 w/o multifunction=on must reserve the entire slot */
-        int function;
+        int func;
         virDomainDeviceInfo temp_info = *info;

-        for (function = 1; function < QEMU_PCI_ADDRESS_LAST_FUNCTION; function++) {
-            temp_info.addr.pci.function = function;
+        for (func = 1; func < QEMU_PCI_ADDRESS_LAST_FUNCTION; func++) {
+            temp_info.addr.pci.function = func;
             addr = qemuPCIAddressAsString(&temp_info);
             if (!addr)
                 goto cleanup;
@@ -984,12 +996,15 @@ static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
             if (virHashLookup(addrs->used, addr)) {
                 virReportError(VIR_ERR_XML_ERROR,
                                _("Attempted double use of PCI Address '%s'"
-                                 "(need \"multifunction='off'\" for device on function 0)"),
+                                 "(need \"multifunction='off'\" for device "
+                                 "on function 0)"),
                                addr);
                 goto cleanup;
             }

-            VIR_DEBUG("Remembering PCI addr %s (multifunction=off for function 0)", addr);
+            VIR_DEBUG("Remembering PCI addr %s "
+                      "(multifunction=off for function 0)",
+                      addr);
             if (virHashAddEntry(addrs->used, addr, addr))
                 goto cleanup;
             addr = NULL;
@@ -1616,7 +1631,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
             continue;

         if (def->disks[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("virtio only support device address type 'PCI'"));
             goto error;
         }
@@ -1699,12 +1714,14 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
     if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
         if (info->addr.pci.domain != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Only PCI device addresses with domain=0 are supported"));
+                           _("Only PCI device addresses with domain=0 "
+                             "are supported"));
             return -1;
         }
         if (info->addr.pci.bus != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Only PCI device addresses with bus=0 are supported"));
+                           _("Only PCI device addresses with bus=0 "
+                             "are supported"));
             return -1;
         }
         if (qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_MULTIFUNCTION)) {
@@ -1765,13 +1782,15 @@ qemuBuildRomStr(virBufferPtr buf,
 {
     if (info->rombar || info->romfile) {
         if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           "%s", _("rombar and romfile are supported only for PCI devices"));
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("rombar and romfile are supported only for "
+                             "PCI devices"));
             return -1;
         }
         if (!qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_ROMBAR)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           "%s", _("rombar and romfile not supported in this QEMU binary"));
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("rombar and romfile not supported "
+                             "in this QEMU binary"));
             return -1;
         }

@@ -2122,7 +2141,8 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
             }
             if (!disk->readonly) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("cannot create virtual FAT disks in read-write mode"));
+                               _("cannot create virtual FAT disks in "
+                                 "read-write mode"));
                 goto error;
             }
             if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
@@ -3690,7 +3710,8 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev,
         break;
     default:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("Cannot use virtio serial for parallel/serial devices"));
+                       _("Cannot use virtio serial for parallel/serial "
+                         "devices"));
         return NULL;
     }

@@ -3701,7 +3722,8 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev,
             VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL)
         {
             virReportError(VIR_ERR_INTERNAL_ERROR,
-                           "%s", _("virtio serial device has invalid address type"));
+                           "%s", _("virtio serial device has invalid "
+                                   "address type"));
             goto error;
         }

@@ -3990,7 +4012,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
                                _("guest and host CPU are not compatible: %s"),
                                compare_msg);
             } else {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("guest CPU is not compatible with host CPU"));
             }
             /* fall through */
@@ -4381,8 +4403,9 @@ qemuBuildCommandLine(virConnectPtr conn,
             goto error;
         }
         if (!driver->hugepage_path) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           "%s", _("hugepages are disabled by administrator config"));
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                           _("hugepages are disabled by administrator "
+                             "config"));
             goto error;
         }
         if (!qemuCapsGet(qemuCaps, QEMU_CAPS_MEM_PATH)) {
@@ -4432,7 +4455,8 @@ qemuBuildCommandLine(virConnectPtr conn,

         if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SMBIOS_TYPE)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("the QEMU binary %s does not support smbios settings"),
+                           _("the QEMU binary %s does not support smbios "
+                             "settings"),
                            emulator);
             goto error;
         }
@@ -4788,14 +4812,16 @@ qemuBuildCommandLine(virConnectPtr conn,
             /* Only recent QEMU implements a SATA (AHCI) controller */
             if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) {
                 if (!qemuCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) {
-                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                                   "%s", _("SATA is not supported with this QEMU binary"));
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                   _("SATA is not supported with this QEMU "
+                                     "binary"));
                     goto error;
                 } else {
                     char *devstr;

                     virCommandAddArg(cmd, "-device");
-                    if (!(devstr = qemuBuildControllerDevStr(def, cont, qemuCaps, NULL)))
+                    if (!(devstr = qemuBuildControllerDevStr(def, cont,
+                                                             qemuCaps, NULL)))
                         goto error;

                     virCommandAddArg(cmd, devstr);
@@ -4805,8 +4831,9 @@ qemuBuildCommandLine(virConnectPtr conn,
                 def->controllers[i]->model == -1 &&
                 !qemuCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
                 if (usblegacy) {
-                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                                   _("Multiple legacy USB controller not supported"));
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                   _("Multiple legacy USB controller "
+                                     "not supported"));
                     goto error;
                 }
                 usblegacy = true;
@@ -4814,7 +4841,9 @@ qemuBuildCommandLine(virConnectPtr conn,
                 virCommandAddArg(cmd, "-device");

                 char *devstr;
-                if (!(devstr = qemuBuildControllerDevStr(def, def->controllers[i], qemuCaps,
+                if (!(devstr = qemuBuildControllerDevStr(def,
+                                                         def->controllers[i],
+                                                         qemuCaps,
                                                          &usbcontroller)))
                     goto error;

@@ -5086,7 +5115,8 @@ qemuBuildCommandLine(virConnectPtr conn,
     } else {
         if (def->nfss) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("filesystem passthrough not supported by this QEMU"));
+                           _("filesystem passthrough not supported by "
+                             "this QEMU"));
             goto error;
         }
     }
@@ -5420,8 +5450,9 @@ qemuBuildCommandLine(virConnectPtr conn,
         case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD:
             if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) ||
                 !qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                               "%s", _("guestfwd requires QEMU to support -chardev & -device"));
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("guestfwd requires QEMU to support "
+                                 "-chardev & -device"));
                 goto error;
             }

@@ -5449,7 +5480,8 @@ qemuBuildCommandLine(virConnectPtr conn,
         case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
             if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("virtio channel requires QEMU to support -device"));
+                               _("virtio channel requires QEMU to support "
+                                 "-device"));
                 goto error;
             }

@@ -5488,7 +5520,8 @@ qemuBuildCommandLine(virConnectPtr conn,
         case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO:
             if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("virtio channel requires QEMU to support -device"));
+                               _("virtio channel requires QEMU to support "
+                                 "-device"));
                 goto error;
             }

@@ -5723,7 +5756,7 @@ qemuBuildCommandLine(virConnectPtr conn,

         if (def->graphics[0]->data.spice.tlsPort > 0) {
             if (!driver->spiceTLS) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("spice TLS port set in XML configuration,"
                                  " but TLS is disabled in qemu.conf"));
                 goto error;
@@ -5812,8 +5845,10 @@ qemuBuildCommandLine(virConnectPtr conn,
             switch (mode) {
             case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE:
                 if (!driver->spiceTLS) {
-                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                                   _("spice secure channels set in XML configuration, but TLS is disabled in qemu.conf"));
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                   _("spice secure channels set in XML "
+                                     "configuration, but TLS is disabled "
+                                     "in qemu.conf"));
                     goto error;
                 }
                 virBufferAsprintf(&opt, ",tls-channel=%s",
@@ -5947,8 +5982,8 @@ qemuBuildCommandLine(virConnectPtr conn,
                     VIR_FREE(str);
                 }
             } else {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                               "%s", _("only one video card is currently supported"));
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("only one video card is currently supported"));
                 goto error;
             }
         }
@@ -6180,7 +6215,8 @@ qemuBuildCommandLine(virConnectPtr conn,
                 VIR_FREE(devstr);
             } else {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("PCI device assignment is not supported by this version of qemu"));
+                               _("PCI device assignment is not supported by "
+                                 "this version of qemu"));
                 goto error;
             }
         }
@@ -7432,7 +7468,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,

                 if (dom->clock.timers[i]->present != -1 &&
                     dom->clock.timers[i]->present != present) {
-                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                    _("conflicting occurrences of kvmclock feature"));
                     goto error;
                 }
@@ -7836,7 +7872,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
                     port = strchr(host, ':');
                     if (!port) {
                         virReportError(VIR_ERR_INTERNAL_ERROR,
-                                       _("cannot parse nbd filename '%s'"), disk->src);
+                                       _("cannot parse nbd filename '%s'"),
+                                       disk->src);
                         goto error;
                     }
                     *port++ = '\0';
@@ -7865,7 +7902,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
                         vdi = strchr(port, ':');
                         if (!vdi) {
                             virReportError(VIR_ERR_INTERNAL_ERROR,
-                                           _("cannot parse sheepdog filename '%s'"), val);
+                                           _("cannot parse sheepdog filename '%s'"),
+                                           val);
                             goto error;
                         }
                         *vdi++ = '\0';
@@ -8217,7 +8255,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
         }

         if (!first_rbd_disk) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("CEPH_ARGS was set without an rbd disk"));
             goto error;
         }
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 42875b4..7a8b50e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -573,13 +573,15 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED,
             goto error;
         }
         if (!c_isalpha(tmp[0]) && tmp[0] != '_') {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           "%s", _("Invalid environment name, it must begin with a letter or underscore"));
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                           _("Invalid environment name, it must begin with "
+                             "a letter or underscore"));
             goto error;
         }
         if (strspn(tmp, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_") != strlen(tmp)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           "%s", _("Invalid environment name, it must contain only alphanumerics and underscore"));
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                           _("Invalid environment name, it must contain only "
+                             "alphanumerics and underscore"));
             goto error;
         }

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e65f694..28e2cc9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2149,7 +2149,8 @@ static int qemuDomainSendKey(virDomainPtr domain,
                                                keycodes[i]);
             if (keycode < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("cannot translate keycode %u of %s codeset to rfb keycode"),
+                               _("cannot translate keycode %u of %s codeset "
+                                 "to rfb keycode"),
                                keycodes[i],
                                virKeycodeSetTypeToString(codeset));
                 return -1;
@@ -3850,8 +3851,7 @@ qemudDomainGetVcpus(virDomainPtr dom,
     }

     if (!virDomainObjIsActive(vm)) {
-        virReportError(VIR_ERR_OPERATION_INVALID,
-                       "%s",
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("cannot list vcpu pinning for an inactive domain"));
         goto cleanup;
     }
@@ -5703,7 +5703,7 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
         orig = vmdef->disks[pos];
         if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM) &&
             !(orig->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)) {
-            virReportError(VIR_ERR_INVALID_ARG,
+            virReportError(VIR_ERR_INVALID_ARG, "%s",
                            _("this disk doesn't support update"));
             return -1;
         }
@@ -5804,8 +5804,7 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
             flags |= VIR_DOMAIN_AFFECT_CONFIG;
         /* check consistency between flags and the vm state */
         if (flags & VIR_DOMAIN_AFFECT_LIVE) {
-            virReportError(VIR_ERR_OPERATION_INVALID,
-                           "%s",
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                            _("cannot do live update a device on "
                              "inactive domain"));
             goto endjob;
@@ -6274,7 +6273,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,

     if (flags & VIR_DOMAIN_AFFECT_LIVE) {
         if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
-            virReportError(VIR_ERR_OPERATION_INVALID,
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                            _("blkio cgroup isn't mounted"));
             goto cleanup;
         }
@@ -6435,7 +6434,8 @@ qemuDomainGetBlkioParameters(virDomainPtr dom,

     if (flags & VIR_DOMAIN_AFFECT_LIVE) {
         if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
-            virReportError(VIR_ERR_OPERATION_INVALID, _("blkio cgroup isn't mounted"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("blkio cgroup isn't mounted"));
             goto cleanup;
         }

@@ -6730,7 +6730,8 @@ qemuDomainGetMemoryParameters(virDomainPtr dom,

         if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("cannot find cgroup for domain %s"), vm->def->name);
+                           _("cannot find cgroup for domain %s"),
+                           vm->def->name);
             goto cleanup;
         }
     }
@@ -11216,7 +11217,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
               || snap->def->state == VIR_DOMAIN_PAUSED) &&
             (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING |
                       VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED))) {
-            virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY,
+            virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, "%s",
                            _("must respawn qemu to start inactive snapshot"));
             goto cleanup;
         }
@@ -11862,7 +11863,7 @@ qemuDomainOpenConsole(virDomainPtr dom,
                          (flags & VIR_DOMAIN_CONSOLE_FORCE) != 0);

     if (ret == 1) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                        _("Active console session exists for this domain"));
         ret = -1;
     }
@@ -12797,7 +12798,7 @@ getSumVcpuPercpuStats(virCgroupPtr group,
         int j;

         if (virCgroupForVcpu(group, i, &group_vcpu, 0) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("error accessing cgroup cpuacct for vcpu"));
             goto cleanup;
         }
@@ -12808,7 +12809,7 @@ getSumVcpuPercpuStats(virCgroupPtr group,
         pos = buf;
         for (j = 0; j < num; j++) {
             if (virStrToLong_ull(pos, &pos, 10, &tmp) < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
+                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                _("cpuacct parse error"));
                 goto cleanup;
             }
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index fb07c3c..c55545d 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -310,7 +310,7 @@ qemuDomainHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,

     isvf = qemuDomainHostdevIsVirtualFunction(hostdev);
     if (isvf <= 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("Interface type hostdev is currently supported on"
                          " SR-IOV Virtual Functions only"));
         return ret;
@@ -348,7 +348,7 @@ qemuDomainHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev,

     isvf = qemuDomainHostdevIsVirtualFunction(hostdev);
     if (isvf <= 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("Interface type hostdev is currently supported on"
                          " SR-IOV Virtual Functions only"));
         return ret;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index a32e28e..d7e2a73 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -335,7 +335,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
         if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
             controller->model == -1 &&
             !qemuCapsGet(priv->qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("USB controller hotplug unsupported in this QEMU binary"));
             goto cleanup;
         }
@@ -820,7 +820,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
     /* set link state */
     if (net->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) {
         if (!net->info.alias) {
-            virReportError(VIR_ERR_OPERATION_FAILED,
+            virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                            _("device alias not found: cannot set link state to down"));
         } else {
             qemuDomainObjEnterMonitorWithDriver(driver, vm);
@@ -1291,7 +1291,7 @@ int qemuDomainChangeNetLinkState(struct qemud_driver *driver,
     VIR_DEBUG("dev: %s, state: %d", dev->info.alias, linkstate);

     if (!dev->info.alias) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                        _("can't change link state: device alias not found"));
         return -1;
     }
@@ -1321,13 +1321,13 @@ int qemuDomainChangeNet(struct qemud_driver *driver,
     int ret = 0;

     if (!olddev) {
-        virReportError(VIR_ERR_NO_SUPPORT,
+        virReportError(VIR_ERR_NO_SUPPORT, "%s",
                        _("cannot find existing network device to modify"));
         return -1;
     }

     if (olddev->type != dev->type) {
-        virReportError(VIR_ERR_NO_SUPPORT,
+        virReportError(VIR_ERR_NO_SUPPORT, "%s",
                        _("cannot change network interface type"));
         return -1;
     }
@@ -1340,7 +1340,7 @@ int qemuDomainChangeNet(struct qemud_driver *driver,
         if (STRNEQ_NULLABLE(olddev->data.ethernet.dev, dev->data.ethernet.dev) ||
             STRNEQ_NULLABLE(olddev->script, dev->script) ||
             STRNEQ_NULLABLE(olddev->data.ethernet.ipaddr, dev->data.ethernet.ipaddr)) {
-            virReportError(VIR_ERR_NO_SUPPORT,
+            virReportError(VIR_ERR_NO_SUPPORT, "%s",
                            _("cannot modify ethernet network device configuration"));
             return -1;
         }
@@ -1351,7 +1351,7 @@ int qemuDomainChangeNet(struct qemud_driver *driver,
     case VIR_DOMAIN_NET_TYPE_MCAST:
         if (STRNEQ_NULLABLE(olddev->data.socket.address, dev->data.socket.address) ||
             olddev->data.socket.port != dev->data.socket.port) {
-            virReportError(VIR_ERR_NO_SUPPORT,
+            virReportError(VIR_ERR_NO_SUPPORT, "%s",
                            _("cannot modify network socket device configuration"));
             return -1;
         }
@@ -1361,7 +1361,7 @@ int qemuDomainChangeNet(struct qemud_driver *driver,
         if (STRNEQ_NULLABLE(olddev->data.network.name, dev->data.network.name) ||
             STRNEQ_NULLABLE(olddev->data.network.portgroup, dev->data.network.portgroup) ||
             !virNetDevVPortProfileEqual(olddev->data.network.virtPortProfile, dev->data.network.virtPortProfile)) {
-            virReportError(VIR_ERR_NO_SUPPORT,
+            virReportError(VIR_ERR_NO_SUPPORT, "%s",
                            _("cannot modify network device configuration"));
             return -1;
         }
@@ -1372,7 +1372,7 @@ int qemuDomainChangeNet(struct qemud_driver *driver,
        /* allow changing brname, but not portprofile */
        if (!virNetDevVPortProfileEqual(olddev->data.bridge.virtPortProfile,
                                        dev->data.bridge.virtPortProfile)) {
-           virReportError(VIR_ERR_NO_SUPPORT,
+           virReportError(VIR_ERR_NO_SUPPORT, "%s",
                           _("cannot modify bridge network device configuration"));
            return -1;
        }
@@ -1380,7 +1380,7 @@ int qemuDomainChangeNet(struct qemud_driver *driver,

     case VIR_DOMAIN_NET_TYPE_INTERNAL:
         if (STRNEQ_NULLABLE(olddev->data.internal.name, dev->data.internal.name)) {
-            virReportError(VIR_ERR_NO_SUPPORT,
+            virReportError(VIR_ERR_NO_SUPPORT, "%s",
                            _("cannot modify internal network device configuration"));
             return -1;
         }
@@ -1390,7 +1390,7 @@ int qemuDomainChangeNet(struct qemud_driver *driver,
         if (STRNEQ_NULLABLE(olddev->data.direct.linkdev, dev->data.direct.linkdev) ||
             olddev->data.direct.mode != dev->data.direct.mode ||
             !virNetDevVPortProfileEqual(olddev->data.direct.virtPortProfile, dev->data.direct.virtPortProfile)) {
-            virReportError(VIR_ERR_NO_SUPPORT,
+            virReportError(VIR_ERR_NO_SUPPORT, "%s",
                            _("cannot modify direct network device configuration"));
             return -1;
         }
@@ -1407,7 +1407,7 @@ int qemuDomainChangeNet(struct qemud_driver *driver,
     /* all other unmodifiable parameters */
     if (STRNEQ_NULLABLE(olddev->model, dev->model) ||
         STRNEQ_NULLABLE(olddev->filter, dev->filter)) {
-        virReportError(VIR_ERR_NO_SUPPORT,
+        virReportError(VIR_ERR_NO_SUPPORT, "%s",
                        _("cannot modify network device configuration"));
         return -1;
     }
@@ -1415,7 +1415,7 @@ int qemuDomainChangeNet(struct qemud_driver *driver,
     /* check if device name has been set, if no, retain the autogenerated one */
     if (dev->ifname &&
         STRNEQ_NULLABLE(olddev->ifname, dev->ifname)) {
-        virReportError(VIR_ERR_NO_SUPPORT,
+        virReportError(VIR_ERR_NO_SUPPORT, "%s",
                        _("cannot modify network device configuration"));
         return -1;
     }
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index f8e2f90..12cf31d 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2240,7 +2240,7 @@ static int doPeer2PeerMigrate2(struct qemud_driver *driver,

     if (!(flags & VIR_MIGRATE_TUNNELLED) &&
         (uri_out == NULL)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("domainMigratePrepare2 did not set uri"));
         cancelled = 1;
         goto finish;
@@ -2378,7 +2378,7 @@ static int doPeer2PeerMigrate3(struct qemud_driver *driver,

     if (!(flags & VIR_MIGRATE_TUNNELLED) &&
         (uri_out == NULL)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("domainMigratePrepare3 did not set uri"));
         cancelled = 1;
         goto finish;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index ac78b29..7ed0909 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -612,7 +612,7 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {

         if (!error &&
             events & VIR_EVENT_HANDLE_HANGUP) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("End of file from monitor"));
             eof = 1;
             events &= ~VIR_EVENT_HANDLE_HANGUP;
@@ -620,7 +620,7 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {

         if (!error && !eof &&
             events & VIR_EVENT_HANDLE_ERROR) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("Invalid file descriptor while waiting for monitor"));
             eof = 1;
             events &= ~VIR_EVENT_HANDLE_ERROR;
@@ -640,7 +640,7 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {
         } else {
             virErrorPtr err = virGetLastError();
             if (!err)
-                virReportError(VIR_ERR_INTERNAL_ERROR,
+                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                _("Error while processing monitor IO"));
             virCopyLastError(&mon->lastError);
             virResetLastError();
@@ -813,7 +813,7 @@ void qemuMonitorClose(qemuMonitorPtr mon)
         if (mon->lastError.code == VIR_ERR_OK) {
             virErrorPtr err = virSaveLastError();

-            virReportError(VIR_ERR_OPERATION_FAILED,
+            virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                            _("Qemu monitor was closed"));
             virCopyLastError(&mon->lastError);
             if (err) {
@@ -1275,7 +1275,7 @@ int qemuMonitorSetLink(qemuMonitorPtr mon,
     VIR_DEBUG("mon=%p, name=%p:%s, state=%u", mon, name, name, state);

     if (!mon || !name) {
-        virReportError(VIR_ERR_INVALID_ARG,
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
                        _("monitor || name must not be NULL"));
         return -1;
     }
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index c7de172..6bc9801 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -481,8 +481,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,
-                       "%s",
+        virReportError(VIR_ERR_NO_SUPPORT, "%s",
                        _("\'set_link\' not supported by this qemu"));
         goto error;
     }
@@ -793,8 +792,7 @@ int qemuMonitorTextGetBlockInfo(qemuMonitorPtr mon,
     }

     if (strstr(reply, "\ninfo ")) {
-        virReportError(VIR_ERR_OPERATION_INVALID,
-                       "%s",
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("info block not supported by this qemu"));
         goto cleanup;
     }
@@ -917,8 +915,7 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
      * to detect if qemu supports the command.
      */
     if (strstr(info, "\ninfo ")) {
-        virReportError(VIR_ERR_OPERATION_INVALID,
-                       "%s",
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("'info blockstats' not supported by this qemu"));
         goto cleanup;
     }
@@ -1044,8 +1041,7 @@ int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon,
      * to detect if qemu supports the command.
      */
     if (strstr(info, "\ninfo ")) {
-        virReportError(VIR_ERR_OPERATION_INVALID,
-                       "%s",
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("'info blockstats' not supported by this qemu"));
         goto cleanup;
     }
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 3d450f2..5bdf733 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1920,7 +1920,7 @@ qemuProcessSetLinkStates(virDomainObjPtr vm)
             VIR_DEBUG("Setting link state: %s", def->nets[i]->info.alias);

             if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) {
-                virReportError(VIR_ERR_NO_SUPPORT,
+                virReportError(VIR_ERR_NO_SUPPORT, "%s",
                                _("Setting of link state is not supported by this qemu"));
                 return -1;
             }
-- 
1.7.8.6

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