[libvirt] [PATCH] avoid two test failures induced by today's error-reporting changes
by Jim Meyering
I'm applying these fixes to avoid "make check" failures:
>From f41517a4250db0961482e097813eb39da5bea963 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 9 Feb 2009 16:25:36 +0100
Subject: [PATCH] avoid two test failures induced by today's error-reporting changes
* tests/cpuset: Adjust expected diagnostic to match new behavior.
* tests/undefine: Likewise.
---
tests/cpuset | 4 ++--
tests/undefine | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/cpuset b/tests/cpuset
index 75303e3..eeb0ee2 100755
--- a/tests/cpuset
+++ b/tests/cpuset
@@ -1,7 +1,7 @@
#!/bin/sh
# ensure that defining with an invalid vCPU cpuset elicits a diagnostic
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -36,8 +36,8 @@ sed "s/vcpu>/vcpu cpuset='aaa'>/" xml > xml-invalid || fail=1
# Require failure and a diagnostic.
virsh --connect test:///default define xml-invalid > out 2>&1 && fail=1
cat <<\EOF > exp || fail=1
-libvir: Domain Config error : failed Xen syscall topology cpuset syntax error
error: Failed to define domain from xml-invalid
+error: failed Xen syscall topology cpuset syntax error
EOF
compare exp out || fail=1
diff --git a/tests/undefine b/tests/undefine
index 48e8356..fafdae7 100755
--- a/tests/undefine
+++ b/tests/undefine
@@ -1,7 +1,7 @@
#!/bin/sh
# exercise virsh's "undefine" command
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,8 +29,8 @@ fail=0
virsh -q -c test:///default undefine test > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
-libvir: Test error : internal error Domain 'test' is still running
error: Failed to undefine domain test
+error: internal error Domain 'test' is still running
EOF
compare exp out || fail=1
--
1.6.2.rc0.173.g5e148
15 years, 10 months
[libvirt] Domain comment/description string?
by Jan Kasprzak
Hello,
I use KVM+qemu for testing various distributions and playing
with different versions of software. Now I would like to migrate
my virtual machines to libvirt. One of the problems is that I would like
to have some sort of comment or description of the machine, which would
be displayed in "virsh list" or in virt-manager together with
the machine hostname. Example:
<name>rei</name>
<comment>Fedora rawhide/32bit</comment>
or
<name>konata</name>
<comment>Gentoo x86_64 with KDE 4</comment>
Does the libvirt XML format support something like
this? Embedding comment inside the <name>...</name> tag does not work.
Does libvirt support something like that? Thanks,
-Yenya
--
| Jan "Yenya" Kasprzak <kas at {fi.muni.cz - work | yenya.net - private}> |
| GPG: ID 1024/D3498839 Fingerprint 0D99A7FB206605D7 8B35FCDE05B18A5E |
| http://www.fi.muni.cz/~kas/ Journal: http://www.fi.muni.cz/~kas/blog/ |
>> If you find yourself arguing with Alan Cox, you’re _probably_ wrong. <<
>> --James Morris in "How and Why You Should Become a Kernel Hacker" <<
15 years, 10 months
[libvirt] libvirtd and LVM snapshots
by Nick Moffitt
I'm working on an existing system that creates, manages, and destroys
Xen guests on a pool of host systems, and I use LVM copy-on-write
snapshots to keep creation rapid.
http://libvirt.org/storage.html describes logical volume pools, for
which you simply supply the name of a volume group and it allocates
volumes from that. By my reading, it appears one can even provide a
list of block devices and they will be carved into extents and pooled
into a VG for you.
Is there any interface to libvirtd that allows it to create volumes that
are snapshots of existing volumes? If not, does anyone have advice for
doing so manually in a way that plays smoothly with libvirt?
--
Support your droogs! Nick Moffitt
nick(a)zork.net
15 years, 10 months
[libvirt] Getting error "libvir: QEMU error : Domain not found"
by M. Mohan Kumar
Hi,
When I try to run vm-install on a OpenSuse 11.1 machine, vm-install displays
the following message "libvir: QEMU error : Domain not found". How ever the
functionality is not affected.
I don't think its really an error. It could be just an warning/information
message. Is there any plan to change this message as warning/information from
error level?
Note: I am not in the mailing list, so please cc me while replying.
--
Regards,
M. Mohan Kumar
15 years, 10 months
[libvirt] [Patch] enable --checkpoint option in 'virsh save'
by Matt McCowan
Folks.
I'm working on a scenario where I would like to provide my backup subsystems with a clean disk and ram state of any given VM, without necessitating shutting down the a VM.
Xen's 'xm save' function with the '-c' (checkpoint) argument made sense in that I could checkpoint save the VM, take a snapshot of the LV containing the domain and its 'save' dump then resume the domain. Unfortunately out-of-the-box the Xen implementation did not pause the domain after the checkpoint, but resumed it automatically. Fastforward to using kvm ...
Qemu/kvm with it's 'migrate' command by default left the domain paused after creating a state dump - just what I was looking for. A look at the libvirt code revealed that 'virsh save' carried out a migrate, then shut the domain down. So I have tried implementing a --checkpoint option into the save function using the --live option to the 'virsh migrate' function as a bit of a template.
I'm a sysadmin, not a coder, so please forgive any oversights and all the other coding rules that may be broken. As mentioned before I did try to simply copy how the migrate --live option is used throughout.
Patch (against 0.6.0) attached. I have also filed a feature request under bugzilla. If the additional feature is seen as warranted, please let me know what I can do to help implement it if the patch is not the way to go about it.
Thankyou very much for Libvirt
Regards
Matt McCowan
15 years, 10 months
[libvirt] libvirt and the lowest common denominator
by John Levon
I wanted to bring this topic out of a patch review thread.
Dan recently stated that only patches that use "upstream" facilities are
acceptable, meaning the xend delivered by XenSource. I'd like to make a
few points on this note:
1. I'd like to hear from the other core maintainers if they agree with
this rule.
2. I'd like to hear a rationale for this rule.
3. The Sun repository *is* the upstream for xend on Solaris for a number
of reasons:
a. The 3.1.x series is only maintained by us, there is no other 3.1 upstream
b. The XenSource upstream does not, and cannot, work on Solaris
c. XenSource have no interest in xend at all and it's effectively
unmaintained (with the exception of Novell I think).
4. I've seen stated a number of times that libvirt is designed to avoid
becoming a lowest common denominator interface. I cannot reconcile that
claim with this rule: all xend implementations must apparently be the
same, and no enhancements are allowed.
5. This rule further restricts innovation in that XenSource must agree
to any changes. This has a rather obvious chilling effect. The distro
type/variant recording changes are a perfect example: this is essential
information, and recording it in xend was pre-NAKed by XenSource a long
time ago.
6. As a thought experiment: if someone re-wrote xend in C, what then? Is
that upstream, or not? In case it's not clear, all of Sun's Xen changes
are open source and easily available.
7. Any change that involves *incompatibility* is clearly different, and
IMHO not acceptable. This is only about changes that in no way
negatively affect behaviour with an upstream Linux xend.
8. I hope it's clear to everyone that I'm motivated to merge changes
upstream wherever feasible. I'm not seeking some kind of get-out clause
from being a responsible maintainer.
9. Practically, we will have to carry these changes in our libvirt no
matter what. I'd rather not.
10. I would note that Red Hat own the upstream for the code they care
about, thus this rule can only cause trouble for other people.
My personal opinion, not Sun's.
regards,
john
15 years, 10 months
[libvirt] saving virtual machine state when rebooting the server machine
by Itamar Reis Peixoto
is possible to save virtual machine state when rebooting the server machine ?
https://help.ubuntu.com/8.04/serverguide/C/libvirt.html
The state of virtual machines can be saved to a file in order to be
restored later. The following will save the virtual machine state into
a file named according to the date:
virsh -c qemu:///system save web_devel web_devel-022708.state
Once saved the virtual machine will no longer be running.
A saved virtual machine can be restored using:
virsh -c qemu:///system restore web_devel-022708.state
--
------------
Itamar Reis Peixoto
e-mail/msn: itamar(a)ispbrasil.com.br
sip: itamar(a)ispbrasil.com.br
skype: itamarjp
icq: 81053601
+55 11 4063 5033
+55 34 3221 8599
15 years, 10 months
[libvirt] [PATCH ] (type ioem) adding qemu nic configuration option in to libvirt (XEN)
by Gihan Munasinghe
Guys
I have added a new attribute with with in <interface > tag called "qemu"
which can be either true or false..
Indicating if the user wants XEN to create qeum net device or not.. This
will fix the problem with PV net drivers with XEN..
Check the following examples
e.g 1) Interface tag with qemu attribute set to false
<interface type='bridge' qemu='false'>
<mac address='00:16:3e:00:a5:01'/>
<source bridge='eth0'/>
<target dev='vif1.0'/>
</interface>
qemu-dm output
---------------------
/usr/lib64/xen/bin/qemu-dm -d 60 -domain-name benchmark1 -k en-gb -vnc
0.0.0.0:1 -vcpus 2 -boot c -serial pty -acpi -usb -net none -M xenfv
XEND has configured the hvm guest not to have network card via qemu
e.g 2) Interface tag with qemu attribute set to true with qemu supported
nic model
<interface type='bridge' qemu='true'>
<mac address='00:16:3e:00:a5:01'/>
<source bridge='eth0'/>
<target dev='vif1.0'/>
<model type='e1000'/>
</interface>
qemu-dm output
---------------------
/usr/lib64/xen/bin/qemu-dm -d 61 -domain-name benchmark1 -k en-gb -vnc
0.0.0.0:1 -vcpus 2 -boot c -serial pty -acpi -usb -net
nic,vlan=1,macaddr=00:16:3e:00:a5:01,model=e1000 -net
tap,vlan=1,ifname=tap61.0,bridge=eth0 -M xenfv
Now XEND have configured the hvm guest to have emulated nic of the model
"e1000"
Therefore now, via libvirt configuration I have the ability ask xen to
either to configure qemu network card or not (when I have pv divers
installed with in my VM )
I have attached the patch files, Let me know what you guys think.
Thanks
Gihan
--
Gihan Munasinghe
R&D Team Leader
XCalibre Communications Ltd.
www.flexiscale.com
--- domain_conf.h.back 2008-12-04 15:31:38.000000000 +0000
+++ domain_conf.h 2008-12-04 20:28:16.000000000 +0000
@@ -127,9 +127,17 @@
VIR_DOMAIN_NET_TYPE_NETWORK,
VIR_DOMAIN_NET_TYPE_BRIDGE,
- VIR_DOMAIN_NET_TYPE_LAST,
+ VIR_DOMAIN_NET_TYPE_LAST
};
+/*Holds the values that can be passed as qemu attribute in <inteface >*/
+enum virDomainNetQemuAllocateType{
+ VIR_DOMAIN_NET_QEMU_ALLOC_TRUE,
+ VIR_DOMAIN_NET_QEMU_ALLOC_FALSE,
+
+ VIR_DOMAIN_NET_QEMU_ALLOC_LAST
+
+};
/* Stores the virtual network interface configuration */
typedef struct _virDomainNetDef virDomainNetDef;
@@ -156,6 +164,8 @@
} bridge;
} data;
char *ifname;
+ int qemu_allocate;/* This is set so that the users can ask xen not give vm's a network card
+ maily to with the (type none)/(type ieoum) tags wchi will be send to xend*/
};
enum virDomainChrSrcType {
@@ -608,5 +618,5 @@
VIR_ENUM_DECL(virDomainInput)
VIR_ENUM_DECL(virDomainInputBus)
VIR_ENUM_DECL(virDomainGraphics)
-
+VIR_ENUM_DECL(virDomainNetQemuAllocate)
#endif /* __DOMAIN_CONF_H */
--- domain_conf.c.back 2008-12-04 15:31:40.000000000 +0000
+++ domain_conf.c 2008-12-04 20:30:31.000000000 +0000
@@ -142,6 +142,10 @@
"usb",
"pci")
+VIR_ENUM_IMPL(virDomainNetQemuAllocate, VIR_DOMAIN_NET_QEMU_ALLOC_LAST,
+ "true",
+ "false")
+
#define virDomainReportError(conn, code, fmt...) \
virReportErrorHelper(conn, VIR_FROM_DOMAIN, code, __FILE__, \
__FUNCTION__, __LINE__, fmt)
@@ -787,6 +791,7 @@
char *address = NULL;
char *port = NULL;
char *model = NULL;
+ char *qemu_alloc = NULL;
if (VIR_ALLOC(def) < 0) {
virDomainReportError(conn, VIR_ERR_NO_MEMORY, NULL);
@@ -800,6 +805,17 @@
_("unknown interface type '%s'"), type);
goto error;
}
+ qemu_alloc = virXMLPropString(node, "qemu");
+ if( qemu_alloc!=NULL){
+ if ((def->qemu_allocate = virDomainNetQemuAllocateTypeFromString(qemu_alloc)) < 0) {
+ virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("unknown qemu alloc '%s'"), qemu_alloc);
+ goto error;
+ }
+
+ }else{
+ def->qemu_allocate = VIR_DOMAIN_NET_QEMU_ALLOC_TRUE; // by default the aloocation will be true
+ }
} else {
def->type = VIR_DOMAIN_NET_TYPE_USER;
}
@@ -818,6 +834,7 @@
(def->type == VIR_DOMAIN_NET_TYPE_BRIDGE) &&
(xmlStrEqual(cur->name, BAD_CAST "source"))) {
bridge = virXMLPropString(cur, "bridge");
+
} else if ((dev == NULL) &&
(def->type == VIR_DOMAIN_NET_TYPE_ETHERNET) &&
xmlStrEqual(cur->name, BAD_CAST "source")) {
--- xend_internal.c.back 2008-12-04 15:31:38.000000000 +0000
+++ xend_internal.c 2008-12-04 21:05:49.000000000 +0000
@@ -1773,10 +1773,9 @@
if (VIR_ALLOC(net) < 0)
goto no_memory;
- if ((tmp2 && strstr(tmp2, "bridge")) || tmp) {
- net->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
- /* XXX virtual network reverse resolve */
-
+ if ((tmp2 && (strstr(tmp2, "bridge") )) || tmp) {
+ net->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
+ /* XXX virtual network reverse resolve */
if (tmp &&
!(net->data.bridge.brname = strdup(tmp)))
goto no_memory;
@@ -5153,10 +5152,15 @@
/*
* apparently (type ioemu) breaks paravirt drivers on HVM so skip this
- * from Xen 3.1.0
+ * from Xen 3.1.0 This happence as XEN try to allocate a network card via qemu
*/
- if ((hvm) && (xendConfigVersion < 4))
- virBufferAddLit(buf, "(type ioemu)");
+// if ((hvm) && (xendConfigVersion < 4) )
+ if ((hvm) && (def->qemu_allocate==VIR_DOMAIN_NET_QEMU_ALLOC_FALSE)){ /* If we have asked the qemu not to allocte a net work for hvm guest.
+ This way you would not have a problem with PV drivers on HVM guests*/
+ virBufferAddLit(buf, "(type none)");
+ }else {
+ virBufferAddLit(buf, "(type ioemu)");
+ }
if (!isAttach)
virBufferAddLit(buf, ")");
15 years, 10 months
[libvirt] adding tests....
by Jim Meyering
In adding a couple of tests, I noticed that libvirtd --config=no-such
didn't diagnose my mistake.
I fixed that with the first patch below:
diagnose "libvirtd --config=no-such-file"
* qemud/qemud.c (remoteReadConfigFile): Don't return 0 (success)
when the config file is unreadable or nonexistent
Return -1, not 0, upon virConfReadFile failure.
(main): If remote_config_file is not specified via --config(-f),
use the default config file only if it exists. Otherwise,
use /dev/null.
However, that made it so libvirtd gave two diagnostics:
Failed to open file 'no-such': No such file or directory
libvir: Config error : failed to open no-such for reading
The latter part of that patch fixes it like this:
* src/conf.c (virConfReadFile): Don't diagnose virFileReadAll
failure, since it already does that.
Finally, I went to add the two tests,
one to ensure libvirtd --config=no-such-file now fails, as I expected
another to start libvirtd and then run a small pool-related test via
a separate virsh invocation.
But that made me see a bug in tests/Makefile.am:
A missing backslash made it so the virsh-all test wasn't being run.
Easy to fix. But then, I saw when virsh-all runs it generated too
much output, so I did this:
tests: quiet virsh-all
* tests/virsh-all: For now, ignore diagnostics and exit status,
when running all virsh commands.
Finally, here are the two tests:
add tests
* tests/libvirtd-pool: New file.
* tests/libvirtd-fail: New file.
* tests/Makefile.am (test_scripts): Add omitted backslash,
so that the virsh-all test is run.
Add libvirtd-fail and libvirtd-pool.
>From aaea6d51f5200e58086d9cabf8b6e7fac7c460f8 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 8 Jan 2009 20:17:35 +0100
Subject: [PATCH 1/3] diagnose "libvirtd --config=no-such-file"
* qemud/qemud.c (remoteReadConfigFile): Don't return 0 (success)
when the config file is unreadable or nonexistent
Return -1, not 0, upon virConfReadFile failure.
(main): If remote_config_file is not specified via --config(-f),
use the default config file only if it exists. Otherwise,
use /dev/null.
* src/conf.c (virConfReadFile): Don't diagnose virFileReadAll
failure, since it already does that.
---
qemud/qemud.c | 20 ++++++++++++--------
src/conf.c | 3 +--
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/qemud/qemud.c b/qemud/qemud.c
index c3d3c02..9835e0a 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -1,7 +1,7 @@
/*
* qemud.c: daemon start of day, guest process & i/o management
*
- * Copyright (C) 2006, 2007, 2008 Red Hat, Inc.
+ * Copyright (C) 2006, 2007, 2008, 2009 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -2116,13 +2116,8 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
auth_unix_ro = REMOTE_AUTH_NONE;
#endif
- /* Just check the file is readable before opening it, otherwise
- * libvirt emits an error.
- */
- if (access (filename, R_OK) == -1) return 0;
-
conf = virConfReadFile (filename);
- if (!conf) return 0;
+ if (!conf) return -1;
/*
* First get all the logging settings and activate them
@@ -2301,7 +2296,7 @@ int main(int argc, char **argv) {
struct sigaction sig_action;
int sigpipe[2];
const char *pid_file = NULL;
- const char *remote_config_file = SYSCONF_DIR "/libvirt/libvirtd.conf";
+ const char *remote_config_file = NULL;
int ret = 1;
struct option opts[] = {
@@ -2372,6 +2367,15 @@ int main(int argc, char **argv) {
}
}
+ 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");
+ }
+
if (godaemon) {
if (qemudGoDaemon() < 0) {
VIR_ERROR(_("Failed to fork as daemon: %s"), strerror(errno));
diff --git a/src/conf.c b/src/conf.c
index 9f0fc34..339a150 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -1,7 +1,7 @@
/**
* conf.c: parser for a subset of the Python encoded Xen configuration files
*
- * Copyright (C) 2006, 2007, 2008 Red Hat, Inc.
+ * Copyright (C) 2006, 2007, 2008, 2009 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
@@ -712,7 +712,6 @@ virConfReadFile(const char *filename)
}
if ((len = virFileReadAll(filename, MAX_CONFIG_FILE_SIZE, &content)) < 0) {
- virConfError(NULL, VIR_ERR_OPEN_FAILED, filename);
return NULL;
}
--
1.6.1.141.gfe98e
>From e70a4556a8422779b7997ab03997af4b9a03087c Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 8 Jan 2009 19:58:19 +0100
Subject: [PATCH 2/3] tests: quiet virsh-all
* tests/virsh-all: For now, ignore diagnostics and exit status,
when running all virsh commands.
---
tests/virsh-all | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/virsh-all b/tests/virsh-all
index f1c84a3..03ea466 100755
--- a/tests/virsh-all
+++ b/tests/virsh-all
@@ -1,7 +1,7 @@
#!/bin/sh
# blindly run each and every command listed by "virsh help"
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,7 +35,8 @@ test -n "$cmds" || framework_failure
for i in $cmds; do
echo testing $i... 1>&2
- virsh -c $test_url $i < /dev/null
+ # For now, just run the command and ignore output and exit status.
+ virsh -c $test_url $i < /dev/null > /dev/null 2>&1
done
(exit $fail); exit $fail
--
1.6.1.141.gfe98e
>From 307c465a008cbb4a497a6553046a036e95843519 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 8 Jan 2009 20:18:17 +0100
Subject: [PATCH 3/3] add two tests
* tests/libvirtd-pool: New file.
* tests/libvirtd-fail: New file.
* tests/Makefile.am (test_scripts): Add omitted backslash,
so that the virsh-all test is run.
Add libvirtd-fail and libvirtd-pool.
---
tests/Makefile.am | 24 ++++++++++++----------
tests/libvirtd-fail | 20 +++++++++++++++++++
tests/libvirtd-pool | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 86 insertions(+), 11 deletions(-)
create mode 100755 tests/libvirtd-fail
create mode 100755 tests/libvirtd-pool
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d8b5e44..a3e4383 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -56,17 +56,19 @@ endif
test_scripts = domainschematest
if WITH_LIBVIRTD
-test_scripts += \
- test_conf.sh \
- cpuset \
- daemon-conf \
- int-overflow \
- read-bufsiz \
- read-non-seekable \
- start \
- undefine \
- vcpupin
- virsh-all
+test_scripts += \
+ cpuset \
+ daemon-conf \
+ int-overflow \
+ libvirtd-fail \
+ libvirtd-pool \
+ read-bufsiz \
+ read-non-seekable \
+ start \
+ test_conf.sh \
+ undefine \
+ vcpupin \
+ virsh-all \
virsh-synopsis
endif
diff --git a/tests/libvirtd-fail b/tests/libvirtd-fail
new file mode 100755
index 0000000..724d7c6
--- /dev/null
+++ b/tests/libvirtd-fail
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Ensure that libvirt fails when given nonexistent --config=FILE
+
+if test "$VERBOSE" = yes; then
+ set -x
+ libvirtd --version
+fi
+
+test -z "$srcdir" && srcdir=$(pwd)
+test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+. "$srcdir/test-lib.sh"
+
+fail=0
+
+libvirtd --config=no-such-file > log 2>&1 && fail=1
+cat <<\EOF > exp
+Failed to open file 'no-such-file': No such file or directory
+EOF
+
+compare exp log
diff --git a/tests/libvirtd-pool b/tests/libvirtd-pool
new file mode 100755
index 0000000..72afa12
--- /dev/null
+++ b/tests/libvirtd-pool
@@ -0,0 +1,53 @@
+#!/bin/sh
+# Get coverage of libvirtd's config-parsing code.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ libvirtd --version
+ virsh --version
+fi
+
+test -z "$srcdir" && srcdir=$(pwd)
+test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+. "$srcdir/test-lib.sh"
+
+fail=0
+
+libvirtd > log 2>&1 & pid=$!
+sleep 1
+
+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
+
+# remove random uuid
+sed 's/<uuid>.*/-/' out > k && mv k out || fail=1
+
+kill $pid
+
+cat <<EOF > exp
+Pool P defined
+
+<pool type='dir'>
+ <name>P</name>
+ -
+ <capacity>0</capacity>
+ <allocation>0</allocation>
+ <available>0</available>
+ <source>
+ </source>
+ <target>
+ <path>/target-path</path>
+ <permissions>
+ <mode>0700</mode>
+ <owner>500</owner>
+ <group>500</group>
+ </permissions>
+ </target>
+</pool>
+
+EOF
+
+compare exp out
+compare /dev/null log
--
1.6.1.141.gfe98e
15 years, 10 months