[PATCH 2/4] virsh: Expose virStorageVolAbortJob

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

 



via new virsh command 'vol-jobabort'. Currently, it accepts
only volume specification as argument.
---
 tools/virsh.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 630b77f..00668ff 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -12497,6 +12497,44 @@ cmdVolPath(vshControl *ctl, const vshCmd *cmd)
     return true;
 }
 
+/*
+ * "vol-jobabort" command
+ */
+static const vshCmdInfo info_vol_jobabort[] = {
+    {"help", N_("abort active volume job")},
+    {"desc", N_("Aborts the currently running volume job")},
+    {NULL, NULL}
+};
+
+static const vshCmdOptDef opts_vol_jobabort[] = {
+    {"vol", VSH_OT_DATA, VSH_OFLAG_REQ, N_("volume name or key")},
+    {"pool", VSH_OT_STRING, 0, N_("pool name or uuid")},
+    {NULL, 0, 0, NULL}
+};
+
+static bool
+cmdVolJobAbort(vshControl *ctl, const vshCmd *cmd)
+{
+    virStorageVolPtr vol;
+    bool ret = false;
+
+    if (!vshConnectionUsability(ctl, ctl->conn))
+        return false;
+
+    if (!(vol = vshCommandOptVol(ctl, cmd, "vol", "pool", NULL))) {
+        return false;
+    }
+
+    if (virStorageVolAbortJob(vol, 0) < 0)
+        goto cleanup;
+
+    vshPrint(ctl, _("Job successfully aborted"));
+    ret = true;
+
+cleanup:
+    virStorageVolFree(vol);
+    return ret;
+}
 
 /*
  * "secret-define" command
@@ -17239,6 +17277,7 @@ static const vshCmdDef storageVolCmds[] = {
     {"vol-download", cmdVolDownload, opts_vol_download, info_vol_download, 0},
     {"vol-dumpxml", cmdVolDumpXML, opts_vol_dumpxml, info_vol_dumpxml, 0},
     {"vol-info", cmdVolInfo, opts_vol_info, info_vol_info, 0},
+    {"vol-jobabort", cmdVolJobAbort, opts_vol_jobabort, info_vol_jobabort, 0},
     {"vol-key", cmdVolKey, opts_vol_key, info_vol_key, 0},
     {"vol-list", cmdVolList, opts_vol_list, info_vol_list, 0},
     {"vol-name", cmdVolName, opts_vol_name, info_vol_name, 0},
-- 
1.7.8.5

--
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]