build failures due to missing rpl_optarg
by Olaf Hering
For some reason 1.20.2 fails to link in openSuSE 11.4 and older, 1.20.1 did not
have this issue.
...
CCLD libguestfs-test-tool
libguestfs_test_tool-test-tool.o: In function `main':
test-tool.c:(.text+0x11f): undefined reference to `rpl_getopt_long'
test-tool.c:(.text+0x170): undefined reference to `rpl_optarg'
test-tool.c:(.text+0x281): undefined reference to `rpl_optarg'
test-tool.c:(.text+0x2b2): undefined reference to `rpl_optarg'
test-tool.c:(.text+0x2ea): undefined reference to `rpl_optarg'
test-tool.c:(.text+0xd7e): undefined reference to `rpl_perror'
test-tool.c:(.text+0xd96): undefined reference to `rpl_perror'
test-tool.c:(.text+0xdcb): undefined reference to `rpl_perror'
test-tool.c:(.text+0xe97): undefined reference to `rpl_perror'
collect2: ld returned 1 exit status
make[2]: *** [libguestfs-test-tool] Error 1
...
Olaf
11 years, 9 months
[PATCH] lib: avoid pragma usage in inspect-fs-windows
by Olaf Hering
pragma GCC diagnostic is a gcc 4.6+ feature, compilation fails with
older compilers:
inspect-fs-windows.c: In function 'map_registry_disk_blob':
inspect-fs-windows.c:502: error: #pragma GCC diagnostic not allowed inside functions
inspect-fs-windows.c:503: error: #pragma GCC diagnostic not allowed inside functions
inspect-fs-windows.c:505: error: #pragma GCC diagnostic not allowed inside functions
make[3]: *** [libguestfs_la-inspect-fs-windows.lo] Error 1
Use memcpy instead of pragma to fix compile error.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
Not compile tested!
src/inspect-fs-windows.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/inspect-fs-windows.c b/src/inspect-fs-windows.c
index 346cc55..68ae97c 100644
--- a/src/inspect-fs-windows.c
+++ b/src/inspect-fs-windows.c
@@ -499,10 +499,8 @@ map_registry_disk_blob (guestfs_h *g, const void *blob)
* Note deliberate cast-align violation here since the data is in a
* very odd place within the blob. Thanks Microsoft!
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wcast-align"
- part_offset = le64toh (* (uint64_t *) ((char *) blob + 4));
-#pragma GCC diagnostic pop
+ memcpy(&part_offset, (char *) blob + 4, sizeof(part_offset));
+ part_offset = le64toh (part_offset);
partitions = guestfs_part_list (g, devices[i]);
if (partitions == NULL)
11 years, 9 months
Fedora 18, virt-manager & libguestfs SELinux relabelling problem
by Richard W.M. Jones
I just want to bring everyone's attention this important bug in
Fedora 18. It looks like people are now starting to upgrade to F18
and are hitting this bug.
https://bugzilla.redhat.com/show_bug.cgi?id=912499
In brief, when virt-manager runs, it starts some libguestfs instances
in the background to inspect guests. Starting with Fedora 18 these
use libvirt and because of a bad interaction between libguestfs &
libvirt this causes the guest disks to get [SELinux] relabelled which
suddenly prevents the guests from accessing their own disks.
This will only affect you if SELinux is set to Enforcing.
You may also see the same problem if you use read-only tools on
running guests, such as virt-df, virt-inspector, virt-cat, etc.,
as root.
There are two workarounds possible in the short term:
(1) To continue using libguestfs to inspect disks, ensure the
following environment variable is set everywhere:
export LIBGUESTFS_ATTACH_METHOD=appliance
(eg. by putting that line into /etc/profile.d/local.sh and logging
out).
Note that this disables sVirt protection in libguestfs, even if
SELinux is enabled.
(2) OR do:
yum uninstall python-libguestfs
This will disable the inspection features of virt-manager.
I intend to fix the bug by modifying how it uses libvirt, and to push
an updated libguestfs package to Fedora 18, but that will take a few weeks.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
11 years, 9 months
[PATCH] build: Only add 'serial-tests' for automake >= 1.12.
by Richard W.M. Jones
From: "Richard W.M. Jones" <rjones(a)redhat.com>
Earlier versions of automake complain if they get a configuration
parameter which they don't understand. The error is:
configure.ac:27: error: option 'serial-tests' not recognized
Use some m4 hackery to work around this.
---
configure.ac | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 105b2e7..b0158c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,21 @@ m4_define([libguestfs_release], [11])
AC_INIT([libguestfs],libguestfs_major.libguestfs_minor.libguestfs_release)
AC_CONFIG_AUX_DIR([build-aux])
-AM_INIT_AUTOMAKE([foreign serial-tests])
+
+dnl Initialize automake. automake < 1.12 didn't have serial-tests and
+dnl gives an error if it sees this, but for automake >= 1.13
+dnl serial-tests is required so we have to include it. Solution is to
+dnl test for the version of automake (by running an external command)
+dnl and provide it if necessary. Note we have to do this entirely using
+dnl m4 macros since automake queries this macro by running
+dnl 'autoconf --trace ...'.
+m4_define([serial_tests], [
+ m4_esyscmd([automake --version |
+ head -1 |
+ awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}'
+ ])
+])
+AM_INIT_AUTOMAKE(foreign serial_tests) dnl NB: Do not [quote] this parameter.
m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
--
1.8.1.2
11 years, 9 months
[PATCH for discussion only 0/3] Implement mutexes to limit number of concurrent instances of libguestfs.
by Richard W.M. Jones
These three patches (for discussion only, NOT to be applied) implement
a mutex system that lets the user limit the number of libguestfs
instances that can be launched per host. There are two uses that I
have identified for this: firstly so we can enable parallel-tests (the
default in automake >= 1.13) without blowing up the host. Secondly
oVirt has raised concerns about how to limit the number of libguestfs
appliances that can run to prevent this from interfering with their
ordinary guests.
The mutex is easy to use: You specify a POSIX semaphore file and the
maximum number of instances you want to allow to run at the same time,
eg:
LIBGUESTFS_MUTEX_FILE=/guestfs.mutex
LIBGUESTFS_MUTEX_LIMIT=3
export LIBGUESTFS_MUTEX_FILE LIBGUESTFS_MUTEX_LIMIT
As long as each handle has the same settings, the limit is applied
transparently, with handles over the limit waiting for earlier ones to
finish. (These can of course also be set through the API). There is
also a way to have libguestfs choose a suitable limit for you, and the
system is entirely optional so that *not* setting these variables
results in no limits -- ie. the same as current behaviour.
Unfortunately this doesn't quite work because the design of POSIX
semaphores is a slightly braindead. It's not possible to have the
semaphore be automatically recovered if the process crashes. See:
http://stackoverflow.com/questions/2053679/how-do-i-recover-a-semaphore-w...
As a result when you try to run the tests you'll find that the
semaphore count slowly creeps up until the test suite stops running.
In any case, POSIX semaphores are annoying in other ways; for example
they don't live in the true filesystem, but in their own separate
namespace (exposed under /dev/shm).
To get around this I'll have to reimplement this using filesystem
locks.
Rich.
11 years, 9 months
Sheepdog support in libguestfs (was: Re: About features of libguestfs)
by Richard W.M. Jones
On Mon, Feb 18, 2013 at 11:28:47AM +0800, Edwin Cen wrote:
> I wonder if libguestfs supports sheepdog which means if I can inject
> some config info into virtual machine built on sheepdog with
> libgeustfs or not? If the current version cannot support it can I
> change something to make it happen?
It's likely that sheepdog could be made to work, and adding support
would probably be simple (particularly using the libvirt backend,
since libvirt already supports it). However I have never tried it.
You would have to modify src/launch-libvirt.c so that it can create
sheepdog pools and/or volumes:
http://libvirt.org/storage.html#StorageBackendSheepdog
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
11 years, 9 months
Remaining btrfs patches
by Matthew Booth
[PATCH 1/7] mount: Add mount_vfs_nochroot
This is significantly reworked from before. umount is gone as
discussed, and variable motion is minimised.
[PATCH 2/7] btrfs: Update btrfs_subvolume_list to take
Already provisionally ACKed. Previous comment was that cleanup could
be tidier. I looked into creating a new cleanup function for fs_buf,
but it isn't possible (or simple, anyway) in this case for 2 reasons:
1. You'd need 2 arguments passed to the cleanup function, not one.
Without fs->type you don't know whether fs_buf has been mounted or
not.
2. You can't catch and report an error.
[PATCH 3/7] mountable: Make list-filesystems return btrfsvols
Already provisionally ACKed.
[PATCH 4/7] New internal API: internal_parse_mountable
[PATCH 5/7] inspect: Update inspect_os to use mountables
[PATCH 6/7] btrfs: Make a stub Fedora btrfs guest for inspection
[PATCH 7/7] mountable: Test inspection of fedora image
Not previously reviewed.
11 years, 9 months
Compiling Error on Debian Wheezy
by Michael Beham
Hi all,
I am getting following error during compilation of libguestfs 1.18.5 on
Debian Wheezy:
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define PACKAGE "libguestfs"
#define VERSION "1.18.5"
#define PACKAGE_VERSION_MAJOR 1
#define PACKAGE_VERSION_MINOR 18
#define PACKAGE_VERSION_RELEASE 5
#define PACKAGE_VERSION_EXTRA ""
configure: exit 77
Any idea?
Cheers,
Mike
11 years, 9 months