[libvirt] [PATCH 4/9] Use virDomainObjGetDefs in lxcDomainGetSchedulerParametersFlags

John Ferlan jferlan at redhat.com
Wed Jun 8 12:44:46 UTC 2016



On 06/06/2016 04:08 AM, Ján Tomko wrote:
> 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.
> ---
>  src/lxc/lxc_driver.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
> index 363b0b0..c39b4b4 100644
> --- a/src/lxc/lxc_driver.c
> +++ b/src/lxc/lxc_driver.c
> @@ -2084,10 +2084,8 @@ lxcDomainGetSchedulerParametersFlags(virDomainPtr dom,
>                                       int *nparams,
>                                       unsigned int flags)
>  {
> -    virLXCDriverPtr driver = dom->conn->privateData;
> -    virCapsPtr caps = NULL;
>      virDomainObjPtr vm = NULL;
> -    virDomainDefPtr persistentDef;
> +    virDomainDefPtr def, persistentDef;

NIT: Other code has these on separate lines and set to NULL

John
>      unsigned long long shares = 0;
>      unsigned long long period = 0;
>      long long quota = 0;
> @@ -2115,14 +2113,10 @@ lxcDomainGetSchedulerParametersFlags(virDomainPtr dom,
>      if (*nparams > 1)
>          cpu_bw_status = virCgroupSupportsCpuBW(priv->cgroup);
>  
> -    if (!(caps = virLXCDriverGetCapabilities(driver, false)))
> -        goto cleanup;
> -
> -    if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt,
> -                                        vm, &flags, &persistentDef) < 0)
> +    if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0)
>          goto cleanup;
>  
> -    if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
> +    if (persistentDef) {
>          shares = persistentDef->cputune.shares;
>          if (*nparams > 1) {
>              period = persistentDef->cputune.period;
> @@ -2176,7 +2170,6 @@ lxcDomainGetSchedulerParametersFlags(virDomainPtr dom,
>  
>   cleanup:
>      virDomainObjEndAPI(&vm);
> -    virObjectUnref(caps);
>      return ret;
>  }
>  
> 




More information about the libvir-list mailing list