diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 3d6baf5378..4ab1736075 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1617,6 +1617,14 @@ static char *lxcDomainGetSchedulerType(virDomainPtr dom, } priv = vm->privateData; + /* Domain not running, thus no cgroups - return defaults */ + if (!virDomainObjIsActive(vm)) { + if (nparams) + *nparams = 3; + ignore_value(VIR_STRDUP(ret, "posix")); + goto cleanup; + } + if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU)) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cgroup CPU controller is not mounted")); @@ -1895,9 +1903,10 @@ lxcDomainGetSchedulerParametersFlags(virDomainPtr dom, if (flags & VIR_DOMAIN_AFFECT_CONFIG) { shares = persistentDef->cputune.shares; - if (*nparams > 1 && cpu_bw_status) { + if (*nparams > 1) { period = persistentDef->cputune.period; quota = persistentDef->cputune.quota; + cpu_bw_status = true; /* Allow copy of data to params[] */ } goto out; }