[libvirt] [PATCH 10/10] util: storage: remove 'allow_probe' from virStorageFileGetMetadata

Peter Krempa pkrempa at redhat.com
Mon Jun 4 08:58:52 UTC 2018


All callers pass 'false' now so it's no longer needed.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_domain.c        |  4 +---
 src/security/virt-aa-helper.c |  2 +-
 src/util/virstoragefile.c     | 18 +++++++-----------
 src/util/virstoragefile.h     |  1 -
 tests/virstoragetest.c        |  2 +-
 5 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d230ead359..d4771ff3f7 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8061,9 +8061,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,

     qemuDomainGetImageIds(cfg, vm, src, disk->src, &uid, &gid);

-    if (virStorageFileGetMetadata(src,
-                                  uid, gid, false,
-                                  report_broken) < 0)
+    if (virStorageFileGetMetadata(src, uid, gid, report_broken) < 0)
         goto cleanup;

     for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 37fe36a329..971ee6733c 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -974,7 +974,7 @@ get_files(vahControl * ctl)
          *        so that the open could be re-tried as that user:group.
          */
         if (!virStorageSourceHasBacking(disk->src))
-            virStorageFileGetMetadata(disk->src, -1, -1, false, false);
+            virStorageFileGetMetadata(disk->src, -1, -1, false);

         /* XXX passing ignoreOpenFailure = true to get back to the behavior
          * from before using virDomainDiskDefForeachPath. actually we should
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 62768af968..6ede542df6 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -4678,7 +4678,6 @@ static int
 virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
                                  virStorageSourcePtr parent,
                                  uid_t uid, gid_t gid,
-                                 bool allow_probe,
                                  bool report_broken,
                                  virHashTablePtr cycle,
                                  unsigned int depth)
@@ -4691,9 +4690,9 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
     int backingFormat;
     int rv;

-    VIR_DEBUG("path=%s format=%d uid=%u gid=%u probe=%d",
+    VIR_DEBUG("path=%s format=%d uid=%u gid=%u",
               src->path, src->format,
-              (unsigned int)uid, (unsigned int)gid, allow_probe);
+              (unsigned int)uid, (unsigned int)gid);

     /* exit if we can't load information about the current image */
     rv = virStorageFileSupportsBackingChainTraversal(src);
@@ -4740,7 +4739,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
         if (!(backingStore = virStorageSourceNewFromBacking(src)))
             goto cleanup;

-        if (backingFormat == VIR_STORAGE_FILE_AUTO && !allow_probe)
+        if (backingFormat == VIR_STORAGE_FILE_AUTO)
             backingStore->format = VIR_STORAGE_FILE_RAW;
         else if (backingFormat == VIR_STORAGE_FILE_AUTO_SAFE)
             backingStore->format = VIR_STORAGE_FILE_AUTO;
@@ -4749,7 +4748,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,

         if ((ret = virStorageFileGetMetadataRecurse(backingStore, parent,
                                                     uid, gid,
-                                                    allow_probe, report_broken,
+                                                    report_broken,
                                                     cycle, depth + 1)) < 0) {
             if (report_broken)
                 goto cleanup;
@@ -4802,12 +4801,11 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
 int
 virStorageFileGetMetadata(virStorageSourcePtr src,
                           uid_t uid, gid_t gid,
-                          bool allow_probe,
                           bool report_broken)
 {
-    VIR_DEBUG("path=%s format=%d uid=%u gid=%u probe=%d, report_broken=%d",
+    VIR_DEBUG("path=%s format=%d uid=%u gid=%u report_broken=%d",
               src->path, src->format, (unsigned int)uid, (unsigned int)gid,
-              allow_probe, report_broken);
+              report_broken);

     virHashTablePtr cycle = NULL;
     virStorageType actualType = virStorageSourceGetActualType(src);
@@ -4819,14 +4817,12 @@ virStorageFileGetMetadata(virStorageSourcePtr src,
     if (src->format <= VIR_STORAGE_FILE_NONE) {
         if (actualType == VIR_STORAGE_TYPE_DIR)
             src->format = VIR_STORAGE_FILE_DIR;
-        else if (allow_probe)
-            src->format = VIR_STORAGE_FILE_AUTO;
         else
             src->format = VIR_STORAGE_FILE_RAW;
     }

     ret = virStorageFileGetMetadataRecurse(src, src, uid, gid,
-                                           allow_probe, report_broken, cycle, 1);
+                                           report_broken, cycle, 1);

     virHashFree(cycle);
     return ret;
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 33fc853fcd..592e19bd7f 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -504,7 +504,6 @@ int virStorageFileSupportsAccess(const virStorageSource *src);

 int virStorageFileGetMetadata(virStorageSourcePtr src,
                               uid_t uid, gid_t gid,
-                              bool allow_probe,
                               bool report_broken)
     ATTRIBUTE_NONNULL(1);

diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 2236351309..ad92f3b875 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -117,7 +117,7 @@ testStorageFileGetMetadata(const char *path,
     if (VIR_STRDUP(ret->path, path) < 0)
         goto error;

-    if (virStorageFileGetMetadata(ret, uid, gid, false, false) < 0)
+    if (virStorageFileGetMetadata(ret, uid, gid, false) < 0)
         goto error;

     return ret;
-- 
2.16.2




More information about the libvir-list mailing list