Re: [libvirt PATCH 08/20] qemu: Introduce virQEMUCapsAccelStr

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

 



On Fri, Jan 21, 2022 at 09:20:42AM -0800, Andrea Bolognani wrote:
> On Fri, Jan 21, 2022 at 04:57:34PM +0000, Daniel P. Berrangé wrote:
> > I'd say we should just directly return the virt types we actually
> > expect to get - the invalid ones will have already been filtered
> > out. ie
> >
> >  virQEMUCapsAccelStr(virDomainVirtType type)
> >  {
> >      if (type == VIR_DOMAIN_VIRT_KVM)
> >          return "kvm";
> >      else
> >          return "tcg";
> >  }
> >
> > that is still easily extended to add hvf and so on, without being
> > misleading about supporting any virt type
>
> The original version works because, as you note, we already make sure
> much earlier[1] that only values that correspond to valid QEMU
> accelerators can be used, but I'm okay with being more explicit.
>
> I'd rather use a switch statement though, that way next time an
> accelerator has to be added there will be fewer spots where we can
> easily forget to add handling for it. Does that sound good?

Actually virQEMUCapsGetAccel() already looks like what you proposed,
and they're close together. Let's go for the simpler version.

-- 
Andrea Bolognani / Red Hat / Virtualization





[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