> On 17 Nov 2021, at 11:10, Juergen Gross <jgr...@suse.com> wrote:
>
> On 17.11.21 10:57, Luca Fancellu wrote:
>> With the introduction of boot time cpupools, Xen can
>> create at boot time many cpupools different from the
>> cpupool with id 0.
>> Since these newly created cpupools can't have an
>> entry in Xenstore, name them with the same convention
>> used for the cpupool 0: Pool-<cpupool id>.
>> Signed-off-by: Luca Fancellu <luca.fance...@arm.com>
>> ---
>> tools/libs/light/libxl_utils.c | 13 ++++++++-----
>> 1 file changed, 8 insertions(+), 5 deletions(-)
>> diff --git a/tools/libs/light/libxl_utils.c b/tools/libs/light/libxl_utils.c
>> index 4699c4a0a3..d97d91ca98 100644
>> --- a/tools/libs/light/libxl_utils.c
>> +++ b/tools/libs/light/libxl_utils.c
>> @@ -147,13 +147,16 @@ int libxl_cpupool_qualifier_to_cpupoolid(libxl_ctx
>> *ctx, const char *p,
>> char *libxl_cpupoolid_to_name(libxl_ctx *ctx, uint32_t poolid)
>> {
>> unsigned int len;
>> - char path[strlen("/local/pool") + 12];
>> + char buffer[strlen("/local/pool") + 12];
>> char *s;
>> - snprintf(path, sizeof(path), "/local/pool/%d/name", poolid);
>> - s = xs_read(ctx->xsh, XBT_NULL, path, &len);
>> - if (!s && (poolid == 0))
>> - return strdup("Pool-0");
>> + snprintf(buffer, sizeof(buffer), "/local/pool/%d/name", poolid);
>> + s = xs_read(ctx->xsh, XBT_NULL, buffer, &len);
>> + if (!s)
>> + {
>> + snprintf(buffer, sizeof(buffer), "Pool-%d", poolid);
>> + return strdup(buffer);
>> + }
>> return s;
>> }
>>
>
> This breaks libxl_cpupoolid_is_valid(), as it will now return always
> true, regardless whether the poolid is existing or not.
Hi Juergen,
Yes right, do you think I can use safely xc_cpupool_getinfo(…) when there is no
entry
in xenstore?
I would check that the returned cpupool id is the same and if it isn’t or if I
get a null
result, then I will return NULL to ensure libxl_cpupoolid_is_valid(…) works
again.
Cheers,
Luca
>
>
> Juergen
> <OpenPGP_0xB0DE9DD628BF132F.asc>