[libvirt] [PATCH] Remove last usageof PATH_MAX and ban its future use
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Remove a number of pointless checks against PATH_MAX and
add a syntax-check rule to prevent its use in future
---
cfg.mk | 5 +++++
src/security/virt-aa-helper.c | 4 ++--
src/storage/storage_backend_scsi.c | 2 +-
src/xenxs/xen_xm.c | 2 --
tools/virsh.c | 7 ++++---
5 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 07fb7b2..534dc67 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -408,6 +408,11 @@ sc_prohibit_VIR_ERR_NO_MEMORY:
halt='use virReportOOMError, not V'IR_ERR_NO_MEMORY \
$(_sc_search_regexp)
+sc_prohibit_PATH_MAX:
+ @prohibit='\<P''ATH_MAX\>' \
+ halt='dynamically allocate paths, do not use P'ATH_MAX \
+ $(_sc_search_regexp)
+
# Use a subshell for each function, to give the optimal warning message.
include $(srcdir)/Makefile.nonreentrant
sc_prohibit_nonreentrant:
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index a5cb85c..7b41d38 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -473,7 +473,7 @@ valid_name(const char *name)
* used to subvert the profile */
const char *bad = " /[]*";
- if (strlen(name) == 0 || strlen(name) > PATH_MAX - 1)
+ if (strlen(name) == 0)
return -1;
if (strcspn(name, bad) != strlen(name))
@@ -544,7 +544,7 @@ valid_path(const char *path, const bool readonly)
"/sys/devices/pci" /* for hostdev pci devices */
};
- if (path == NULL || strlen(path) > PATH_MAX - 1) {
+ if (path == NULL) {
vah_error(NULL, 0, _("bad pathname"));
return -1;
}
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index ae1e19f..465d557 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -251,7 +251,7 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr pool,
goto free_vol;
}
- if (STREQLEN(devpath, vol->target.path, PATH_MAX) &&
+ if (STREQ(devpath, vol->target.path) &&
!(STREQ(pool->def->target.path, "/dev") ||
STREQ(pool->def->target.path, "/dev/"))) {
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 93a26f9..bdf46bd 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -501,8 +501,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
/* Extract the source file path*/
if (!(offset = strchr(head, ',')))
goto skipdisk;
- if ((offset - head) >= (PATH_MAX-1))
- goto skipdisk;
if (offset == head) {
disk->src = NULL; /* No source file given, eg CDROM with no media */
diff --git a/tools/virsh.c b/tools/virsh.c
index ffe6ed2..4492a2b 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -15542,11 +15542,12 @@ editWriteToTempFile (vshControl *ctl, const char *doc)
const char *tmpdir;
int fd;
- ret = vshMalloc(ctl, PATH_MAX);
-
tmpdir = getenv ("TMPDIR");
if (!tmpdir) tmpdir = "/tmp";
- snprintf (ret, PATH_MAX, "%s/virshXXXXXX.xml", tmpdir);
+ if (virAsprintf(&ret, "%s/virshXXXXXX.xml", tmpdir) < 0) {
+ vshError(ctl, "%s", _("out of memory"));
+ return NULL;
+ }
fd = mkstemps(ret, 4);
if (fd == -1) {
vshError(ctl, _("mkstemps: failed to create temporary file: %s"),
--
1.7.10.1
12 years, 6 months
[libvirt] [PATCH] Fix check for socket existance / daemon spawn
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
When you try to connect to a socket in the abstract namespace,
the error will be ECONNREFUSED for a non-listening daemon. With
the non-abstract namespace though, you instead get ENOENT. Add
a check for this extra errno when auto-spawning the daemon
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/rpc/virnetsocket.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index fa16d31..0b32ffe 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -502,7 +502,11 @@ int virNetSocketNewConnectUNIX(const char *path,
retry:
if (connect(fd, &remoteAddr.data.sa, remoteAddr.len) < 0) {
- if (errno == ECONNREFUSED && spawnDaemon && retries < 20) {
+ if ((errno == ECONNREFUSED ||
+ errno == ENOENT) &&
+ spawnDaemon && retries < 20) {
+ VIR_DEBUG("Connection refused for %s, trying to spawn %s",
+ path, binary);
if (retries == 0 &&
virNetSocketForkDaemon(binary) < 0)
goto error;
--
1.7.10.1
12 years, 6 months
[libvirt] Compiling Warning
by Alex Jia
Hello Eric,
I met some compiling warning, I'm not sure whether my environment is
dirty, please help confirm them:
*** Warning: Linking the executable qemuxml2argvtest against the
loadable module
*** libvirt_driver_qemu.so is not portable!
*** Warning: Linking the executable qemuxml2argvtest against the
loadable module
*** libvirt_driver_network.so is not portable!
CC qemuxml2xmltest.o
CCLD qemuxml2xmltest
*** Warning: Linking the executable qemuxml2xmltest against the loadable
module
*** libvirt_driver_qemu.so is not portable!
*** Warning: Linking the executable qemuxml2xmltest against the loadable
module
*** libvirt_driver_network.so is not portable!
CC qemuxmlnstest.o
CCLD qemuxmlnstest
*** Warning: Linking the executable qemuxmlnstest against the loadable
module
*** libvirt_driver_qemu.so is not portable!
*** Warning: Linking the executable qemuxmlnstest against the loadable
module
*** libvirt_driver_network.so is not portable!
CC qemuargv2xmltest.o
CCLD qemuargv2xmltest
*** Warning: Linking the executable qemuargv2xmltest against the
loadable module
*** libvirt_driver_qemu.so is not portable!
*** Warning: Linking the executable qemuargv2xmltest against the
loadable module
*** libvirt_driver_network.so is not portable!
CC qemuhelptest.o
CCLD qemuhelptest
*** Warning: Linking the executable qemuhelptest against the loadable module
*** libvirt_driver_qemu.so is not portable!
*** Warning: Linking the executable qemuhelptest against the loadable module
*** libvirt_driver_network.so is not portable!
CC domainsnapshotxml2xmltest.o
CCLD domainsnapshotxml2xmltest
*** Warning: Linking the executable domainsnapshotxml2xmltest against
the loadable module
*** libvirt_driver_qemu.so is not portable!
*** Warning: Linking the executable domainsnapshotxml2xmltest against
the loadable module
*** libvirt_driver_network.so is not portable!
CC qemumonitortest.o
CCLD qemumonitortest
*** Warning: Linking the executable qemumonitortest against the loadable
module
*** libvirt_driver_qemu.so is not portable!
*** Warning: Linking the executable qemumonitortest against the loadable
module
*** libvirt_driver_network.so is not portable!
CC lxcxml2xmltest.o
CC testutilslxc.o
CCLD lxcxml2xmltest
*** Warning: Linking the executable lxcxml2xmltest against the loadable
module
*** libvirt_driver_lxc.so is not portable!
*** Warning: Linking the executable lxcxml2xmltest against the loadable
module
*** libvirt_driver_network.so is not portable!
CC openvzutilstest.o
CCLD openvzutilstest
CC esxutilstest.o
CCLD esxutilstest
CC vmx2xmltest.o
CCLD vmx2xmltest
CC xml2vmxtest.o
CCLD xml2vmxtest
CC jsontest.o
CCLD jsontest
CC networkxml2xmltest.o
CCLD networkxml2xmltest
CC networkxml2argvtest.o
CCLD networkxml2argvtest
*** Warning: Linking the executable networkxml2argvtest against the
loadable module
*** libvirt_driver_network.so is not portable!
Thanks,
Alex
12 years, 6 months
[libvirt] [PATCH] Improve docs about compiling libvirt from GIT
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Add a note about setting the LIBVIRT_DRIVER_DIR env variable,
explain --system and fix example to use --disable-werror
---
docs/compiling.html.in | 51 ++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 47 insertions(+), 4 deletions(-)
diff --git a/docs/compiling.html.in b/docs/compiling.html.in
index 49bc7ee..5a9d9ee 100644
--- a/docs/compiling.html.in
+++ b/docs/compiling.html.in
@@ -62,14 +62,57 @@
<p>
The libvirt build process uses GNU autotools, so after obtaining a
checkout it is necessary to generate the configure script and Makefile.in
- templates using the <code>autogen.sh</code> command, passing the extra
- arguments as for configure. As an example, to do a complete build and
- install it into your home directory run:
+ templates using the <code>autogen.sh</code> command. By default when
+ the <code>confiure</code> script is run from within a GIT checkout, it
+ will turn on -Werror for builds. This can be disabled with --disable-werror,
+ but this is not recommended. To build & install libvirt to your home
+ directory the following commands can be run:
</p>
<pre>
- $ ./autogen.sh --prefix=$HOME/usr --enable-compile-warnings=error
+ $ ./autogen.sh --prefix=$HOME/usr
$ make
$ <b>sudo</b> make install</pre>
+
+ <p>
+ Be aware though, that binaries built with a custom prefix will not
+ interoperate with OS vendor provided binaries, since the UNIX socket
+ paths will all be different. To produce a build that is compatible
+ with normal OS vendor prefixes, using
+ </p>
+
+ <pre>
+ $ ./autogen.sh --system
+ $ make
+ </pre>
+
+ <p>
+ When doing this for day-to-day development purposes, it is recommended
+ not to install over the to OS vendor provided binaries. Instead simply
+ run libvirt directory from the source tree. For example to run
+ a privileged libvirtd instance
+ </p>
+
+ <pre>
+ $ su -
+ # service libvirtd stop (or systemctl stop libvirtd.service)
+ # /home/to/your/checkout/daemon/libvirtd
+ </pre>
+
+ <p>
+ It is also possible to run virsh directly from the source tree
+ </p>
+
+ <pre>
+ $ ./tools/virsh ....
+ </pre>
+
+ <p>
+ A normal configuration of libvirt will build hypervisor drivers
+ as loadable modules. When runnning from a non-installed source
+ tree, libvirtd will attempt to find the modules from the same
+ source tree. If this is not possible though, you can explicitly
+ set <code>LIBVIRT_DRIVER_DIR=/path/to/source/tree/src/.libs</code>
+ </p>
</body>
</html>
--
1.7.10.1
12 years, 6 months
[libvirt] Errors during compilation
by Shradha Shah
Hello All.
I have just pulled all the latest patches in my libvirt git repository. When I try to compile the source I see the following errors:
rpc/virnetclientprogram.c: In function 'virNetClientProgramCall':
rpc/virnetclientprogram.c:295: error: 'VIR_NET_CALL_WITH_FDS' undeclared (first use in this function)
rpc/virnetclientprogram.c:295: error: (Each undeclared identifier is reported only once
rpc/virnetclientprogram.c:295: error: for each function it appears in.)
rpc/virnetclientprogram.c:338: error: 'VIR_NET_REPLY_WITH_FDS' undeclared (first use in this function)
I was wondering if anyone has observed these errors before? What can I do to fix these issues?
Thanks.
--
Many Thanks,
Regards,
Shradha Shah
12 years, 6 months
[libvirt] [PATCH] tests: run valgrind on real executables, not libtool wrappers
by Eric Blake
* tests/Makefile.am (valgrind): Use libtool's ability to bypass
libtool wrappers when running valgrind.
---
I didn't think this was quite trivial enough to push without review.
Now that tests use libtool, we want to be sure to run valgrind on
the actual test, not on the bash shell that libtool uses to fire up
the real test. I also tested that this works even when there is no
libtool wrapper, such as when you disable modules for compilation.
tests/Makefile.am | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c7addde..24818b1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -244,7 +244,7 @@ TESTS_ENVIRONMENT = \
valgrind:
- $(MAKE) check VG="valgrind --quiet --leak-check=full --suppressions=$(srcdir)/.valgrind.supp"
+ $(MAKE) check VG="libtool --mode=execute valgrind --quiet --leak-check=full --suppressions=$(srcdir)/.valgrind.supp"
sockettest_SOURCES = \
sockettest.c \
--
1.7.7.6
12 years, 6 months
[libvirt] [PATCH] qemu augeas: Add spice_tls/spice_tls_x509_cert_dir
by Douglas Schilling Landgraf
If vdsm is installed and configured in Fedora 17, we add the following
items into qemu.conf:
spice_tls=1
spice_tls_x509_cert_dir="/etc/pki/vdsm/libvirt-spice"
However, after this changes, augtool cannot identify qemu.conf anymore.
---
src/qemu/libvirtd_qemu.aug | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index f6cec1f..49587bf 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -35,6 +35,8 @@ module Libvirtd_qemu =
| str_entry "security_driver"
| bool_entry "security_default_confined"
| bool_entry "security_require_confined"
+ | bool_entry "spice_tls"
+ | str_entry "spice_tls_x509_cert_dir"
| str_entry "user"
| str_entry "group"
| bool_entry "dynamic_ownership"
--
1.7.1
12 years, 6 months
[libvirt] [PATCH] tests: back to short test names
by Eric Blake
With the switch to modules by default, I was getting super long
test output:
TEST: /home/remote/eblake/libvirt/tests/.libs/lt-interfacexml2xmltest
compared to the former:
TEST: interfacexml2xmltest
* tests/testutils.c (virtTestMain): Trim off libtool goop.
---
Pushing under the trivial rule.
tests/testutils.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/testutils.c b/tests/testutils.c
index 98595ad..8f2ca51 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -35,6 +35,7 @@
#include "logging.h"
#include "command.h"
#include "virrandom.h"
+#include "dirname.h"
#if TEST_OOM_TRACE
# include <execinfo.h>
@@ -576,9 +577,9 @@ int virtTestMain(int argc,
if (!abs_srcdir)
exit(EXIT_AM_HARDFAIL);
- progname = argv[0];
- if (STRPREFIX(progname, "./"))
- progname += 2;
+ progname = last_component(argv[0]);
+ if (STRPREFIX(progname, "lt-"))
+ progname += 3;
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", argv[0]);
fputs("effective environment variables:\n"
--
1.7.7.6
12 years, 6 months