[PATCH 8/8] schedinfo: Modify schedinfo command to accepts flags

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

 



---
 tools/virsh.c   |   26 +++++++++++++++++++++++---
 tools/virsh.pod |    8 +++++++-
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 2e35021..e6e80b5 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1598,6 +1598,8 @@ static const vshCmdOptDef opts_schedinfo[] = {
     {"set", VSH_OT_STRING, VSH_OFLAG_NONE, N_("parameter=value")},
     {"weight", VSH_OT_INT, VSH_OFLAG_NONE, N_("weight for XEN_CREDIT")},
     {"cap", VSH_OT_INT, VSH_OFLAG_NONE, N_("cap for XEN_CREDIT")},
+    {"live", VSH_OT_BOOL, 0, N_("affect running domain")},
+    {"persistent", VSH_OT_BOOL, 0, N_("affect both running domain and next boot")},
     {NULL, 0, 0, NULL}
 };
 
@@ -1705,6 +1707,18 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
     int update = 0;
     int i, ret;
     int ret_val = FALSE;
+    int live = vshCommandOptBool(cmd, "live");
+    int persistent = vshCommandOptBool(cmd, "persistent");
+    int flags = 0;
+
+    if (live)
+        flags |= VIR_DOMAIN_SCHED_PARAMS_LIVE;
+    if (persistent)
+        flags |= VIR_DOMAIN_SCHED_PARAMS_PERSISTENT;
+
+    /* neither option is specified */
+    if (!live && !persistent)
+        flags = -1;
 
     if (!vshConnectionUsability(ctl, ctl->conn))
         return FALSE;
@@ -1714,9 +1728,10 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
 
     /* Print SchedulerType */
     schedulertype = virDomainGetSchedulerType(dom, &nparams);
-    if (schedulertype!= NULL){
+
+    if (schedulertype != NULL){
         vshPrint(ctl, "%-15s: %s\n", _("Scheduler"),
-             schedulertype);
+                 schedulertype);
         VIR_FREE(schedulertype);
     } else {
         vshPrint(ctl, "%-15s: %s\n", _("Scheduler"), _("Unknown"));
@@ -1743,7 +1758,12 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
 
         /* Update parameters & refresh data */
         if (update) {
-            ret = virDomainSetSchedulerParameters(dom, params, nparams);
+            if (flags == -1)
+                ret = virDomainSetSchedulerParameters(dom, params, nparams);
+            else {
+                ret = virDomainSetSchedulerParametersFlags(dom, params, nparams, flags);
+            }
+
             if (ret == -1)
                 goto cleanup;
 
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 2a708f6..8c1005b 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -567,7 +567,8 @@ severed upon restore, as TCP timeouts may have expired.
 
 =item B<schedinfo> optional I<--set> B<parameter=value> I<domain-id>
 
-=item B<schedinfo> optional I<--weight> B<number> optional I<--cap> B<number> I<domain-id>
+=item B<schedinfo> optional I<--weight> B<number> optional I<--cap> B<number>
+I<domain-id> I<--live> I<--persistent>
 
 Allows you to show (and set) the domain scheduler parameters. The parameters available for each hypervisor are:
 
@@ -577,6 +578,11 @@ Xen (credit scheduler): weight, cap
 
 ESX (allocation scheduler): reservation, limit, shares
 
+Both I<--live> and I<--persistent> may be set, and both of them requires the domain
+is running, I<--live> affects the running domain and fails if the domain is not
+active. I<--persistent> affects both the active and persistent domain config, and
+fails if the domain is transient or not active. I<--live> is the default flag.
+
 B<Note>: The cpu_shares parameter has a valid value range of 0-262144; Negative
 values are wrapped to positive, and larger values are capped at the maximum.
 Therefore, -1 is a useful shorthand for 262144.
-- 
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]