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

Re: [libvirt] [PATCH 6/8] cputune: support cputune for lxc driver



On Tue, Mar 29, 2011 at 02:32:24PM +0800, Osier Yang wrote:
> LXC driver doesn't support vcpu affinity yet, so just need
> to modify it to support cpu shares.
> ---
>  src/lxc/lxc_controller.c |   10 ++++++++++
>  src/lxc/lxc_driver.c     |    2 ++
>  2 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
> index 1ab6351..7ea69fb 100644
> --- a/src/lxc/lxc_controller.c
> +++ b/src/lxc/lxc_controller.c
> @@ -117,6 +117,16 @@ static int lxcSetContainerResources(virDomainDefPtr def)
>          }
>      }
> 
> +    if (def->cputune.shares) {
> +        rc = virCgroupSetCpuShares(cgroup, def->cputune.shares);
> +        if (rc != 0) {
> +            virReportSystemError(-rc,
> +                                 _("Unable to set cpu shares for domain %s"),
> +                                 def->name);
> +            goto cleanup;
> +        }
> +    }
> +
>      rc = virCgroupSetMemory(cgroup, def->mem.max_balloon);
>      if (rc != 0) {
>          virReportSystemError(-rc,
> diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
> index 3159e1b..8433318 100644
> --- a/src/lxc/lxc_driver.c
> +++ b/src/lxc/lxc_driver.c
> @@ -2292,6 +2292,8 @@ static int lxcSetSchedulerParameters(virDomainPtr domain,
>                                   params[i].value.ul);
>              goto cleanup;
>          }
> +
> +        vm->def->cputune.shares = params[i].value.ul;
>      }
>      ret = 0;
> 

  ACK, assuming we get a clear semantic for cpushare

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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