[libvirt] [PATCH 6/7] Introduce qemuDomainMachineIsVirt

Andrea Bolognani abologna at redhat.com
Tue May 3 12:40:12 UTC 2016


On Tue, 2016-05-03 at 13:19 +0200, Andrea Bolognani wrote:
> On Tue, 2016-05-03 at 13:05 +0200, Peter Krempa wrote:
> > > 
> > > +bool
> > > +qemuDomainMachineIsVirt(const virDomainDef *def)
> > > +{
> > > +    return STREQ(def->os.machine, "virt") ||
> > > +           STRPREFIX(def->os.machine, "virt-");
> > 
> > This could be transcribed as:
> > strcmp(def->os.machine, "virt") ||
> > strncmp(def->os.machine, "virt-", strlen("virt-")) so
> > "STRPREFIX(def->os.machine, "virt")" should be equivalent.
> 
> I think we want to make sure we only accept "virt" and
> its versioned variants here - if QEMU introuced a new
> machine type called "virtpc" we wouldn't want it to
> pass the test.
> 
> (Then again, "virt-pc" would pass in any case. I think
>  the current check strikes a good balance, YMMV.)

How about something like the attached, untested patch? :)

-- 
Andrea Bolognani
Software Engineer - Virtualization Team
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-qemu-Introduce-qemuDomainMachineIsVariantOf.patch
Type: text/x-patch
Size: 2326 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160503/3ec2f930/attachment-0001.bin>


More information about the libvir-list mailing list