xl: skip zero-size config data in list_domains_details
PATCH 1/1 xl: skip zero-size config data in list_domains_details
libxl_userdata_retrieve returns 0 when there's no stored config file for a domain, so we cannot rely on that to continue processing.
--- tools/libxl/xl_cmdimpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/xl_cmdimpl.c +1 -1
@@ -3062,7 +3062,7 @@ static void list_domains_details(const libxl_dominfo *info, int nb_domain)if (info[i].domid ==0 )continue ; rc =libxl_userdata_retrieve (ctx, info[i].domid,"xl" , &data, &len); -if (rc) +if (rc || len ==0 )continue ;CHK_ERRNO (asprintf (&config_source,"<domid %d data>" , info[i].domid));libxl_domain_config_init (&d_config);
Signature · 1 line
1.7.10.4
Wei Liu writes ("[PATCH] xl: skip zero-size config data in list_domains_details"):
Quoted 2 lines
libxl_userdata_retrievereturns 0 when there's no stored config file for a domain, so we cannot rely on that to continue processing.
How could a zero-sized config userdata ever arise ?
I haven't tried it but presumably, at the moment, continuing causes some kind of other errors later (complaints about missing config entries perhaps) ?
Ian.
Quoted 5 lines · Ian Jackson
Wei Liu writes ("[PATCH] xl: skip zero-size config data in
list_domains_details"):Quoted 2 lines
libxl_userdata_retrievereturns 0 when there's no stored config file for a domain, so we cannot rely on that to continue processing.How could a zero-sized config userdata ever arise ?
Dom0 or perhaps a domain started by a different toolstack (even one using libxl)? It'd be nice if xl list would display what it could for these.
Ian.
Quoted 6 lines · Ian Jackson
Wei Liu writes ("[PATCH] xl: skip zero-size config data in
list_domains_details"):Quoted 2 lines
libxl_userdata_retrievereturns 0 when there's no stored config file for a domain, so we cannot rely on that to continue processing.How could a zero-sized config userdata ever arise ?
When Xen cannot clean up a domain after its death, it remains visible in Xen in -p-sd state. Xl list -l will still try to retrieve the config file, which has been deleted at that time.
Quoted 4 lines
I haven't tried it but presumably, at the moment, continuing causes some kind of other errors later (complaints about missing config entries perhaps) ?
Yes, this leads to 'Domain name must be specified' because the config data is NULL, aborting 'xl list -l'.
Wei.
Quoted 1 line
Ian.
Quoted 12 lines · Wei Liu
Quoted 6 lines · Ian Jackson
Wei Liu writes ("[PATCH] xl: skip zero-size config data in
list_domains_details"):Quoted 2 lines
libxl_userdata_retrievereturns 0 when there's no stored config file for a domain, so we cannot rely on that to continue processing.How could a zero-sized config userdata ever arise ?
When Xen cannot clean up a domain after its death, it remains visible in Xen in -p-sd state. Xl list -l will still try to retrieve the config file, which has been deleted at that time.
Quoted 8 lines
Quoted 4 lines
I haven't tried it but presumably, at the moment, continuing causes some kind of other errors later (complaints about missing config entries perhaps) ?
Yes, this leads to 'Domain name must be specified' because the config data is NULL, aborting 'xl list -l'.
Just to make clear, 'Domain name must be specified' doesn't cause the abortion of 'xl list -l', it's the call to generate json output that aborts 'xl list -l'.
Wei.
Quoted 3 lines
Wei.
Quoted 1 line
Ian.
Ian Jackson
Acked-byWei Liu writes ("Re: [PATCH] xl: skip zero-size config data in list_domains_details"):
Quoted 3 lines
When Xen cannot clean up a domain after its death, it remains visible in Xen in -p-sd state. Xl list -l will still try to retrieve the config file, which has been deleted at that time.
...
Quoted 2 lines
Yes, this leads to 'Domain name must be specified' because the config data is NULL, aborting 'xl list -l'.
Aha. Right. I have just looked at the context (primarily, 8cde53d0) and you're entirely right with this change.
Ian.
Quoted 4 lines · Ian Jackson
Wei Liu writes ("Re: [PATCH] xl: skip zero-size config data in
list_domains_details"):Quoted 3 lines
When Xen cannot clean up a domain after its death, it remains visible in Xen in -p-sd state. Xl list -l will still try to retrieve the config file, which has been deleted at that time.
Quoted 8 lines
...
Quoted 2 lines
Yes, this leads to 'Domain name must be specified' because the config data is NULL, aborting 'xl list -l'.
Aha. Right. I have just looked at the context (primarily,
8cde53d0) and you're entirely right with this change.Acked-by Ian Jackson <[email protected]>
I think I saw a conversation this morning where you decided you had been mistaken somewhere, I think here (IIRC the suggestions was that xl list and xl list -l should contain the same set of domains).
For the avoidance of confusion perhaps you should apply this and/or whatever other patch was under discussion...
Ian.