[Libvir] A 'mock' driver enabling application unit testing

Daniel P. Berrange berrange at redhat.com
Mon May 29 17:43:24 UTC 2006


On Mon, May 29, 2006 at 01:19:49PM -0400, Daniel Veillard wrote:
> On Fri, May 26, 2006 at 07:35:37PM +0100, Daniel P. Berrange wrote:
> > To use this driver, simply pass 'TestSimple' as the name parameter to 
> > virConnectOpen / virConnectOpenReadonly instead of NULL. If you are using
> > 'virsh' then my previous patch will let you call 'virsh --connect TestSimple'
> > I've also tested this with the 'gnome-vm-applet' panel applet.
> 
>   That's probably the only part where I have a slight concern, shouldn't
> we just use something like "test:///default" for this simple fallback case
> and probably something like "test:///path/to/config" in the more general 
> case where there will be some state. But it really should not be a big deal.

That sounds reasonable - I wasn't not sure what format you were planning for
the 'name' parameter - I'll adapt it to expect this URI style format.

> > The only problem I have found is that the 'xend_internal.c' driver will
> > always return success from its 'xenDaemonOpen' method, regardless of 
> > whether there is actually a Xen Daemon present. So when using the test
> > driver, every method will first try to ue the XenD driver impl, fail (printing
> > an error message) and then go onto use the test driver. The xenDaemonOpen
> > method really needs to be fixed to only succeed when Xen is actually present.
> 
>   Right this need some cleanup I think. I though I had left a TODO there.
> 
> > Or perhaps it should only try to run when the 'name' passed to virConnectOpen
> > is NULL or 'Xen' - ie be a no op if the name is 'TestSimple' / QEMU / any
> > other driver implementation.
> > 
> > I'm not sure whether we want to commit this to the libvirt codebae just,
> > since there is a fair bit more work to be done to hook up additional
> > methods.
> 
>   Do you think you will need to change radically that code when completing
> it ? Looks to me it's just additional code, so what's there should be commited
> because it's code you expect to be present in the end. So please commit
> (I think your CVS account works, right ?)

Aside from making it expect a URI style name, the one change I need to make
is change the internal storage to dynamically allocate the data structures.
Currently it just has a huge statically allocating struct, which wastes 32k
of memory even if your not using the test driver.

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list