[libvirt] [PATCH v3] qemu: don't check for backing chains for formats w/o snapshot support

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1019926 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=868673 Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- Notes: v3: - rebased on current master and this time it doesn't break startupPolicy for RAW disks v2: - smaller and cleaner variant of v1 [1] after discussion with Eric [1] https://www.redhat.com/archives/libvir-list/2014-April/msg00716.html src/qemu/qemu_domain.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index bb9cb6b..ab19738 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2268,8 +2268,18 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver, VIR_DEBUG("Checking for disk presence"); for (i = vm->def->ndisks; i > 0; i--) { disk = vm->def->disks[i - 1]; + const char *path = virDomainDiskGetSource(disk); + enum virStorageFileFormat format = virDomainDiskGetFormat(disk); - if (!virDomainDiskGetSource(disk)) + if (!path) + continue; + + /* There is no need to check the backing chain for disks + * without backing support, the fact that the file exists is + * more than enough */ + if (format >= VIR_STORAGE_FILE_NONE && + format < VIR_STORAGE_FILE_BACKING && + virFileExists(path)) continue; if (qemuDomainDetermineDiskChain(driver, vm, disk, false) >= 0 && -- 1.9.2

On 04/24/2014 07:41 AM, Martin Kletzander wrote:
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1019926 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=868673
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> ---
+++ b/src/qemu/qemu_domain.c @@ -2268,8 +2268,18 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver, VIR_DEBUG("Checking for disk presence"); for (i = vm->def->ndisks; i > 0; i--) { disk = vm->def->disks[i - 1]; + const char *path = virDomainDiskGetSource(disk); + enum virStorageFileFormat format = virDomainDiskGetFormat(disk);
- if (!virDomainDiskGetSource(disk)) + if (!path) + continue; + + /* There is no need to check the backing chain for disks + * without backing support, the fact that the file exists is + * more than enough */ + if (format >= VIR_STORAGE_FILE_NONE && + format < VIR_STORAGE_FILE_BACKING && + virFileExists(path))
Peter may have to further tweak this with his work on gluster patches (we should not be calling virFileExists() if virStorageIsFile(path) returns fals); but for now this is a strict improvement. ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Thu, Apr 24, 2014 at 08:36:30AM -0600, Eric Blake wrote:
On 04/24/2014 07:41 AM, Martin Kletzander wrote:
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1019926 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=868673
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> ---
+++ b/src/qemu/qemu_domain.c @@ -2268,8 +2268,18 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver, VIR_DEBUG("Checking for disk presence"); for (i = vm->def->ndisks; i > 0; i--) { disk = vm->def->disks[i - 1]; + const char *path = virDomainDiskGetSource(disk); + enum virStorageFileFormat format = virDomainDiskGetFormat(disk);
- if (!virDomainDiskGetSource(disk)) + if (!path) + continue; + + /* There is no need to check the backing chain for disks + * without backing support, the fact that the file exists is + * more than enough */ + if (format >= VIR_STORAGE_FILE_NONE && + format < VIR_STORAGE_FILE_BACKING && + virFileExists(path))
Peter may have to further tweak this with his work on gluster patches (we should not be calling virFileExists() if virStorageIsFile(path) returns fals); but for now this is a strict improvement.
ACK.
Oh, good point, the check could be extended to whether the storage type is network and so on, as we have already somewhere, but as you said, this will be changed many times probably, so I'll leave it on Peter and buy him a beer Sometimes(TM). Thanks, pushed now. Martin
participants (2)
-
Eric Blake
-
Martin Kletzander