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

Re: [libvirt] adding tests....



On Mon, Jan 12, 2009 at 02:18:05PM +0100, Jim Meyering wrote:
> "Daniel P. Berrange" <berrange redhat com> wrote:
> 
> > On Mon, Jan 12, 2009 at 01:28:41PM +0100, Jim Meyering wrote:
> >> "Daniel P. Berrange" <berrange redhat com> wrote:
> >> >> +    if (remote_config_file == NULL) {
> >> >> +	static const char *default_config_file
> >> >> +	  = SYSCONF_DIR "/libvirt/libvirtd.conf";
> >> >> +	remote_config_file =
> >> >> +	  (access(default_config_file, X_OK) == 0
> >> >> +	   ? default_config_file
> >> >> +	   : "/dev/null");
> >> >> +    }
> >> >
> >> > Indentation looks off-by-2 there.
> >>
> >> Good catch.  I had TABs there.
> >> Fixed.
> >>
> >> >> +virsh --connect qemu:///session \
> >> >> +    pool-define-as P dir src-host /src/path /src/dev S /target-path > out 2>&1 \
> >> >> +  || fail=1
> >> >> +virsh --connect qemu:///session pool-dumpxml P >> out 2>&1 || fail=1
> >> >
> >> > Using qemu:///session here is fragile because it'll see
> >> > all existing user defined vms/network/storage/etc. Use
> >> > the test:///default  driver instead (or test:///path/to/custom/config.xml)
> >>
> >> I wanted to exercise a "real" drivers, not always test://.
> >> How about using an unlikely pool name instead, i.e.,
> >> via this incremental:
> >
> > That's only one issue. When you start up libvirtd it is going to run
> > autostart on all configured vms/networks/pools. We really don't want
> > to be booting configured VMs, and then tearing them down after a few
> > seconds. The unit tests should restrict themselves to testing things
> > which won't have any impact on the host system. Anything else needs
> > to be part of a functional/integration test suite, which is better as
> > a standalone test suite you can run on any OS with libvirt - not just
> > a development tree, so you can test the complete system is functional
> 
> When I run "make check", it's almost always as a non-root user,
> so there's no risk of this libvirtd running system-related things.
> 
> However, I guess you'd like to accommodate the root-run "make check", too?
> It's good to recommend against running tests as root, unless absolutely
> required, because of the potential risk.

The QEMU driver runs as non-root too. This is what the qemu:///session
URI is used for. Likewise with the UML driver. The existing tests that
invoke libvirtd fail quite frequently for me already due to them activating
the QEMU / UML drivers. We really need a way to explicitly say what drivers
should be allowed by the daemon, overriding what's compiled in. THis could
in fact be useful even for production deployment, allowing site admins to
guarentee that Xen driver is never used in the daemon even if it is compiled
in by default. 

So perhaps a couple of config params like

 allowed_drivers = [ "qemu", "xen", "test" ]
 unix_sock_dir = "/var/run/libvirt/"

Not sure how best to hook the first one up to libvirt.so though - the
virInitialize/virStateInitize calls always activate all of them, with
no easy way to disable. 

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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