Re: [Libguestfs] [Qemu-devel] debugging qemu-nbd.c
by Richard W.M. Jones
On Tue, Apr 09, 2013 at 10:18:50AM -0400, Skippy VonDrake wrote:
> Hello,
>
> Apologies upfront if posting to this list is inappropriate.
>
> I have an app that forks a process with calls qemu-nbd with an offset
> into an image.
> The app then uses libguestfs to attach the nbd device.
> But it appears that qemu is failing.
When you say "qemu is failing", do you mean qemu-nbd, or the qemu
subprocess that libguestfs uses? Does it print any error?
> I'm using the latest qemu sources and placed file log statements within
> qemu-nbd.c to pinpoint the problem.
>
> The statement: " if (chdir("/") < 0)"
> appears to be the culprit.
>
> But the subsequent err() call is never reached. If I pull 'chdir' out of
> the 'IF' and assign a local var to its return - execution still seems to
> stop on the 'chdir'. So there is no opportunity to examine its return.
>
> What is the best approach to debugging this section of code?
As a first step I would just add 'fprintf (stderr, ...)' straight into
the qemu-nbd.c file. Or run it under gdb.
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, 7 months
[PATCH] Mac OS X: Link iconv in libhivex
by Alex Nelson
hivexml on OS X was failing with a symbol-not-found error while
dynamically linking. Adding iconv to libhivex fixes the issue and lets
OS X process 'images/large' with hivexml.
It took careful iconv autotool additions to get compilation working in
Fedora as well, but these two lines build and run on OS X 10.6 and
10.8, and Fedora 17 and 18.
Unfortunately, a separate issue is revealed here in OS X, as some of
the hivexml value data appears as Kanji. However, that is an issue
distinct from getting the program to run.
Signed-off-by: Alex Nelson <a.nelson(a)prometheuscomputing.com>
---
configure.ac | 1 +
lib/Makefile.am | 1 +
2 files changed, 2 insertions(+)
diff --git a/configure.ac b/configure.ac
index 0dfb995..298e6a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -184,6 +184,7 @@ AS_IF([test "x$with_readline" != xno],
dnl For i18n.
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.17])
+AM_ICONV
dnl libxml2.
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
diff --git a/lib/Makefile.am b/lib/Makefile.am
index a339a00..8d7ff69 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -36,6 +36,7 @@ libhivex_la_LIBADD = ../gnulib/lib/libgnu.la $(LTLIBOBJS)
libhivex_la_LDFLAGS = \
-version-info 0:0:0 \
$(VERSION_SCRIPT_FLAGS)$(srcdir)/hivex.syms \
+ $(LTLIBICONV) \
$(LTLIBINTL) \
$(LTLIBTHREAD)
libhivex_la_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
--
1.8.2
11 years, 7 months
[PATCH] Remove obsolete AM serial-tests
by Alex Nelson
Per recommendations at:
<
http://www.gnu.org/software/automake/manual/html_node/Serial-Test-Harness...
>
Also per build failure in Fedora 17. Automake v1.11.6.
Signed-off-by: Alex Nelson <a.nelson(a)prometheuscomputing.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 3ce8143..0dfb995 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@ m4_define([hivex_extra], [])
AC_INIT([hivex],hivex_major.hivex_minor.hivex_release[]hivex_extra)
AC_CONFIG_AUX_DIR([build-aux])
-AM_INIT_AUTOMAKE([foreign serial-tests])
+AM_INIT_AUTOMAKE([foreign])
m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
--
1.7.11.7
11 years, 7 months
Unable to convert vm
by Georg Troxler
I am unable to convert a vm using virt-v2v. From the trace and debug
logs I am unable to understand the cause of the problem. I assume it is
a permission or configuration issue but I don't know where to start looking.
The following command was issued:
LIBGUESTFS_TRACE=1 LIBGUESTFS_DEBUG=1 virt-v2v -ic
qemu+ssh://xxx@192.168.xxx.xxx/system -o rhev -os
192.168.xxx.xxx:/mnt/exports -of qcow2 -oa sparse -n ovirtmgmt testvm
virt-v2v version is 0.9.0.
This is the output produced by the command:
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: set_cachedir "/tmp"
libguestfs: trace: set_cachedir = 0
libguestfs: create: flags = 0, handle = 0x473ce90
libguestfs: trace: add_drive
"/tmp/lD0zFfpO0_/0e6f780b-6095-4055-a00d-8579b80ad30b/v2v.yxFHyfAJ/1cf96195-fc6e-4e1f-bd55-e71aef7d21a1/2c475cc1-2dd9-487b-8a06-a6ac75c6b7b9"
"format:qcow2" "iface:ide" "name:vda"
libguestfs: trace: add_drive = 0
libguestfs: trace: add_drive "/tmp/bV8yUVWwXU" "readonly:true"
"format:raw" "iface:ide"
libguestfs: trace: add_drive = 0
libguestfs: trace: set_network true
libguestfs: trace: set_network = 0
libguestfs: trace: launch
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: libvirt version = 10002 (0.10.2)
libguestfs: [00000ms] connect to libvirt
libguestfs: opening libvirt handle: URI = NULL, auth =
virConnectAuthPtrDefault, flags = 0
Please enter your authentication name: root
Please enter your password:
libguestfs: successfully opened libvirt handle: conn = 0x473b490
libguestfs: [2616860ms] get libvirt capabilities
libguestfs: [2617767ms] parsing capabilities XML
libguestfs: [2617768ms] build appliance
libguestfs: command: run: febootstrap-supermin-helper
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ -u 36
libguestfs: command: run: \ -g 36
libguestfs: command: run: \ -f checksum
libguestfs: command: run: \ /usr/lib64/guestfs/supermin.d
libguestfs: command: run: \ x86_64
supermin helper [00001ms] whitelist = (not specified), host_cpu =
x86_64, kernel = (null), initrd = (null), appliance = (null)
supermin helper [00002ms] inputs[0] = /usr/lib64/guestfs/supermin.d
checking modpath /lib/modules/3.8.4-202.fc18.x86_64 is a directory
picked vmlinuz-3.8.4-202.fc18.x86_64 because modpath
/lib/modules/3.8.4-202.fc18.x86_64 exists
supermin helper [00002ms] finished creating kernel
supermin helper [00002ms] visiting /usr/lib64/guestfs/supermin.d
supermin helper [00002ms] visiting /usr/lib64/guestfs/supermin.d/base.img
supermin helper [00002ms] visiting /usr/lib64/guestfs/supermin.d/daemon.img
supermin helper [00002ms] visiting /usr/lib64/guestfs/supermin.d/hostfiles
supermin helper [00035ms] visiting /usr/lib64/guestfs/supermin.d/init.img
supermin helper [00036ms] visiting
/usr/lib64/guestfs/supermin.d/udev-rules.img
supermin helper [00036ms] adding kernel modules
supermin helper [00068ms] finished creating appliance
libguestfs: checksum of existing appliance:
8f00b44cd95de8d4bb0d7dcfe47a3b6b4288db9ca9f5ddf417c91e08924ae699
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/tmp"
libguestfs: command: run: qemu-img
libguestfs: command: run: \ create
libguestfs: command: run: \ -f qcow2
libguestfs: command: run: \ -b /tmp/.guestfs-36/root.4124
libguestfs: command: run: \ -o backing_fmt=raw
libguestfs: command: run: \ /tmp/libguestfsm4E1E4/snapshot1
Formatting '/tmp/libguestfsm4E1E4/snapshot1', fmt=qcow2 size=4294967296
backing_file='/tmp/.guestfs-36/root.4124' backing_fmt='raw'
encryption=off cluster_size=65536 lazy_refcounts=off
libguestfs: command: run: qemu-img
libguestfs: command: run: \ create
libguestfs: command: run: \ -f qcow2
libguestfs: command: run: \ -b /tmp/bV8yUVWwXU
libguestfs: command: run: \ -o backing_fmt=raw
libguestfs: command: run: \ /tmp/libguestfsm4E1E4/snapshot2
Formatting '/tmp/libguestfsm4E1E4/snapshot2', fmt=qcow2 size=446464
backing_file='/tmp/bV8yUVWwXU' backing_fmt='raw' encryption=off
cluster_size=65536 lazy_refcounts=off
libguestfs: [2617890ms] create libvirt XML
libguestfs: trace: launch = -1 (error)
virt-v2v: Failed to launch guestfs appliance. Try running again with
LIBGUESTFS_DEBUG=1 for more information
libguestfs: trace: close
libguestfs: closing guestfs handle 0x473ce90 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsm4E1E4
11 years, 7 months
RHashtable and the python bindings
by Matthew Booth
I've discovered that libguestfs apis which return RHashtable are
currently returned as a list of tuples in the python bindings rather
than the obvious dict. I propose fixing this, whilst also maintaining
API compatibility for a period of time.
The following apis return RHashtable:
inspect_get_mountpoints
list_filesystems
inspect_get_drive_mappings
tune2fs_l
mountpoints
md_detail
blkid
list_disk_labels
I propose the following:
h = guestfs.GuestFS(return_dict=True)
If return_dict is set, any RHashtable api would return a dict rather
than a list of tuples. If not, the behaviour would be unchanged. The
default would be False.
We would advertise immediately that this parameter is recommended for
all new code, and that old code should be updated. At some point in the
future the default would be changed to True, and at some point after
that the old code could be removed.
Matt
11 years, 7 months
missing lvm.conf is fatal
by Olaf Hering
I have a report for 1.20.4 about this error. There is no /etc/lvm/lvm.conf in
the guest, which is handled as fatal error. Creating an emtpy file with that
name is a workaround for the time being.
$ virt-resize --expand /dev/sda2 in.img out.img
Examining in.img ...
Fatal error: exception Guestfs.Error("lvm_set_filter: open: /tmp/lvmiUFSBa/lvm/lvm.conf: No such file or directory")
Maybe the callers of lvm_set_filter or lvm_set_filter itself can be more forgiving.
Olaf
11 years, 7 months
ANNOUNCE: Sys::Guestfs::Lib will be removed
by Richard W.M. Jones
Starting in libguestfs 1.22, the auxiliary Perl library
Sys::Guestfs::Lib will be completely removed from libguestfs.
Historically this library contained the first implementation of
inspection (only available to Perl programs). However in libguestfs
1.5.3 [released August 2010], most of the code was rewritten in C and
included in the core library and available to callers in all
programming languages. virt-v2v was modified to remove the need for
this library two years ago in March 2011.
In the unlikely case there are still callers to this library (outside
of a handful of Perl tools in libguestfs itself), I suggest modifying
the code to use core inspection:
http://libguestfs.org/guestfs.3.html#inspection
or second best would be to copy the Sys::Guestfs::Lib code into your
program, although note this code is very outdated and possibly
insecure.
Note this change will also affect RHEL 7.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
11 years, 7 months
ANNOUNCE: "attach-method" is now "backend"
by Richard W.M. Jones
Starting with libguestfs 1.22, "attach methods" will be known as
"backends" (one word, no space or hyphen). There are new APIs
'guestfs_set_backend', 'guestfs_get_backend', and a new environment
variable 'LIBGUESTFS_BACKEND'.
Furthermore, the default backend, running qemu directly, is now called
"direct" instead of "appliance". (Note that distros can change the
default by compiling with ./configure --with-default-backend=..., and
Fedora does change this to "libvirt").
FWIW there are three backends (same as before):
- direct (a.k.a. appliance): Run qemu directly
- libvirt: Manage the appliance with libvirt
- unix: Connect to a Unix socket (for libguestfs live)
For backwards compatibility, the old APIs continue to be supported,
along with the LIBGUESTFS_ATTACH_METHOD environment variable, and the
synonym "appliance" instead of "direct". Because these are part of
the C API they will be supported forever, but you can get a warning
about using them by compiling with -DGUESTFS_WARN_DEPRECATED=1.
See this large but mostly mechanical patch:
https://github.com/libguestfs/libguestfs/commit/68990840b64491b39ab8da5f1...
Also note this change will be included in RHEL 7.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
11 years, 7 months