[libvirt] build: update gnulib submodule to latest
by Jim Meyering
Thanks, Eric.
>From bd3ff6b34892fe75cfcc67f1aeab43e8a273c1b6 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Fri, 26 Feb 2010 17:14:01 +0100
Subject: [PATCH] build: update gnulib submodule to latest
* .gnulib: Update to latest.
Commit 89bdf84bcd9c6032e37 inadvertently rewound the .gnulib
submodule by 51 commits. This corrects it.
Spotted by Eric Blake.
---
.gnulib | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/.gnulib b/.gnulib
index 11fbc57..80cd995 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 11fbc57405a118e6ec9a3ebc19bbf5ececdae4d6
+Subproject commit 80cd995cdcbf4b9ded895a43621a11f11806ad8d
--
1.7.0.442.g55ad1
14 years, 10 months
[libvirt] [PATCH] Only build virDomainObjFormat if not building proxy.
by Chris Lalancette
While building under RHEL-5, I got a compile warning because
virDomainObjFormat was defined but not used. That came about
because in RHEL-5 we build with "#define PROXY", and
virDomainObjFormat is only used with !PROXY. Move the
define.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
src/conf/domain_conf.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b6d2c61..1d7f458 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5668,6 +5668,8 @@ char *virDomainDefFormat(virDomainDefPtr def,
return NULL;
}
+#ifndef PROXY
+
static char *virDomainObjFormat(virCapsPtr caps,
virDomainObjPtr obj,
int flags)
@@ -5703,9 +5705,6 @@ error:
return NULL;
}
-
-#ifndef PROXY
-
int virDomainSaveXML(const char *configDir,
virDomainDefPtr def,
const char *xml)
--
1.6.6.1
14 years, 10 months
[libvirt] Odd implementation of libvirt qemudDomainSetMaxMemory
by Chris Lalancette
Hey Cole,
In commit 09a33fd8a9cc85e5e1064168472bff7aecff15fb, you made it so that
qemudDomainSetMaxMemory() was hotplug only. However, with the changes you
pushed, this function no longer makes a lot of sense. It looks up the domain,
checks to make sure it is active, and then if it is active, it fails. Assuming
that qemu doesn't support changing the maximum amount of memory on the fly,
wouldn't it be better to just remove this function entirely and let the higher
libvirt layers report "function not supported"?
--
Chris Lalancette
14 years, 10 months
[libvirt] [PATCH] openvzGetVEID: don't leak (memory + file descriptor)
by Jim Meyering
Coverity spotted the leaks.
Here's a proposed fix.
I didn't bother with a separate diagnostic for the unlikely
event that we read a negative number from the pipe.
Seems far-fetched enough not to bother, but it's easy to
add, if anyone cares.
>From f3439c7eae46681eacf5b469a6f0e22cb8fec1b4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 25 Feb 2010 19:24:50 +0100
Subject: [PATCH] openvzGetVEID: don't leak (memory + file descriptor)
* src/openvz/openvz_conf.c (openvzGetVEID): Always call fclose.
Diagnose parse failure also when vzlist output is empty.
If somehow we read a -1, diagnose that (albeit as a parse failure).
---
src/openvz/openvz_conf.c | 19 +++++++------------
1 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index ce0c4d3..3713a45 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -964,6 +964,7 @@ int openvzGetVEID(const char *name) {
char *cmd;
int veid;
FILE *fp;
+ bool ok;
if (virAsprintf(&cmd, "%s %s -ovpsid -H", VZLIST, name) < 0) {
openvzError(NULL, VIR_ERR_INTERNAL_ERROR, "%s",
@@ -979,18 +980,12 @@ int openvzGetVEID(const char *name) {
return -1;
}
- if (fscanf(fp, "%d\n", &veid ) != 1) {
- if (feof(fp))
- return -1;
-
- openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Failed to parse vzlist output"));
- goto cleanup;
- }
-
- return veid;
-
- cleanup:
+ ok = fscanf(fp, "%d\n", &veid ) == 1;
fclose(fp);
+ if (ok && veid >= 0)
+ return veid;
+
+ openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Failed to parse vzlist output"));
return -1;
}
--
1.7.0.401.g84adb
14 years, 10 months
[libvirt] avoid "make rpm" failure in doc/
by Jim Meyering
"make rpm" fails like this:
Rebuilding the HTML pages from the XML API
make[3]: *** No rule to make target `html/libvirt-libvirt.html', needed by `distdir'. Stop.
make[3]: *** Waiting for unfinished jobs....
Validating the resulting XHTML pages
These two patches fix that:
(though "make rpm" still fails for me:
extracting debug info from /j/rpmbuild/BUILDROOT/libvirt-0.7.6-1.fc12.x86_6h..
*** ERROR: No build ID note found in /j/rpmbuild/BUILDROOT/libvirt-0.7.6-1.h..
The first (1/2) change is not officially required to solve this problem,
but it overlapped, and does fix a non-distdir build failure.
>From ace4dca5dfbc022b057ce1d9f3d2770ad3a34716 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Wed, 24 Feb 2010 22:51:47 +0100
Subject: [PATCH 1/2] build: teach apibuild.py to work in a non-srcdir build
* docs/Makefile.am (libvirt-api.xml libvirt-refs.xml): Generalize
apibuild.py to work in a non-srcdir build. Pass "srcdir" to it.
* docs/apibuild.py (rebuild): Honor the $srcdir envvar.
---
docs/Makefile.am | 2 +-
docs/apibuild.py | 10 +++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index e47b668..dbbd1ef 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -132,7 +132,7 @@ devhelp/index.html devhelp/libvirt.devhelp: libvirt-api.xml $(devhelpxsl)
libvirt-api.xml libvirt-refs.xml: apibuild.py \
$(srcdir)/../include/libvirt/*.h \
$(srcdir)/../src/libvirt.c $(srcdir)/../src/util/virterror.c
- -$(srcdir)/apibuild.py
+ -srcdir=$(srcdir) $(srcdir)/apibuild.py
clean-local:
rm -f *~ *.bak *.hierarchy *.signals *-unused.txt
diff --git a/docs/apibuild.py b/docs/apibuild.py
index e233c8b..0ab5db2 100755
--- a/docs/apibuild.py
+++ b/docs/apibuild.py
@@ -2102,10 +2102,14 @@ class docBuilder:
def rebuild():
builder = None
- if glob.glob("../src/libvirt.c") != [] :
+ srcdir = os.environ["srcdir"]
+ if glob.glob(srcdir + "/../src/libvirt.c") != [] :
print "Rebuilding API description for libvirt"
- builder = docBuilder("libvirt", ["../src", "../src/util", "../include/libvirt"],
- [])
+ builder = docBuilder("libvirt",
+ [srcdir + "/../src",
+ srcdir + "/../src/util",
+ srcdir + "/../include/libvirt"],
+ [])
elif glob.glob("src/libvirt.c") != [] :
print "Rebuilding API description for libvir"
builder = docBuilder("libvirt", ["src", "src/util", "include/libvirt"],
--
1.7.0.401.g84adb
>From a79fb1c491197a91094cd2345c3d7bbba40da2fd Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 25 Feb 2010 10:35:20 +0100
Subject: [PATCH 2/2] build: avoid "make rpm" failure in docs/
Add missing rule to build html/libvirt-libvirt.html.
Use a GNU Make pattern rule to avoid running apibuild.py once
for each out-of-date target, in a parallel build.
* docs/Makefile.am
---
docs/Makefile.am | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index dbbd1ef..edf6fc8 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -123,17 +123,20 @@ html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in
$(XMLLINT) --nonet --valid --noout html/*.html ; \
else echo "missing XHTML1 DTD" ; fi ; fi );
-devhelp/index.html devhelp/libvirt.devhelp: libvirt-api.xml $(devhelpxsl)
+$(devhelphtml): libvirt-api.xml $(devhelpxsl)
-@(echo Rebuilding devhelp files)
-@(if [ -x $(XSLTPROC) ] ; then \
- $(XSLTPROC) --nonet -o devhelp/libvirt.devhelp $(top_srcdir)/docs/devhelp/devhelp.xsl $(top_srcdir)/docs/libvirt-api.xml ; fi );
+ $(XSLTPROC) --nonet -o devhelp/libvirt.devhelp \
+ $(top_srcdir)/docs/devhelp/devhelp.xsl libvirt-api.xml ; fi );
-
-libvirt-api.xml libvirt-refs.xml: apibuild.py \
- $(srcdir)/../include/libvirt/*.h \
- $(srcdir)/../src/libvirt.c $(srcdir)/../src/util/virterror.c
+html/%-%.html html/%-virterror.html %-api.xml %-refs.xml: $(srcdir)/apibuild.py
-srcdir=$(srcdir) $(srcdir)/apibuild.py
+html/%-%.html html/%-virterror.html %-api.xml %-refs.xml: \
+ $(srcdir)/../include/%/*.h \
+ $(srcdir)/../src/%.c \
+ $(srcdir)/../src/util/virterror.c
+
clean-local:
rm -f *~ *.bak *.hierarchy *.signals *-unused.txt
--
1.7.0.401.g84adb
14 years, 10 months
[libvirt] [PATCH] build: avoid non-srcdir "make distcheck" failures (CLEANFILES)
by Jim Meyering
A quick review won't hurt, but this
doesn't really need one.
>From 9ac893a1342b31ef7df6fc57c03767c49ef98d5b Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Thu, 25 Feb 2010 09:28:51 +0100
Subject: [PATCH 1/4] build: avoid non-srcdir "make distcheck" failures (CLEANFILES)
* docs/Makefile.am (MAINTAINERCLEANFILES): Use this variable
for generated-and-distributed files, not "CLEANFILES".
Besides, "make clean" and "make distclean" should not delete
distributed files.
---
docs/Makefile.am | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 07ea9bf..dbbd1ef 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -17,7 +17,7 @@ apipng = \
html/home.png \
html/right.png
-devhelphtml = \
+devhelphtml = \
devhelp/libvirt.devhelp \
devhelp/index.html \
devhelp/general.html \
@@ -79,7 +79,7 @@ EXTRA_DIST= \
sitemap.html.in \
ChangeLog.awk
-CLEANFILES = $(dot_html) $(apihtml) $(devhelphtml)
+MAINTAINERCLEANFILES = $(dot_html) $(apihtml) $(devhelphtml)
all: web
--
1.7.0.401.g84adb
14 years, 10 months
[libvirt] [PATCH] qemu: Report binary path if error parsing -help
by Cole Robinson
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/qemu/qemu_conf.c | 14 ++++++++------
src/qemu/qemu_conf.h | 3 ++-
tests/qemuhelptest.c | 3 ++-
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index e3da08a..1f8a9c3 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1237,7 +1237,8 @@ static unsigned long long qemudComputeCmdFlags(const char *help,
#define SKIP_BLANKS(p) do { while ((*(p) == ' ') || (*(p) == '\t')) (p)++; } while (0)
-int qemudParseHelpStr(const char *help,
+int qemudParseHelpStr(const char *qemu,
+ const char *help,
unsigned long long *flags,
unsigned int *version,
unsigned int *is_kvm,
@@ -1308,8 +1309,8 @@ fail:
p = strndup(help, p - help);
qemuReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot parse QEMU version number in '%s'"),
- p ? p : help);
+ _("cannot parse %s version number in '%s'"),
+ qemu, p ? p : help);
VIR_FREE(p);
@@ -1340,12 +1341,13 @@ int qemudExtractVersionInfo(const char *qemu,
enum { MAX_HELP_OUTPUT_SIZE = 1024*64 };
int len = virFileReadLimFD(newstdout, MAX_HELP_OUTPUT_SIZE, &help);
if (len < 0) {
- virReportSystemError(errno, "%s",
- _("Unable to read QEMU help output"));
+ virReportSystemError(errno,
+ _("Unable to read %s help output"), qemu);
goto cleanup2;
}
- if (qemudParseHelpStr(help, &flags, &version, &is_kvm, &kvm_version) == -1)
+ if (qemudParseHelpStr(qemu, help, &flags,
+ &version, &is_kvm, &kvm_version) == -1)
goto cleanup2;
if (retversion)
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index ae187dc..c8757c5 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -175,7 +175,8 @@ int qemudExtractVersionInfo (const char *qemu,
unsigned int *version,
unsigned long long *qemuCmdFlags);
-int qemudParseHelpStr (const char *str,
+int qemudParseHelpStr (const char *qemu,
+ const char *str,
unsigned long long *qemuCmdFlags,
unsigned int *version,
unsigned int *is_kvm,
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 0f2b509..ad355d7 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -49,7 +49,8 @@ static int testHelpStrParsing(const void *data)
if (virtTestLoadFile(path, &help, MAX_HELP_OUTPUT_SIZE) < 0)
return -1;
- if (qemudParseHelpStr(help, &flags, &version, &is_kvm, &kvm_version) == -1)
+ if (qemudParseHelpStr("QEMU", help, &flags,
+ &version, &is_kvm, &kvm_version) == -1)
return -1;
if (flags != info->flags) {
--
1.6.5.2
14 years, 10 months
[libvirt] [PATCH] remote: Improve daemon startup error reporting
by Cole Robinson
If I toggle enable_tcp in libvirtd.conf and add --listen in
/etc/init.d/libvirtd, I get the unhelpful error:
Starting libvirtd daemon: error: Unable to initialize network sockets.
Running without --daemon provides much more useful info:
sudo libvirtd --listen
11:29:26.117: error : remoteCheckCertFile:270 : Cannot access CA certificate '/etc/pki/CA/cacert.pem': No such file or directory
The daemon architecture makes it difficult to report this useful
info if daemonized, so point users to /var/log/messages and
dropping the --daemon flag if they want more info.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
daemon/libvirtd.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index fefa7aa..cee6f13 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -474,7 +474,10 @@ static int daemonForkIntoBackground(void) {
goto again;
if (ret == 1 && status != 0) {
- fprintf(stderr, "error: %s\n", virDaemonErrTypeToString(status));
+ fprintf(stderr,
+ "error: %s. Check /var/log/messages or run without "
+ "--daemon for more info.\n",
+ virDaemonErrTypeToString(status));
}
_exit(ret == 1 && status == 0 ? 0 : 1);
}
--
1.6.5.2
14 years, 10 months
[libvirt] [PATCH] virsh: Show errors reported by nonAPI functions
by Cole Robinson
Only API calls trigger the error callback, which is required for
proper virsh error reporting. Since we use non API functions from
util/, make sure we properly report these errors.
Fixes lack of error message from 'virsh create idontexit.xml'
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
tools/virsh.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 5fdbbe5..74e3fad 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -352,8 +352,16 @@ virshErrorHandler(void *unused ATTRIBUTE_UNUSED, virErrorPtr error)
static void
virshReportError(vshControl *ctl)
{
- if (last_error == NULL)
- return;
+ if (last_error == NULL) {
+ /* Calling directly into libvirt util functions won't trigger the
+ * error callback (which sets last_error), so check it ourselves.
+ *
+ * If the returned error has CODE_OK, this most likely means that
+ * no error was ever raised, so just ignore */
+ last_error = virSaveLastError();
+ if (!last_error || last_error->code == VIR_ERR_OK)
+ return NULL;
+ }
if (last_error->code == VIR_ERR_OK) {
vshError(ctl, "%s", _("unknown error"));
--
1.6.5.2
14 years, 10 months
[libvirt] [PATCH] Use standard spacing for user/pass prompt
by Cole Robinson
Kind of minor, but it annoys me that the default auth callback
doesn't put a space between the prompt and the input, like a typical
terminal, ssh, etc. This patch changes the current prompt:
Please enter your authentication name:myuser
to
Please enter your authentication name: myuser
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/libvirt.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index be17668..9d50c92 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -159,7 +159,7 @@ static int virConnectAuthCallbackDefault(virConnectCredentialPtr cred,
case VIR_CRED_AUTHNAME:
case VIR_CRED_ECHOPROMPT:
case VIR_CRED_REALM:
- if (printf("%s:", cred[i].prompt) < 0)
+ if (printf("%s: ", cred[i].prompt) < 0)
return -1;
if (fflush(stdout) != 0)
return -1;
@@ -178,7 +178,7 @@ static int virConnectAuthCallbackDefault(virConnectCredentialPtr cred,
case VIR_CRED_PASSPHRASE:
case VIR_CRED_NOECHOPROMPT:
- if (printf("%s:", cred[i].prompt) < 0)
+ if (printf("%s: ", cred[i].prompt) < 0)
return -1;
if (fflush(stdout) != 0)
return -1;
--
1.6.5.2
14 years, 10 months