[libvirt] [PATCHv2 03/62] qemu: Improve errors in qemuDomainBlockResize

Peter Krempa pkrempa at redhat.com
Mon Aug 13 15:59:37 UTC 2018


Remove the pointless "empty path" check and use a better error message
if the disk was not found.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_driver.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d4a2379e48..4fc1e358fa 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10963,12 +10963,6 @@ qemuDomainBlockResize(virDomainPtr dom,

     virCheckFlags(VIR_DOMAIN_BLOCK_RESIZE_BYTES, -1);

-    if (path[0] == '\0') {
-        virReportError(VIR_ERR_INVALID_ARG,
-                       "%s", _("empty path"));
-        return -1;
-    }
-
     /* We prefer operating on bytes.  */
     if ((flags & VIR_DOMAIN_BLOCK_RESIZE_BYTES) == 0) {
         if (size > ULLONG_MAX / 1024) {
@@ -10996,7 +10990,7 @@ qemuDomainBlockResize(virDomainPtr dom,

     if (!(disk = virDomainDiskByName(vm->def, path, false))) {
         virReportError(VIR_ERR_INVALID_ARG,
-                       _("invalid path: %s"), path);
+                       _("disk '%s' was not found in the domain config"), path);
         goto endjob;
     }

-- 
2.16.2




More information about the libvir-list mailing list