Re: [PATCH kvm-unit-tests 2/4] Introduce a C++ wrapper for the kvm APIs

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

 



On Sun, Nov 28, 2010 at 05:13:41PM -0600, Anthony Liguori wrote:
> On 11/28/2010 04:28 PM, Michael S. Tsirkin wrote:
> >
> >>But rather need to use ugly factory functions with all sorts of
> >>DO_UPCAST.  This is really unfriendly especially for writing test
> >>cases.
> >Yes, I agree. Just moving memory allocation out of there
> >will fix most of the ugliness.
> 
> So here's a short list of things I've been working on that I don't
> believe have nice implementations in C.
> 
> 1) Factories with string based parameters with natural constructor
> arguments.

This was the only item, right?  So in fact, this is needed as part of
configuration file/command line/monitor parser.

IMHO, this really should be separate from the device model.
The fact that qdev currently mixes the device model
with argument parsing is bad IMO. So we ended up with
saying
.driver   = "PCI"
in hw/pc_piix.c instead of an instance of the structure.
There's no compile-time check that the correct string
is used and that is pretty bad IMO.
Yes, this makes it easier to add new properties, but making it easy is
exactly the wrong thing to do because we really have to support such
properties forever.

So how about a compromise: libqemu written in C, with APIs that should
not deal with string parsing at all, and should above all else make
sense:
	i8254_init_drift_mode
	i8254_init_catchup

	net_set_link_up
	net_set_link_down

(and it really needs to be C for portability: so that management
 written in C can use it).
This API should be properly versioned, with a backwards compatibility
story, and we should be careful about adding interfaces there.

On top of this you can have a management interface written in
any other language, and have that deal with string parsing.

-- 
MST
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux