Use virDomainObjGetDefs in lxcDomainGetSchedulerParametersFlags

On LXC domain startup we have already called virDomainObjSetDefTransient
to fill vm->newDef.

There is no need to call virDomainLiveConfigHelperMethod which has the
ability to fill newDef if it's NULL.
This commit is contained in:
Ján Tomko 2016-05-26 14:29:33 +02:00
parent 1ca45c8fb5
commit c643910486

View File

@ -2086,9 +2086,8 @@ lxcDomainGetSchedulerParametersFlags(virDomainPtr dom,
int *nparams, int *nparams,
unsigned int flags) unsigned int flags)
{ {
virLXCDriverPtr driver = dom->conn->privateData;
virCapsPtr caps = NULL;
virDomainObjPtr vm = NULL; virDomainObjPtr vm = NULL;
virDomainDefPtr def;
virDomainDefPtr persistentDef; virDomainDefPtr persistentDef;
unsigned long long shares = 0; unsigned long long shares = 0;
unsigned long long period = 0; unsigned long long period = 0;
@ -2117,14 +2116,10 @@ lxcDomainGetSchedulerParametersFlags(virDomainPtr dom,
if (*nparams > 1) if (*nparams > 1)
cpu_bw_status = virCgroupSupportsCpuBW(priv->cgroup); cpu_bw_status = virCgroupSupportsCpuBW(priv->cgroup);
if (!(caps = virLXCDriverGetCapabilities(driver, false))) if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0)
goto cleanup; goto cleanup;
if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, if (persistentDef) {
vm, &flags, &persistentDef) < 0)
goto cleanup;
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
shares = persistentDef->cputune.shares; shares = persistentDef->cputune.shares;
if (*nparams > 1) { if (*nparams > 1) {
period = persistentDef->cputune.period; period = persistentDef->cputune.period;
@ -2178,7 +2173,6 @@ lxcDomainGetSchedulerParametersFlags(virDomainPtr dom,
cleanup: cleanup:
virDomainObjEndAPI(&vm); virDomainObjEndAPI(&vm);
virObjectUnref(caps);
return ret; return ret;
} }