[PATCH 4/6] qemu: Report better errors from broken backing chains

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

 



Request erroring out from the backing chain traveller and drop qemu's
internal backing chain integrity tester.

The backin chain traveller reports errors by itself with possibly more
detail than qemuDiskChainCheckBroken ever could.

We also need to make sure that we reconnect to existing qemu instances
even at the cost of losing the backing chain info (this really should be
stored in the XML rather than reloaded from disk, but that needs some
work).
---
 src/qemu/qemu_domain.c  | 26 ++------------------------
 src/qemu/qemu_process.c |  5 ++---
 2 files changed, 4 insertions(+), 27 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 88c5d1b..72638cf 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2440,27 +2440,6 @@ qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver,
     return -1;
 }

-static int
-qemuDiskChainCheckBroken(virDomainDiskDefPtr disk)
-{
-    char *brokenFile = NULL;
-
-    if (!virDomainDiskGetSource(disk))
-        return 0;
-
-    if (virStorageFileChainGetBroken(disk->src, &brokenFile) < 0)
-        return -1;
-
-    if (brokenFile) {
-        virReportError(VIR_ERR_INVALID_ARG,
-                       _("Backing file '%s' of image '%s' is missing."),
-                       brokenFile, virDomainDiskGetSource(disk));
-        VIR_FREE(brokenFile);
-        return -1;
-    }
-
-    return 0;
-}

 int
 qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
@@ -2490,8 +2469,7 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
             virFileExists(path))
             continue;

-        if (qemuDomainDetermineDiskChain(driver, vm, disk, false) >= 0 &&
-            qemuDiskChainCheckBroken(disk) >= 0)
+        if (qemuDomainDetermineDiskChain(driver, vm, disk, false) >= 0)
             continue;

         if (disk->startupPolicy &&
@@ -2660,7 +2638,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
     if (virStorageFileGetMetadata(disk->src,
                                   uid, gid,
                                   cfg->allowDiskFormatProbing,
-                                  false) < 0)
+                                  true) < 0)
         ret = -1;

  cleanup:
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 07335a0..a807f50 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3342,9 +3342,8 @@ qemuProcessReconnect(void *opaque)
             goto error;

         /* XXX we should be able to restore all data from XML in the future */
-        if (qemuDomainDetermineDiskChain(driver, obj,
-                                         obj->def->disks[i], true) < 0)
-            goto error;
+        ignore_value(qemuDomainDetermineDiskChain(driver, obj,
+                                                  obj->def->disks[i], true));

         dev.type = VIR_DOMAIN_DEVICE_DISK;
         dev.data.disk = obj->def->disks[i];
-- 
2.1.0

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