[libvirt] [PATCH] conf: fix virtType FromString check
Daniel P. Berrangé
berrange at redhat.com
Thu Jul 26 15:32:23 UTC 2018
On Thu, Jul 26, 2018 at 11:30:07AM -0400, Cole Robinson wrote:
> In the domain definition, virtType is virDomainVirtType which is
> unsigned, so comparing against -1 doesn't work. Cast to int first
>
> Fixes 8e2982b5767
>
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
> This regressed in the past as well, when virtType was changed to
> virDomainVirtType in 7383b8cc068, fixed by the follow up 5e06a4f063.
> It's strange that virDomainVirtType is unsigned but VirtTypeFromString
> can return -1... it should probably either work like virArch, or we
> should switch virDomainVirtType to int in the DomainDef, but that
> requires fixing a few other places too
>
> 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 c27c874d9e..30806d1e59 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -19140,7 +19140,7 @@ virDomainDefParseCaps(virDomainDefPtr def,
> "%s", _("missing domain type attribute"));
> goto cleanup;
> }
> - if ((def->virtType = virDomainVirtTypeFromString(virttype)) < 0) {
> + if ((int)(def->virtType = virDomainVirtTypeFromString(virttype)) < 0) {
> virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> _("invalid domain type %s"), virttype);
> goto cleanup;
I've already pushed the fix for this problem, changing "virtType"
back to an int.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
More information about the libvir-list
mailing list