]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Add support for virDomainMigrateGetMaxDowntime
authorScott Garfinkle <scottgar@linux.vnet.ibm.com>
Thu, 17 Aug 2017 22:17:21 +0000 (17:17 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Sat, 26 Aug 2017 11:55:17 +0000 (07:55 -0400)
Implement a migrate-getmaxdowntime command to complement migrate-setmaxdowntime.

tools/virsh-domain.c
tools/virsh.pod

index 40f16738661fd1faedb4f9eb8d45022ea75d7bc5..a3410e791c536aa8bc6a0efa1ef1a02394ab931b 100644 (file)
@@ -10719,6 +10719,47 @@ cmdMigrateSetMaxDowntime(vshControl *ctl, const vshCmd *cmd)
     return ret;
 }
 
+
+/*
+ * "migrate-getmaxdowntime" command
+ */
+static const vshCmdInfo info_migrate_getmaxdowntime[] = {
+    {.name = "help",
+     .data = N_("get maximum tolerable downtime")
+    },
+    {.name = "desc",
+     .data = N_("Get maximum tolerable downtime of a domain which is being live-migrated to another host.")
+    },
+    {.name = NULL}
+};
+
+static const vshCmdOptDef opts_migrate_getmaxdowntime[] = {
+    VIRSH_COMMON_OPT_DOMAIN_FULL,
+    {.name = NULL}
+};
+
+static bool
+cmdMigrateGetMaxDowntime(vshControl *ctl, const vshCmd *cmd)
+{
+    virDomainPtr dom = NULL;
+    unsigned long long downtime;
+    bool ret = false;
+
+    if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
+        return false;
+
+    if (virDomainMigrateGetMaxDowntime(dom, &downtime, 0) < 0)
+        goto done;
+
+    vshPrint(ctl, "%llu\n", downtime);
+    ret = true;
+
+ done:
+    virshDomainFree(dom);
+    return ret;
+}
+
+
 /*
  * "migrate-compcache" command
  */
@@ -13875,6 +13916,12 @@ const vshCmdDef domManagementCmds[] = {
      .info = info_migrate_setmaxdowntime,
      .flags = 0
     },
+    {.name = "migrate-getmaxdowntime",
+     .handler = cmdMigrateGetMaxDowntime,
+     .opts = opts_migrate_getmaxdowntime,
+     .info = info_migrate_getmaxdowntime,
+     .flags = 0
+    },
     {.name = "migrate-compcache",
      .handler = cmdMigrateCompCache,
      .opts = opts_migrate_compcache,
index 43d6f0cd367e9a30feb8bd385169e3a98d9157ea..15a414399db4e7bb984e737e23d7b7fdef011e91 100644 (file)
@@ -1857,6 +1857,12 @@ Set maximum tolerable downtime for a domain which is being live-migrated to
 another host.  The I<downtime> is a number of milliseconds the guest is allowed
 to be down at the end of live migration.
 
+=item B<migrate-getmaxdowntime> I<domain>
+
+Get the maximum tolerable downtime for a domain which is being live-migrated to
+another host.  This is the number of milliseconds the guest is allowed
+to be down at the end of live migration.
+
 =item B<migrate-compcache> I<domain> [I<--size> B<bytes>]
 
 Sets and/or gets size of the cache (in bytes) used for compressing repeatedly