[libvirt] avoid new "make check" failure and fix a related bug

Jim Meyering jim at meyering.net
Tue May 25 19:12:01 UTC 2010


In reviewing/testing some incoming patches, I noticed a new
"make check" failure.

There were two problems:
- not diagnosing an invalid host UUID.  The lack of this diagnostic
  made it slightly more challenging to track down the next problem:
- not accommodating the fact that our template now contains
  an invalid line;  before the addition of "host_uuid", each
  commented-out sample line was valid.

Here are the fixes.

>From 11228f4b2dba1b43a9de97a575d1121eba2e8cf4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Tue, 25 May 2010 20:56:18 +0200
Subject: [PATCH 1/2] libvirtd: diagnose invalid host UUID

* daemon/libvirtd.c (remoteReadConfigFile): Diagnose an invalid
host UUID rather than silently exiting with status 7.
---
 daemon/libvirtd.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 8fa78b8..e86f78d 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -2843,8 +2843,10 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
     GET_CONF_INT (conf, filename, max_client_requests);

     GET_CONF_STR (conf, filename, host_uuid);
-    if (virSetHostUUIDStr(host_uuid))
+    if (virSetHostUUIDStr(host_uuid)) {
+        VIR_ERROR(_("invalid host UUID: %s"), host_uuid);
         goto free_and_fail;
+    }

     VIR_FREE(host_uuid);

--
1.7.1.342.g1c280


>From 6d20ae23fe5a5e64a0cf1be1f0b9cebce49625c1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Tue, 25 May 2010 21:08:37 +0200
Subject: [PATCH 2/2] tests: avoid new failure of the daemon-conf test

* tests/daemon-conf: Accommodate the fact that out template,
daemon/libvirtd.conf now contains an invalid host_uuid.
Convert it to a valid one before the final libvirtd-running
test that must terminate normally.
---
 tests/daemon-conf |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/tests/daemon-conf b/tests/daemon-conf
index 14d4ced..0e756d4 100755
--- a/tests/daemon-conf
+++ b/tests/daemon-conf
@@ -83,7 +83,11 @@ if test 108 -lt `echo $SOCKPATH | wc -c`; then
     skip_test_ "CWD too long"
 fi

-$abs_top_builddir/daemon/libvirtd --pid-file=pid-file --config=tmp.conf > log 2>&1 & pid=$!
+# Replace the invalid host_uuid with one that is valid:
+sed 's/^\(host_uuid =.*\)0"$/\11"/' tmp.conf > k; mv k tmp.conf
+
+$abs_top_builddir/daemon/libvirtd --pid-file=pid-file --config=tmp.conf \
+    > log 2>&1 & pid=$!
 sleep $sleep_secs
 kill $pid

--
1.7.1.342.g1c280




More information about the libvir-list mailing list