[PATCH 3/3] storage: Add virsh support for fs pool formating

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

 



New changes: Add doc
---
 tools/virsh.c   |   13 ++++++++++++-
 tools/virsh.pod |   12 +++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index e186c75..c9fbbf8 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -5723,6 +5723,8 @@ static const vshCmdInfo info_pool_build[] = {
 
 static const vshCmdOptDef opts_pool_build[] = {
     {"pool", VSH_OT_DATA, VSH_OFLAG_REQ, N_("pool name or uuid")},
+    {"no-overwrite", VSH_OT_BOOL, 0, N_("do not overwrite an existing pool of this type")},
+    {"overwrite", VSH_OT_BOOL, 0, N_("overwrite any existing data")},
     {NULL, 0, 0, NULL}
 };
 
@@ -5731,6 +5733,7 @@ cmdPoolBuild(vshControl *ctl, const vshCmd *cmd)
 {
     virStoragePoolPtr pool;
     int ret = TRUE;
+    unsigned int flags = 0;
     const char *name;
 
     if (!vshConnectionUsability(ctl, ctl->conn))
@@ -5739,7 +5742,15 @@ cmdPoolBuild(vshControl *ctl, const vshCmd *cmd)
     if (!(pool = vshCommandOptPool(ctl, cmd, "pool", &name)))
         return FALSE;
 
-    if (virStoragePoolBuild(pool, 0) == 0) {
+    if (vshCommandOptBool (cmd, "no-overwrite")) {
+        flags |= VIR_STORAGE_POOL_BUILD_NO_OVERWRITE;
+    }
+
+    if (vshCommandOptBool (cmd, "overwrite")) {
+        flags |= VIR_STORAGE_POOL_BUILD_OVERWRITE;
+    }
+
+    if (virStoragePoolBuild(pool, flags) == 0) {
         vshPrint(ctl, _("Pool %s built\n"), name);
     } else {
         vshError(ctl, _("Failed to build pool %s"), name);
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 580e1dc..7975d30 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -940,10 +940,20 @@ query is performed.
 
 Configure whether I<pool> should automatically start at boot.
 
-=item B<pool-build> I<pool-or-uuid>
+=item B<pool-build> I<pool-or-uuid> optional I<--overwrite>
+I<--no-overwite>
 
 Build a given pool.
 
+Options I<--overwrite> and I<--no-overwrite> can only be used for
+B<pool-build> a filesystem pool. If neither of them is specified,
+B<pool-build> on a filesystem pool only makes the directory; If
+I<--no-overwrite> is specified, it probes to determine if a
+filesystem already exists on the target device, returning an error
+if exists, or using mkfs to format the target device if not; If
+I<--overwrite> is specified, mkfs is always executed, any existed
+data on the target device is overwritten unconditionally.
+
 =item B<pool-create> I<file>
 
 Create and start a pool object from the XML I<file>.
-- 
1.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]