Re: [PATCH] conf: fix starting a domain with cpuset=""

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Sat, Sep 15, 2018 at 04:29:24PM +0800, Yi Wang wrote:
> > Domain fails to start when its config xml including:
> >   <vcpu cpuset="" current="8">64</vcpu>
> >
> >   # virsh create vm.xml
> >   error: Failed to create domain from vm.xml
> >   error: invalid argument: Failed to parse bitmap ''
> >
> > This patch fixes this.
> >
> > Signed-off-by: Yi Wang <wang.yi59@xxxxxxxxxx>
> > Reviewed-by: Xi Xu <xu.xi8@xxxxxxxxxx>
> > ---
> >  src/conf/domain_conf.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> > index 8619962..bacafb2 100644
> > --- a/src/conf/domain_conf.c
> > +++ b/src/conf/domain_conf.c
> > @@ -18553,7 +18553,7 @@ virDomainVcpuParse(virDomainDefPtr def,
> >
> >          if (def->placement_mode != VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
> >              tmp = virXMLPropString(vcpuNode, "cpuset");
> > -            if (tmp) {
> > +            if (tmp && strlen(tmp) != 0) {
>
> .... '&& *tmp' would suffice.

Ok.

>
> The patch is correct, but I believe there is a number of spots in the massive
> domain_conf.c file where a similar fix would be needed, it might be worth
> checking all the spots where no conversion like string-to-int string-to-enum or
> any other additional parsing like address parsing is performed, those might be
> good candidates.
>
> I understand the file is massive, so let me know how that goes.

In most similar places we have already checked by the return values of function
like string-to-int string-to-enum, and if failed, libvirt will give explicit report.

To create a domain with iothread="" of disk, for instance:

  # virsh create vm.xml
  error: Failed to create domain from vm.xml
  error: XML error: Invalid iothread attribute in disk driver element:

But the cpuset="" config error report may make people confuesd, and in the older
version like 3.1.0 that's ok to start a domain with this config. So I think this patch
is enough.


---
Best wishes
Yi Wang
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux