[libvirt] [PATCH 7/8] cputune: support cputune for xend driver
Daniel Veillard
veillard at redhat.com
Tue Mar 29 09:02:43 UTC 2011
On Tue, Mar 29, 2011 at 02:32:25PM +0800, Osier Yang wrote:
> Not sure if it's the correct way to add cputune xml for xend driver,
> and besides, seems "xm driver" and "xen hypervisor" also support
> vcpu affinity, do we need to add support for them too?
> ---
> src/xen/xend_internal.c | 30 ++++++++++++++++++++++++++----
> 1 files changed, 26 insertions(+), 4 deletions(-)
>
> diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
> index bfaed65..8859373 100644
> --- a/src/xen/xend_internal.c
> +++ b/src/xen/xend_internal.c
> @@ -2233,11 +2233,12 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
> */
> int
> xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
> - unsigned char *cpumap, int maplen)
> + unsigned char *cpumap, int maplen)
> {
> char buf[VIR_UUID_BUFLEN], mapstr[sizeof(cpumap_t) * 64];
> - int i, j;
> + int i, j, ret;
> xenUnifiedPrivatePtr priv;
> + virDomainDefPtr def = NULL;
>
> if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
> || (cpumap == NULL) || (maplen < 1) || (maplen > (int)sizeof(cpumap_t))) {
> @@ -2265,8 +2266,29 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
> mapstr[strlen(mapstr) - 1] = 0;
>
> snprintf(buf, sizeof(buf), "%d", vcpu);
> - return(xend_op(domain->conn, domain->name, "op", "pincpu", "vcpu", buf,
> - "cpumap", mapstr, NULL));
> +
> + ret = xend_op(domain->conn, domain->name, "op", "pincpu", "vcpu", buf,
> + "cpumap", mapstr, NULL);
> +
> + if (!(def = xenDaemonDomainFetch(domain->conn,
> + domain->id,
> + domain->name,
> + NULL)))
> + goto cleanup;
> +
> + if (ret == 0) {
> + if (virDomainVcpupinAdd(def, cpumap, maplen, vcpu) < 0) {
> + virXendError(VIR_ERR_INTERNAL_ERROR,
> + "%s", _("failed to add vcpupin xml entry"));
> + return (-1);
> + }
> + }
> +
> + return ret;
> +
> +cleanup:
> + virDomainDefFree(def);
> + return -1;
> }
ACK,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list