[PATCH 05/11] storage: For FS pool check for properly formatted target volume

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

 



Prior to starting up, let's be sure the target volume device is
formatted as we expect; otherwise, inhibit the start.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/storage/storage_backend_fs.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index db5b340..936e472 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -605,8 +605,17 @@ static int
 virStorageBackendFileSystemStart(virConnectPtr conn ATTRIBUTE_UNUSED,
                                  virStoragePoolObjPtr pool)
 {
-    if (pool->def->type != VIR_STORAGE_POOL_DIR &&
-        virStorageBackendFileSystemMount(pool) < 0)
+    const char *format =
+        virStoragePoolFormatFileSystemTypeToString(pool->def->source.format);
+    const char *path = pool->def->source.devices[0].path;
+
+    if (pool->def->type == VIR_STORAGE_POOL_DIR)
+        return 0;
+
+    if (!virStorageBackendDeviceProbeEmpty(path, format, false))
+        return -1;
+
+    if (virStorageBackendFileSystemMount(pool) < 0)
         return -1;
 
     return 0;
-- 
2.7.4

--
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]
  Powered by Linux