This enables user to modify cpu.shares even when domain is inactive. --- tools/virsh.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index e32680c..d03e501 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1590,6 +1590,7 @@ 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")}, + {"persistent", VSH_OT_BOOL, 0, N_("persist VM on destination")}, {NULL, 0, 0, NULL} }; @@ -1697,6 +1698,7 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd) int update = 0; int i, ret; bool ret_val = false; + unsigned int flags = 0; if (!vshConnectionUsability(ctl, ctl->conn)) return false; @@ -1704,6 +1706,16 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd) if (!(dom = vshCommandOptDomain(ctl, cmd, NULL))) return false; + if (vshCommandOptBool(cmd, "persistent")) + flags |= VIR_DOMAIN_SCHEDPARAM_CONFIG; + if (virDomainIsActive(dom)) + flags |= VIR_DOMAIN_SCHEDPARAM_LIVE; + + if (!(flags & (VIR_DOMAIN_SCHEDPARAM_CONFIG | VIR_DOMAIN_SCHEDPARAM_LIVE))) { + vshError(ctl, "%s", _("Domain is not running and you didn't specify --persistent parameter.")); + goto cleanup; + } + /* Print SchedulerType */ schedulertype = virDomainGetSchedulerType(dom, &nparams); if (schedulertype!= NULL){ @@ -1735,7 +1747,7 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd) /* Update parameters & refresh data */ if (update) { - ret = virDomainSetSchedulerParameters(dom, params, nparams); + ret = virDomainSetSchedulerParametersFlags(dom, params, nparams, flags); if (ret == -1) goto cleanup; -- 1.7.3.1 -- Thanks, Hu Tao -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list