]> xenbits.xensource.com Git - libvirt.git/commitdiff
Add new parameters for blkiotune
authorHu Tao <hutao@cn.fujitsu.com>
Tue, 7 Jun 2011 06:03:07 +0000 (14:03 +0800)
committerWen Congyang <wency@cn.fujitsu.com>
Mon, 20 Jun 2011 07:52:11 +0000 (15:52 +0800)
Add --config, --live and --current for command blkiotune

tools/virsh.c
tools/virsh.pod

index 2e1abbdc8244675aefb802a067cfa56b250b240d..b7b9552b4e257a211c9c490bd3e878ff8688765d 100644 (file)
@@ -3424,6 +3424,9 @@ static const vshCmdOptDef opts_blkiotune[] = {
     {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
     {"weight", VSH_OT_INT, VSH_OFLAG_NONE,
      N_("IO Weight in range [100, 1000]")},
+    {"config", VSH_OT_BOOL, 0, N_("affect next boot")},
+    {"live", VSH_OT_BOOL, 0, N_("affect running domain")},
+    {"current", VSH_OT_BOOL, 0, N_("affect current domain")},
     {NULL, 0, 0, NULL}
 };
 
@@ -3436,6 +3439,23 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
     unsigned int i = 0;
     virTypedParameterPtr params = NULL, temp = NULL;
     bool ret = false;
+    unsigned int flags = 0;
+    int current = vshCommandOptBool(cmd, "current");
+    int config = vshCommandOptBool(cmd, "config");
+    int live = vshCommandOptBool(cmd, "live");
+
+    if (current) {
+        if (live || config) {
+            vshError(ctl, "%s", _("--current must be specified exclusively"));
+            return false;
+        }
+        flags = VIR_DOMAIN_AFFECT_CURRENT;
+    } else {
+        if (config)
+            flags |= VIR_DOMAIN_AFFECT_CONFIG;
+        if (live)
+            flags |= VIR_DOMAIN_AFFECT_LIVE;
+    }
 
     if (!vshConnectionUsability(ctl, ctl->conn))
         return false;
@@ -3460,7 +3480,7 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
 
     if (nparams == 0) {
         /* get the number of blkio parameters */
-        if (virDomainGetBlkioParameters(dom, NULL, &nparams, 0) != 0) {
+        if (virDomainGetBlkioParameters(dom, NULL, &nparams, flags) != 0) {
             vshError(ctl, "%s",
                      _("Unable to get number of blkio parameters"));
             goto cleanup;
@@ -3474,7 +3494,7 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
 
         /* now go get all the blkio parameters */
         params = vshCalloc(ctl, nparams, sizeof(*params));
-        if (virDomainGetBlkioParameters(dom, params, &nparams, 0) != 0) {
+        if (virDomainGetBlkioParameters(dom, params, &nparams, flags) != 0) {
             vshError(ctl, "%s", _("Unable to get blkio parameters"));
             goto cleanup;
         }
@@ -3526,7 +3546,7 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
                 weight = 0;
             }
         }
-        if (virDomainSetBlkioParameters(dom, params, nparams, 0) != 0)
+        if (virDomainSetBlkioParameters(dom, params, nparams, flags) != 0)
             vshError(ctl, "%s", _("Unable to change blkio parameters"));
         else
             ret = true;
index 755f34a5f9b51c7c208b4b5741f89d57ac7e1ea7..fa374425d9c387c62f9d592eb1dec402cbcd3d3d 100644 (file)
@@ -734,6 +734,13 @@ value are kilobytes (i.e. blocks of 1024 bytes).
 Display or set the blkio parameters. QEMU/KVM supports I<--weight>.
 I<--weight> is in range [100, 1000].
 
+If I<--live> is specified, affect a running guest.
+If I<--config> is specified, affect the next boot of a persistent guest.
+If I<--current> is specified, affect the current guest state.
+Both I<--live> and I<--current> flags may be given, but I<--current> is
+exclusive. If no flag is specified, behavior is different depending
+on hypervisor.
+
 =item B<setvcpus> I<domain-id> I<count> optional I<--maximum> I<--config>
 I<--live>