All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch] support cpupool for xl create
@ 2010-05-07  8:14 Juergen Gross
  2010-05-07 21:57 ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 7+ messages in thread
From: Juergen Gross @ 2010-05-07  8:14 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 442 bytes --]

Hi,

attached patch supports cpupool specification for xl create.


Juergen

-- 
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: juergen.gross@ts.fujitsu.com
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html

[-- Attachment #2: xlcreate-pool.patch --]
[-- Type: text/x-patch, Size: 7697 bytes --]

Signed-off-by: juergen.gross@ts.fujitsu.com

diff -r ccae861f52f7 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Thu May 06 11:59:55 2010 +0100
+++ b/tools/libxl/libxl.c	Fri May 07 10:08:45 2010 +0200
@@ -111,6 +111,12 @@ int libxl_domain_make(struct libxl_ctx *
         return ERROR_FAIL;
     }
 
+    ret = xc_cpupool_movedomain(ctx->xch, info->poolid, *domid);
+    if (ret < 0) {
+        XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, ret, "domain move fail");
+        return ERROR_FAIL;
+    }
+
     dom_path = libxl_xs_get_dompath(ctx, *domid);
     if (!dom_path)
         return ERROR_FAIL;
@@ -163,6 +169,7 @@ retry_transaction:
 
     xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
     xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/name", vm_path), info->name, strlen(info->name));
+    xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
 
     libxl_xs_writev(ctx, t, dom_path, info->xsdata);
     libxl_xs_writev(ctx, t, libxl_sprintf(ctx, "%s/platform", dom_path), info->platformdata);
@@ -424,6 +431,26 @@ int libxl_domain_info(struct libxl_ctx *
 
     xcinfo2xlinfo(&xcinfo, info_r);
     return 0;
+}
+
+struct libxl_poolinfo * libxl_list_pool(struct libxl_ctx *ctx, int *nb_pool)
+{
+    struct libxl_poolinfo *ptr;
+    int i, ret;
+    xc_cpupoolinfo_t info[256];
+    int size = 256;
+
+    ptr = calloc(size, sizeof(struct libxl_poolinfo));
+    if (!ptr) return NULL;
+
+    ret = xc_cpupool_getinfo(ctx->xch, 0, 256, info);
+    if (ret<0) return NULL;
+
+    for (i = 0; i < ret; i++) {
+        ptr[i].poolid = info[i].cpupool_id;
+    }
+    *nb_pool = ret;
+    return ptr;
 }
 
 /* this API call only list VM running on this host. a VM can be an aggregate of multiple domains. */
diff -r ccae861f52f7 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Thu May 06 11:59:55 2010 +0100
+++ b/tools/libxl/libxl.h	Fri May 07 10:08:45 2010 +0200
@@ -34,6 +34,10 @@ struct libxl_dominfo {
     uint64_t cpu_time;
     uint32_t vcpu_max_id;
     uint32_t vcpu_online;
+};
+
+struct libxl_poolinfo {
+    uint32_t poolid;
 };
 
 struct libxl_vminfo {
@@ -85,6 +89,8 @@ typedef struct {
     uint8_t uuid[16];
     char **xsdata;
     char **platformdata;
+    uint32_t poolid;
+    char *poolname;
 } libxl_domain_create_info;
 
 typedef struct {
@@ -338,6 +344,7 @@ int libxl_domain_info(struct libxl_ctx*,
 int libxl_domain_info(struct libxl_ctx*, struct libxl_dominfo *info_r,
                       uint32_t domid);
 struct libxl_dominfo * libxl_list_domain(struct libxl_ctx*, int *nb_domain);
+struct libxl_poolinfo * libxl_list_pool(struct libxl_ctx*, int *nb_pool);
 struct libxl_vminfo * libxl_list_vm(struct libxl_ctx *ctx, int *nb_vm);
 
 typedef struct libxl_device_model_starting libxl_device_model_starting;
diff -r ccae861f52f7 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Thu May 06 11:59:55 2010 +0100
+++ b/tools/libxl/libxl_utils.c	Fri May 07 10:08:45 2010 +0200
@@ -72,6 +72,41 @@ int libxl_name_to_domid(struct libxl_ctx
             continue;
         if (strcmp(domname, name) == 0) {
             *domid = dominfo[i].domid;
+            return 0;
+        }
+    }
+    return -1;
+}
+
+char *libxl_poolid_to_name(struct libxl_ctx *ctx, uint32_t poolid)
+{
+    unsigned int len;
+    char path[strlen("/local/pool") + 12];
+    char *s;
+
+    snprintf(path, sizeof(path), "/local/pool/%d/name", poolid);
+    s = xs_read(ctx->xsh, XBT_NULL, path, &len);
+    libxl_ptr_add(ctx, s);
+    return s;
+}
+
+int libxl_name_to_poolid(struct libxl_ctx *ctx, const char *name,
+                        uint32_t *poolid)
+{
+    int i, nb_pools;
+    char *poolname;
+    struct libxl_poolinfo *poolinfo;
+
+    poolinfo = libxl_list_pool(ctx, &nb_pools);
+    if (!poolinfo)
+        return ERROR_NOMEM;
+
+    for (i = 0; i < nb_pools; i++) {
+        poolname = libxl_poolid_to_name(ctx, poolinfo[i].poolid);
+        if (!poolname)
+            continue;
+        if (strcmp(poolname, name) == 0) {
+            *poolid = poolinfo[i].poolid;
             return 0;
         }
     }
diff -r ccae861f52f7 tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h	Thu May 06 11:59:55 2010 +0100
+++ b/tools/libxl/libxl_utils.h	Fri May 07 10:08:45 2010 +0200
@@ -21,6 +21,8 @@ unsigned long libxl_get_required_shadow_
 unsigned long libxl_get_required_shadow_memory(unsigned long maxmem_kb, unsigned int smp_cpus);
 int libxl_name_to_domid(struct libxl_ctx *ctx, const char *name, uint32_t *domid);
 char *libxl_domid_to_name(struct libxl_ctx *ctx, uint32_t domid);
+int libxl_name_to_poolid(struct libxl_ctx *ctx, const char *name, uint32_t *poolid);
+char *libxl_poolid_to_name(struct libxl_ctx *ctx, uint32_t poolid);
 int libxl_get_stubdom_id(struct libxl_ctx *ctx, int guest_domid);
 int libxl_is_stubdom(struct libxl_ctx *ctx, uint32_t domid, uint32_t *target_domid);
 int libxl_create_logfile(struct libxl_ctx *ctx, char *name, char **full_name);
diff -r ccae861f52f7 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu May 06 11:59:55 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Fri May 07 10:08:45 2010 +0200
@@ -87,8 +87,7 @@ struct save_file_header {
 
 #define SAVEFILE_BYTEORDER_VALUE ((uint32_t)0x01020304UL)
 
-static int domain_qualifier_to_domid(const char *p, uint32_t *domid_r,
-                                     int *was_name_r)
+static int qualifier_to_id(const char *p, uint32_t *id_r)
 {
     int i, alldigit;
 
@@ -101,14 +100,32 @@ static int domain_qualifier_to_domid(con
     }
 
     if (i > 0 && alldigit) {
-        *domid_r = strtoul(p, NULL, 10);
-        if (was_name_r) *was_name_r = 0;
+        *id_r = strtoul(p, NULL, 10);
         return 0;
     } else {
         /* check here if it's a uuid and do proper conversion */
     }
-    if (was_name_r) *was_name_r = 1;
-    return libxl_name_to_domid(&ctx, p, domid_r);
+    return 1;
+}
+
+static int domain_qualifier_to_domid(const char *p, uint32_t *domid_r,
+                                     int *was_name_r)
+{
+    int was_name;
+
+    was_name = qualifier_to_id(p, domid_r);
+    if (was_name_r) *was_name_r = was_name;
+    return was_name ? libxl_name_to_domid(&ctx, p, domid_r) : 0;
+}
+
+static int pool_qualifier_to_poolid(const char *p, uint32_t *poolid_r,
+                                     int *was_name_r)
+{
+    int was_name;
+
+    was_name = qualifier_to_id(p, poolid_r);
+    if (was_name_r) *was_name_r = was_name;
+    return was_name ? libxl_name_to_poolid(&ctx, p, poolid_r) : 0;
 }
 
 static void find_domain(const char *p)
@@ -146,6 +163,7 @@ static void init_create_info(libxl_domai
     c_info->hvm = 1;
     c_info->oos = 1;
     c_info->ssidref = 0;
+    c_info->poolid = 0;
 }
 
 static void init_build_info(libxl_domain_build_info *b_info, libxl_domain_create_info *c_info)
@@ -277,6 +295,7 @@ static void printf_info(libxl_domain_cre
            (c_info->uuid)[4], (c_info->uuid)[5], (c_info->uuid)[6], (c_info->uuid)[7],
            (c_info->uuid)[8], (c_info->uuid)[9], (c_info->uuid)[10], (c_info->uuid)[11],
            (c_info->uuid)[12], (c_info->uuid)[13], (c_info->uuid)[14], (c_info->uuid)[15]);
+    printf("cpupool: %s (%d)\n", c_info->poolname, c_info->poolid);
     if (c_info->xsdata)
         printf("xsdata: contains data\n");
     else
@@ -433,6 +452,10 @@ static void parse_config_data(const char
 
     if (!xlu_cfg_get_long(config, "oos", &l))
         c_info->oos = l;
+
+    if (!xlu_cfg_get_string (config, "pool", &buf))
+        pool_qualifier_to_poolid(buf, &c_info->poolid, NULL);
+    c_info->poolname = libxl_poolid_to_name(&ctx, c_info->poolid);
 
     init_build_info(b_info, c_info);
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] support cpupool for xl create
  2010-05-07  8:14 [Patch] support cpupool for xl create Juergen Gross
@ 2010-05-07 21:57 ` Jeremy Fitzhardinge
  2010-05-10  6:05   ` Juergen Gross
  0 siblings, 1 reply; 7+ messages in thread
From: Jeremy Fitzhardinge @ 2010-05-07 21:57 UTC (permalink / raw)
  To: Juergen Gross; +Cc: xen-devel@lists.xensource.com

On 05/07/2010 01:14 AM, Juergen Gross wrote:
> Hi,
>
> attached patch supports cpupool specification for xl create.

This crashes for me:

(gdb) run create /etc/xen/f13pv64 
Starting program: /usr/sbin/xl create /etc/xen/f13pv64
[Thread debugging using libthread_db enabled]
Parsing config file /etc/xen/f13pv64

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff79cd805 in libxl_domain_make (ctx=0x60f8a0, info=0x7fffffffe0b0, 
    domid=0x60f890) at libxl.c:172
172	    xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
(gdb) p info->poolname
$2 = 0x0

Adding

diff -r bbf009817ffb tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri May 07 19:22:28 2010 +0100
+++ b/tools/libxl/libxl.c	Fri May 07 14:57:00 2010 -0700
@@ -169,7 +169,8 @@
 
     xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
     xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/name", vm_path), info->name, strlen(info->name));
-    xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
+    if (info->poolname)
+        xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
 
     libxl_xs_writev(ctx, t, dom_path, info->xsdata);
     libxl_xs_writev(ctx, t, libxl_sprintf(ctx, "%s/platform", dom_path), info->platformdata);

fixes it for me.

	J

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] support cpupool for xl create
  2010-05-07 21:57 ` Jeremy Fitzhardinge
@ 2010-05-10  6:05   ` Juergen Gross
  2010-05-10  6:42     ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 7+ messages in thread
From: Juergen Gross @ 2010-05-10  6:05 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 2095 bytes --]

On 05/07/2010 11:57 PM, Jeremy Fitzhardinge wrote:
> On 05/07/2010 01:14 AM, Juergen Gross wrote:
>> Hi,
>>
>> attached patch supports cpupool specification for xl create.
>
> This crashes for me:
>
> (gdb) run create /etc/xen/f13pv64
> Starting program: /usr/sbin/xl create /etc/xen/f13pv64
> [Thread debugging using libthread_db enabled]
> Parsing config file /etc/xen/f13pv64
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007ffff79cd805 in libxl_domain_make (ctx=0x60f8a0, info=0x7fffffffe0b0,
>      domid=0x60f890) at libxl.c:172
> 172	    xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
> (gdb) p info->poolname
> $2 = 0x0
>
> Adding
>
> diff -r bbf009817ffb tools/libxl/libxl.c
> --- a/tools/libxl/libxl.c	Fri May 07 19:22:28 2010 +0100
> +++ b/tools/libxl/libxl.c	Fri May 07 14:57:00 2010 -0700
> @@ -169,7 +169,8 @@
>
>       xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
>       xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/name", vm_path), info->name, strlen(info->name));
> -    xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
> +    if (info->poolname)
> +        xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
>
>       libxl_xs_writev(ctx, t, dom_path, info->xsdata);
>       libxl_xs_writev(ctx, t, libxl_sprintf(ctx, "%s/platform", dom_path), info->platformdata);
>
> fixes it for me.

You seem to have specified a not existing cpupool.
The solution should not be to ignore this, but to do a proper test on the
pool parameter.
Attached patch does this.


Juergen

-- 
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: juergen.gross@ts.fujitsu.com
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html

[-- Attachment #2: libxl-poolerr.patch --]
[-- Type: text/x-patch, Size: 779 bytes --]

Signed-off-by: juergen.gross@ts.fujitsu.com

diff -r bbf009817ffb tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri May 07 19:22:28 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Mon May 10 08:01:03 2010 +0200
@@ -453,9 +453,15 @@ static void parse_config_data(const char
     if (!xlu_cfg_get_long(config, "oos", &l))
         c_info->oos = l;
 
-    if (!xlu_cfg_get_string (config, "pool", &buf))
+    if (!xlu_cfg_get_string (config, "pool", &buf)) {
+        c_info->poolid = -1;
         pool_qualifier_to_poolid(buf, &c_info->poolid, NULL);
+    }
     c_info->poolname = libxl_poolid_to_name(&ctx, c_info->poolid);
+    if (!c_info->poolname) {
+        fprintf(stderr, "Illegal pool specified\n");
+        exit(1);
+    }
 
     init_build_info(b_info, c_info);
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] support cpupool for xl create
  2010-05-10  6:05   ` Juergen Gross
@ 2010-05-10  6:42     ` Jeremy Fitzhardinge
  2010-05-10  6:58       ` Juergen Gross
  0 siblings, 1 reply; 7+ messages in thread
From: Jeremy Fitzhardinge @ 2010-05-10  6:42 UTC (permalink / raw)
  To: Juergen Gross; +Cc: xen-devel@lists.xensource.com

On 05/09/2010 11:05 PM, Juergen Gross wrote:
>> diff -r bbf009817ffb tools/libxl/libxl.c
>> --- a/tools/libxl/libxl.c    Fri May 07 19:22:28 2010 +0100
>> +++ b/tools/libxl/libxl.c    Fri May 07 14:57:00 2010 -0700
>> @@ -169,7 +169,8 @@
>>
>>       xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/uuid", vm_path),
>> uuid_string, strlen(uuid_string));
>>       xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/name", vm_path),
>> info->name, strlen(info->name));
>> -    xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name",
>> vm_path), info->poolname, strlen(info->poolname));
>> +    if (info->poolname)
>> +        xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name",
>> vm_path), info->poolname, strlen(info->poolname));
>>
>>       libxl_xs_writev(ctx, t, dom_path, info->xsdata);
>>       libxl_xs_writev(ctx, t, libxl_sprintf(ctx, "%s/platform",
>> dom_path), info->platformdata);
>>
>> fixes it for me.
>
>
> You seem to have specified a not existing cpupool.
> The solution should not be to ignore this, but to do a proper test on the
> pool parameter.
> Attached patch does this.

I'm not using cpupools.  My config makes no mention of "pool" at all.

    J

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] support cpupool for xl create
  2010-05-10  6:42     ` Jeremy Fitzhardinge
@ 2010-05-10  6:58       ` Juergen Gross
  2010-05-10 20:07         ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 7+ messages in thread
From: Juergen Gross @ 2010-05-10  6:58 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: xen-devel@lists.xensource.com

On 05/10/2010 08:42 AM, Jeremy Fitzhardinge wrote:
> On 05/09/2010 11:05 PM, Juergen Gross wrote:
>>> diff -r bbf009817ffb tools/libxl/libxl.c
>>> --- a/tools/libxl/libxl.c    Fri May 07 19:22:28 2010 +0100
>>> +++ b/tools/libxl/libxl.c    Fri May 07 14:57:00 2010 -0700
>>> @@ -169,7 +169,8 @@
>>>
>>>        xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/uuid", vm_path),
>>> uuid_string, strlen(uuid_string));
>>>        xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/name", vm_path),
>>> info->name, strlen(info->name));
>>> -    xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name",
>>> vm_path), info->poolname, strlen(info->poolname));
>>> +    if (info->poolname)
>>> +        xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name",
>>> vm_path), info->poolname, strlen(info->poolname));
>>>
>>>        libxl_xs_writev(ctx, t, dom_path, info->xsdata);
>>>        libxl_xs_writev(ctx, t, libxl_sprintf(ctx, "%s/platform",
>>> dom_path), info->platformdata);
>>>
>>> fixes it for me.
>>
>>
>> You seem to have specified a not existing cpupool.
>> The solution should not be to ignore this, but to do a proper test on the
>> pool parameter.
>> Attached patch does this.
>
> I'm not using cpupools.  My config makes no mention of "pool" at all.

Strange.
I tested this case and it worked for me.
Are you sure you have all actual patches installed?
Could you try "xl create -d" and look for the cpupool settings?

Juergen

-- 
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: juergen.gross@ts.fujitsu.com
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] support cpupool for xl create
  2010-05-10  6:58       ` Juergen Gross
@ 2010-05-10 20:07         ` Jeremy Fitzhardinge
  2010-05-11  5:47           ` Juergen Gross
  0 siblings, 1 reply; 7+ messages in thread
From: Jeremy Fitzhardinge @ 2010-05-10 20:07 UTC (permalink / raw)
  To: Juergen Gross; +Cc: xen-devel@lists.xensource.com

On 05/09/2010 11:58 PM, Juergen Gross wrote:
> On 05/10/2010 08:42 AM, Jeremy Fitzhardinge wrote:
>> On 05/09/2010 11:05 PM, Juergen Gross wrote:
>>>> diff -r bbf009817ffb tools/libxl/libxl.c
>>>> --- a/tools/libxl/libxl.c    Fri May 07 19:22:28 2010 +0100
>>>> +++ b/tools/libxl/libxl.c    Fri May 07 14:57:00 2010 -0700
>>>> @@ -169,7 +169,8 @@
>>>>
>>>>        xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/uuid", vm_path),
>>>> uuid_string, strlen(uuid_string));
>>>>        xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/name", vm_path),
>>>> info->name, strlen(info->name));
>>>> -    xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name",
>>>> vm_path), info->poolname, strlen(info->poolname));
>>>> +    if (info->poolname)
>>>> +        xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name",
>>>> vm_path), info->poolname, strlen(info->poolname));
>>>>
>>>>        libxl_xs_writev(ctx, t, dom_path, info->xsdata);
>>>>        libxl_xs_writev(ctx, t, libxl_sprintf(ctx, "%s/platform",
>>>> dom_path), info->platformdata);
>>>>
>>>> fixes it for me.
>>>
>>>
>>> You seem to have specified a not existing cpupool.
>>> The solution should not be to ignore this, but to do a proper test
>>> on the
>>> pool parameter.
>>> Attached patch does this.
>>
>> I'm not using cpupools.  My config makes no mention of "pool" at all.
>
> Strange.
> I tested this case and it worked for me.

Perhaps one thing that you're not testing: I'm using oxenstored, and I'm
xl without ever having started xend, so xenstore starts out completely
empty.  I don't know if that makes a difference.

> Are you sure you have all actual patches installed?

Yes.  I'm seeing this with version bbf009817ffb.

> Could you try "xl create -d" and look for the cpupool settings?

sh-4.0# xl create -dc /etc/xen/f13pv64 
Parsing config file /etc/xen/f13pv64
*** domain_create_info ***
hvm: 0
hap: 0
oos: 1
ssidref: 0
name: f13pv64
uuid: 31878242-49a2-8dce-589c-0ec5a1f297a6
cpupool: (null) (0)
xsdata: (null)
platformdata: (null)



*** domain_build_info ***
timer_mode: -1
hpet: 1
vpt_align: -1
max_vcpus: 1
tsc_mode: 0
max_memkb: 524288
target_memkb: 524288
kernel: /usr/lib/xen/boot/pv-grub-x86_64.gz
hvm: 0
cmdline: (null)
ramdisk: (null)



*** disks_info: 0 ***
backend_domid 0
domid 0
physpath /dev/vg_lilith-raid/xen-f13-64
phystype 4
virtpath xvda
unpluggable 1
readwrite 1
is_cdrom 0



*** vfbs_info: 0 ***
backend_domid 0
domid 0
devid 0
vnc: 1
vnclisten: 0.0.0.0
vncdisplay: 0
vncunused: 1
keymap: (null)
sdl: 0
opengl: 0
display: (null)
xauthority: (null)
Segmentation fault

	J

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] support cpupool for xl create
  2010-05-10 20:07         ` Jeremy Fitzhardinge
@ 2010-05-11  5:47           ` Juergen Gross
  0 siblings, 0 replies; 7+ messages in thread
From: Juergen Gross @ 2010-05-11  5:47 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 2268 bytes --]

On 05/10/2010 10:07 PM, Jeremy Fitzhardinge wrote:
> On 05/09/2010 11:58 PM, Juergen Gross wrote:
>> On 05/10/2010 08:42 AM, Jeremy Fitzhardinge wrote:
>>> On 05/09/2010 11:05 PM, Juergen Gross wrote:
>>>>> diff -r bbf009817ffb tools/libxl/libxl.c
>>>>> --- a/tools/libxl/libxl.c    Fri May 07 19:22:28 2010 +0100
>>>>> +++ b/tools/libxl/libxl.c    Fri May 07 14:57:00 2010 -0700
>>>>> @@ -169,7 +169,8 @@
>>>>>
>>>>>         xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/uuid", vm_path),
>>>>> uuid_string, strlen(uuid_string));
>>>>>         xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/name", vm_path),
>>>>> info->name, strlen(info->name));
>>>>> -    xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name",
>>>>> vm_path), info->poolname, strlen(info->poolname));
>>>>> +    if (info->poolname)
>>>>> +        xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name",
>>>>> vm_path), info->poolname, strlen(info->poolname));
>>>>>
>>>>>         libxl_xs_writev(ctx, t, dom_path, info->xsdata);
>>>>>         libxl_xs_writev(ctx, t, libxl_sprintf(ctx, "%s/platform",
>>>>> dom_path), info->platformdata);
>>>>>
>>>>> fixes it for me.
>>>>
>>>>
>>>> You seem to have specified a not existing cpupool.
>>>> The solution should not be to ignore this, but to do a proper test
>>>> on the
>>>> pool parameter.
>>>> Attached patch does this.
>>>
>>> I'm not using cpupools.  My config makes no mention of "pool" at all.
>>
>> Strange.
>> I tested this case and it worked for me.
>
> Perhaps one thing that you're not testing: I'm using oxenstored, and I'm
> xl without ever having started xend, so xenstore starts out completely
> empty.  I don't know if that makes a difference.

It does :-)
Without proper xenstore entries it is impossible to get a cpupool name from
it's id. Id 0 is hard wired to "Pool-0", so this case can be handled even
without xenstore.
I modified the patch accordingly.


Juergen

-- 
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: juergen.gross@ts.fujitsu.com
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html

[-- Attachment #2: libxl-poolerr.patch --]
[-- Type: text/x-patch, Size: 2022 bytes --]

diff -r bbf009817ffb tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri May 07 19:22:28 2010 +0100
+++ b/tools/libxl/libxl.c	Tue May 11 07:45:01 2010 +0200
@@ -169,7 +169,8 @@ retry_transaction:
 
     xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/uuid", vm_path), uuid_string, strlen(uuid_string));
     xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/name", vm_path), info->name, strlen(info->name));
-    xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
+    if (info->poolname)
+        xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/pool_name", vm_path), info->poolname, strlen(info->poolname));
 
     libxl_xs_writev(ctx, t, dom_path, info->xsdata);
     libxl_xs_writev(ctx, t, libxl_sprintf(ctx, "%s/platform", dom_path), info->platformdata);
diff -r bbf009817ffb tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Fri May 07 19:22:28 2010 +0100
+++ b/tools/libxl/libxl_utils.c	Tue May 11 07:45:01 2010 +0200
@@ -84,6 +84,8 @@ char *libxl_poolid_to_name(struct libxl_
     char path[strlen("/local/pool") + 12];
     char *s;
 
+    if (poolid == 0)
+        return "Pool-0";
     snprintf(path, sizeof(path), "/local/pool/%d/name", poolid);
     s = xs_read(ctx->xsh, XBT_NULL, path, &len);
     libxl_ptr_add(ctx, s);
diff -r bbf009817ffb tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri May 07 19:22:28 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue May 11 07:45:01 2010 +0200
@@ -453,9 +453,15 @@ static void parse_config_data(const char
     if (!xlu_cfg_get_long(config, "oos", &l))
         c_info->oos = l;
 
-    if (!xlu_cfg_get_string (config, "pool", &buf))
+    if (!xlu_cfg_get_string (config, "pool", &buf)) {
+        c_info->poolid = -1;
         pool_qualifier_to_poolid(buf, &c_info->poolid, NULL);
+    }
     c_info->poolname = libxl_poolid_to_name(&ctx, c_info->poolid);
+    if (!c_info->poolname) {
+        fprintf(stderr, "Illegal pool specified\n");
+        exit(1);
+    }
 
     init_build_info(b_info, c_info);
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-05-11  5:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-07  8:14 [Patch] support cpupool for xl create Juergen Gross
2010-05-07 21:57 ` Jeremy Fitzhardinge
2010-05-10  6:05   ` Juergen Gross
2010-05-10  6:42     ` Jeremy Fitzhardinge
2010-05-10  6:58       ` Juergen Gross
2010-05-10 20:07         ` Jeremy Fitzhardinge
2010-05-11  5:47           ` Juergen Gross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.