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

[libvirt] [PATCH 3/3] Add virsh option for format flags



---
 tools/virsh.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index bd6b6be..de8c67d 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -4015,6 +4015,7 @@ static const vshCmdInfo info_pool_build[] = {

 static const vshCmdOptDef opts_pool_build[] = {
     {"pool", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("pool name or uuid")},
+    {"format", VSH_OT_BOOL, 0, gettext_noop("format the pool (destructive)")},
     {NULL, 0, 0, NULL}
 };

@@ -4023,6 +4024,7 @@ cmdPoolBuild(vshControl *ctl, const vshCmd *cmd)
 {
     virStoragePoolPtr pool;
     int ret = TRUE;
+    int flags = 0;
     char *name;

     if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
@@ -4031,7 +4033,10 @@ cmdPoolBuild(vshControl *ctl, const vshCmd *cmd)
     if (!(pool = vshCommandOptPool(ctl, cmd, "pool", &name)))
         return FALSE;

-    if (virStoragePoolBuild(pool, 0) == 0) {
+    if (vshCommandOptBool (cmd, "format"))
+        flags |= VIR_STORAGE_POOL_CREATE_FORMAT;
+
+    if (virStoragePoolBuild(pool, flags) == 0) {
         vshPrint(ctl, _("Pool %s built\n"), name);
     } else {
         vshError(ctl, _("Failed to build pool %s"), name);
-- 
1.6.5.5


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