[libvirt] [PATCH] Fix xend XML generation when CPU pinning is used

Daniel P. Berrange berrange at redhat.com
Thu Jan 29 11:35:19 UTC 2009


On Wed, Jan 28, 2009 at 08:28:26PM -0800, john.levon at sun.com wrote:
> # HG changeset patch
> # User john.levon at sun.com
> # Date 1233203295 28800
> # Node ID 9aac8028d5f266023c85338afe71ecabe26079f7
> # Parent  add5d46423d8cc24ac922373ba5cd1b3ea2e6f9f
> Fix xend XML generation when CPU pinning is used
> 
> Signed-off-by: John Levon <john.levon at sun.com>

Am I right in thinking that the problem addressed here, is that if
the SEXPR has CPU pinning data, we'd be parsing it into a NULL
'cpumask' field and thus  crashing ? If so, ACK to this. Be good
to add a test datafile for this too

> 
> diff --git a/src/xend_internal.c b/src/xend_internal.c
> --- a/src/xend_internal.c
> +++ b/src/xend_internal.c
> @@ -2227,11 +2227,21 @@ xenDaemonParseSxpr(virConnectPtr conn,
>          def->maxmem = def->memory;
>  
>      if (cpus != NULL) {
> +        def->cpumasklen = VIR_DOMAIN_CPUMASK_LEN;
> +        if (VIR_ALLOC_N(def->cpumask, def->cpumasklen) < 0) {
> +            virXendError(conn, VIR_ERR_NO_MEMORY, NULL);
> +            goto error;
> +        }
> +
>          if (virDomainCpuSetParse(conn, &cpus,
>                                   0, def->cpumask,
> -                                 def->cpumasklen) < 0)
> +                                 def->cpumasklen) < 0) {
> +            virXendError(conn, VIR_ERR_INTERNAL_ERROR,
> +                         _("invalid CPU mask %s"), cpus);
>              goto error;
> -    }
> +        }
> +    }
> +
>      def->vcpus = sexpr_int(root, "domain/vcpus");
>  
>      tmp = sexpr_node(root, "domain/on_poweroff");



Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list