]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: storagefile: Don't traverse storage sources unusable by VM
authorPeter Krempa <pkrempa@redhat.com>
Fri, 16 Aug 2019 09:34:27 +0000 (11:34 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 26 Aug 2019 11:49:17 +0000 (13:49 +0200)
virStorageFileGetMetadataRecurse would include files in the backing
chain which would not really be usable by libvirt directly e.g.
when such file would be promoted to the top layer by an active block
commit as for example inline authentication data can't be represented in
the VM xml file. The idea is to use secrets for this.

With the changes to the backing store string parsers we can report and
propagate if such a thing is present in the configuration and thus start
skipping those files in the backing chain traversal code. This approach
still allows to report the appropriate backing store string in the
storage driver which doesn't directly use the backing file.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virstoragefile.c

index 66cde582fc62a03c60dd6ce32ef8981a52cdd9a7..2a5ae8b1fd256637908d8dafce8bdb76cb323241 100644 (file)
@@ -4935,9 +4935,15 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
         goto cleanup;
 
     if (src->backingStoreRaw) {
-        if (virStorageSourceNewFromBacking(src, &backingStore) < 0)
+        if ((rv = virStorageSourceNewFromBacking(src, &backingStore)) < 0)
             goto cleanup;
 
+        if (rv == 1) {
+            /* the backing file would not be usable for VM usage */
+            ret = 0;
+            goto cleanup;
+        }
+
         if (backingFormat == VIR_STORAGE_FILE_AUTO)
             backingStore->format = VIR_STORAGE_FILE_RAW;
         else if (backingFormat == VIR_STORAGE_FILE_AUTO_SAFE)