Re: [Libguestfs] regression: file does not understand the -S option

2023-09-21 Thread Olaf Hering
Thu, 21 Sep 2023 10:21:41 +0200 Laszlo Ersek :

> Does your error output contain
>   file: invalid option -- 'S'
> ?

Yes, it looks like this:
# /usr/bin/env -i /usr/bin/file -S
/usr/bin/file: invalid option -- 'S'
Usage: file [-bcEhikLlNnprsvzZ0] [--apple] [--extension] [--mime-encoding] 
[--mime-type]
[-e testname] [-F separator] [-f namefile] [-m magicfiles] file ...
   file -C [-m magicfiles]
   file [--help]


Olaf


pgpKM1Gr88hFg.pgp
Description: Digitale Signatur von OpenPGP
___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] regression: file does not understand the -S option

2023-09-20 Thread Olaf Hering
Recently a commit was added to call 'file -zSb' instead of 'file -zb'.

This causes a regression on Leap 15 (but not on Tumbleweed), because
file 5.32 does not understand the -S option.

How can this be fixed properly, to handle both cases either at runtime
or at buildtime?


Thanks,
Olaf


pgpMhlA2iYpCT.pgp
Description: Digitale Signatur von OpenPGP
___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH v1] docs: domain: document legacy audio for qemu

2022-01-12 Thread Olaf Hering
Wed, 12 Jan 2022 13:32:23 +0100 Laszlo Ersek :

> should have been sent to the libvirt mailing list

Indeed, sorry for not paying attention.

Olaf


pgpjwlKFqkQUP.pgp
Description: Digitale Signatur von OpenPGP
___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

[Libguestfs] [PATCH v1] docs: domain: document legacy audio for qemu

2022-01-12 Thread Olaf Hering
Adding a blurb like this was forgotten in 2009.

Signed-off-by: Olaf Hering 
---
 docs/formatdomain.rst | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index d4f30bb8af..f07ea34232 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -7079,6 +7079,20 @@ is permitted with the following attributes.
   The audio format, one of ``s8``, ``u8``, ``s16``, ``u16``,
   ``s32``, ``u32``, ``f32``. The default is hypervisor specific.
 
+Note:
+If no  element is defined, and the ``graphics`` element is set to
+either 'vnc' or 'sdl', the libvirtd or virtqemud process will honor the 
following
+environment variables:
+
+* ``SDL_AUDIODRIVER``
+
+  Valid values are 'pulseaudio', 'esd', 'alsa' or 'arts'.
+
+* ``QEMU_AUDIO_DRV``
+
+  Valid values are 'pa', 'pulseaudio', 'none', 'alsa', 'coreaudio', 'jack',
+  'oss', 'sdl', 'spice' or 'file'.
+
 None audio backend
 ^^
 

___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs



[Libguestfs] [PATCH v1] appliance: reorder mounting of special filesystems in init

2021-09-15 Thread Olaf Hering
Make sure proc and dev are available early.
No change in behavior intended.

Signed-off-by: Olaf Hering 
---
 appliance/init | 36 +++-
 1 file changed, 15 insertions(+), 21 deletions(-)

diff --git a/appliance/init b/appliance/init
index cdc39c3b9..7076821d2 100755
--- a/appliance/init
+++ b/appliance/init
@@ -27,12 +27,12 @@ for d in /lib64 /lib; do
   fi
 done
 
-mkdir -p /sysroot
-
-# Mount /proc.
-if [ ! -d /proc ]; then rm -f /proc; fi
-mkdir -p /proc
+mkdir -p /proc /sys
 mount -t proc /proc /proc
+mount -t sysfs /sys /sys
+# devtmpfs is required since udev 176
+mount -t devtmpfs /dev /dev
+ln -s /proc/self/fd /dev/fd
 
 # Parse the kernel command line early (must be after /proc is mounted).
 cmdline=$(https://listman.redhat.com/mailman/listinfo/libguestfs



[Libguestfs] [PATCH v1] appliance: enable bash's Process Substitution feature

2021-09-15 Thread Olaf Hering
bash can read input from a spawned process, and even provide input to
such process. This feature relies on /dev/fd/ being present. In the
past udev silently created this symlink, so this bash feature worked
more or less by accident. With recent systemd versions, such as 246
which is included in Leap 15.3, the symlink is not created anymore. As
a result scripts, such as /sbin/dhclient-script, fail to work
properly.

This symlink should have been created in version 1 of this variant of /init.

https://bugzilla.opensuse.org/show_bug.cgi?id=1190501

Signed-off-by: Olaf Hering 
---
 appliance/init | 1 +
 1 file changed, 1 insertion(+)

diff --git a/appliance/init b/appliance/init
index b1c4d09ea..cdc39c3b9 100755
--- a/appliance/init
+++ b/appliance/init
@@ -72,6 +72,7 @@ fi
 
 # devtmpfs is required since udev 176
 mount -t devtmpfs /dev /dev
+ln -s /proc/self/fd /dev/fd
 mkdir -p /dev/pts
 mount -t devpts /dev/pts /dev/pts
 mkdir -p /dev/shm

___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs



[Libguestfs] [PATCH v1] appliance: add reboot and netconfig for SUSE

2021-09-14 Thread Olaf Hering
systemd-sysvinit contains the reboot command, which is used to
properly stop the VM. This was required by other packages, and as a
result always available. Since Leap 15.3 it will not be installed, and
as a result the VM will just panic because /init died.

If the appliance is started with --network, dhclient will run
/usr/sbin/dhclient-script, which in turn may call /sbin/netconfig to
update /etc/resolv.conf. Install sysconfig-netconfig to make sure DNS
resolving actually works.

Signed-off-by: Olaf Hering 
---
 appliance/packagelist.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/appliance/packagelist.in b/appliance/packagelist.in
index d0c4f52c6..77a07acc6 100644
--- a/appliance/packagelist.in
+++ b/appliance/packagelist.in
@@ -131,7 +131,9 @@ ifelse(SUSE,1,
   ntfs-3g
   reiserfs
   squashfs
+  sysconfig-netconfig
   systemd
+  systemd-sysvinit
   vim
   xz
 )

___
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs



Re: [Libguestfs] [PATCH 0/2] daemon: Replace GUESTFSD_EXT_CMD with --print-external-commands.

2017-07-27 Thread Olaf Hering
On Thu, Jul 27, Richard W.M. Jones wrote:

> Shall we just remove all this?

If there is no usecase anymore, go ahead.

Olaf


signature.asc
Description: PGP signature
___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

Re: [Libguestfs] [PATCH 0/2] daemon: Replace GUESTFSD_EXT_CMD with --print-external-commands.

2017-07-27 Thread Olaf Hering
On Thu, Jul 27, Richard W.M. Jones wrote:

> It is used:
> https://build.opensuse.org/package/view_file/openSUSE:Factory/libguestfs/libguestfs.spec?rev=7

This is rev#7, which is not the latest.

Olaf


signature.asc
Description: PGP signature
___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

Re: [Libguestfs] [PATCH] listfs: ignore the default btrfs subvolume

2016-02-25 Thread Olaf Hering
On Thu, Feb 25, Richard W.M. Jones wrote:

> Was there an RHBZ# for this?  Can't seem to find it ...

Maybe it helps to improve btrfs support. As stated earlier, btrfs is a
container of things instead of a plain filesystem. Its unfortunate that
the default subvolume was invented, its perhaps just there to make it
look like a filesystem.

The bug number is https://bugzilla.suse.com/show_bug.cgi?id=900346

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] inspect: try to use /etc/os-release on Linux guests

2015-09-09 Thread Olaf Hering
Just poked around in my =libguestfs folder...

On Wed, Sep 09, Pino Toscano wrote:

> +if (STRPREFIX (line, "ID=")) {

This is not handled:

NAME="SLES"
VERSION="12"
VERSION_ID="12"
PRETTY_NAME="SUSE Linux Enterprise Server 12"
ID="sles"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:12"

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] inspect: try to use /etc/os-release on Linux guests

2015-09-09 Thread Olaf Hering
On Wed, Sep 09, Pino Toscano wrote:

> - the content of /etc/SuSE-release

SUSE Linux Enterprise Server 12 (x86_64)
VERSION = 12
PATCHLEVEL = 0
# This file is deprecated and will be removed in a future service pack or 
release.
# Please check /etc/os-release for details about this release.

> - the XML outout of `virt-inspector -a $img`


  
/dev/sda3
linux   
x86_64  
sles
SUSE Linux Enterprise Server 12 (x86_64)
12
0
rpm
zypper
linux-luwo.site
installed

  /
  /opt
  /srv
  /tmp
  /home
  /var/log
  /var/opt
  /var/tmp
  /boot/efi
  /usr/local
  /var/crash
  /var/spool
  /var/lib/named
  /var/lib/pgsql
  /var/lib/mailman
  /boot/grub2/i386-pc
  /boot/grub2/x86_64-efi

...

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] missing btrfs subvol support

2015-09-09 Thread Olaf Hering
On Fri, Oct 10, Olaf Hering wrote:

> Is btrfs subvol support failing just for me?


This is an old thread, and it seems the underlying bug is not fixed
because guestfs takes the wrong approach, IMO.

>From how I understand btrfs, it has the concept of subvolumes. Each one
is an entry point for a separate filesystem. In addition to that it has
a default subvol which is used if no specific subvolume is specified.
This turns the whole btrfs partition (or assembled blockdevice) into a
container of individual filesystems.

But guestfs, as far as I understand it, just mounts the btrfs filesystem
with the default subvolume and ends up somewhere. Then it tries to make
sense of the other subvolumes based on info from a /etc/fstab, which may
or may not exist.  This looks like the wrong approach.

Shouldnt it instead handle the whole thing as a container, just as it
does for an individual disk? First do something like mount subvolid=0,
poke around there and collect the items (sub list -a). Then use all this
info to see which one might be one of the many root filesystems?


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] make install of ocaml libs fails

2014-10-21 Thread Olaf Hering
On Mon, Oct 20, Richard W.M. Jones wrote:

 I can understand why this happens: ocamlfind install will see that
 /usr/lib64/ocaml/guestfs already contains the installed package, and
 refuse to install it on top.

One day I will try to understand what the ocaml folks think when they do
installations...

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] missing btrfs subvol support

2014-10-17 Thread Olaf Hering
On Thu, Oct 16, Olaf Hering wrote:

 I can probably add a check somewhere to catch the whatever==@. A
 better fix would be to check if a given subvolume is for the entire
 partition.

So after talking to David Sterba there is no way to tell if a given
subvolume is for the entire partition.
Also my attempt to fix it by using the -o option is unreliable.

Richard, so what should be done with the root-partition-listed-twice
issue mentioned in the URL above? Just check for a plain '@', assume
thats the entire thing, and skip it to not set is_root=1?

The other bug is that mounting subvolumes in such setup fails anyway
because the subvol= argument lacks the absolute path. It was suggested
to use the subvolume list option -a and tweak the resulting list.
There is a FS_TREE prefix, which shouldnt be there according to David.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] missing btrfs subvol support

2014-10-17 Thread Olaf Hering
On Fri, Oct 17, Pino Toscano wrote:

 On Friday 17 October 2014 11:25:03 Olaf Hering wrote:
  On Thu, Oct 16, Olaf Hering wrote:
   I can probably add a check somewhere to catch the whatever==@. A
   better fix would be to check if a given subvolume is for the entire
   partition.
  
  So after talking to David Sterba there is no way to tell if a given
  subvolume is for the entire partition.
  Also my attempt to fix it by using the -o option is unreliable.
  
  Richard, so what should be done with the root-partition-listed-twice
  issue mentioned in the URL above? Just check for a plain '@', assume
  thats the entire thing, and skip it to not set is_root=1?
 
 Is '@' a particular marker for this situation? Or, from what I get, 
 there can be any label for this?

Its my understanding that the subvolume name can be everything.

  The other bug is that mounting subvolumes in such setup fails anyway
  because the subvol= argument lacks the absolute path. It was suggested
  to use the subvolume list option -a and tweak the resulting list.
  There is a FS_TREE prefix, which shouldnt be there according to
  David.
 
 Do you have a way to reproduce the above situation (and possibly the 
 root-partition-listed-twice situation too)? I'm not too familiar with 
 btrfs yet, and my couple of simple installation of the latest beta of 
 openSUSE 13.2 didn't get me that.

Right, because there is no subvolume for /. Only SLE12 is using that,
and appearently Ubuntu if I understand the conversion back in April
correctly.

I was told that it should be possible to have subvolumes named like
os1, os2, osN where each one would be a root filesystem. Now the
interesting case is what happens with the entire partition. Does it get
its own subvolume or will each of those installations go into their own
subvolume right away? If they do the partition will have no files that
would trigger is_root=1. I guess all these subvolumes will be discovered
anyway and each one will get the is_root flag set, leading to the
mutli-boot case. Thats fine because the given disk/partition is indeed
multi-boot on purpose.

So the bottom line is that there is room for improvement if a given
btrfs partition has indeed multiple root subvolumes. I think to cover
these cases the list command has to be called with -a. And there has to
be a way to specify which subvolume to work with. Maybe guestfish can
already do that, no idea.

However, it would be nice if the common case of single subvolume @
would be handled out of the box, so that virt-ls and others work out of
the box.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] make install of ocaml libs fails

2014-10-16 Thread Olaf Hering

Today I did it, for the very first time:
Did not build a package. Just ran make install. Twice!

...
ocamlfind install \
  -ldconf ignore -destdir /usr/lib64/ocaml \
  guestfs \
  META *.so *.a *.cma *.cmi ./*.mli *.cmx *.cmxa
ocamlfind: Package guestfs is already installed
 - (file /usr/lib64/ocaml/guestfs/META already exists)
Makefile:2053: recipe for target 'install-data-hook' failed
make[3]: *** [install-data-hook] Error 2

I wonder if that is failing just for my version of ocamlfind or if this
is a common failure. How do you guys handle that situation?


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] missing btrfs subvol support

2014-10-16 Thread Olaf Hering
On Fri, Oct 10, Mike Latimer wrote:

 On Friday, October 10, 2014 03:07:51 PM Olaf Hering wrote:
  Thanks for the pointers. I will poke around. At least augtool on the
  host seems to behave correctly:
 
 I don't think this is related to Augeas. Instead, I think it's the naming 
 convention SUSE uses for the root btrfs subvolume (@).

It does not look like its the naming convention. Insteads its the fact
that a given subvolume is for the entire root filesystem. So both sda2
and also the 'whatever' subvolume get -is_root=1.

I can probably add a check somewhere to catch the whatever==@. A
better fix would be to check if a given subvolume is for the entire
partition.

Furthermore there are appearent bugs in the subvolume parser. Will send
a patch to fix one of them shortly.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH] btrfs: list only subvolumes below path

2014-10-16 Thread Olaf Hering
The current code does not cover all subvolume variants. If a subvolume
exists which covers the entire root filesystem the result is two
mountables that have is_root set. This leads to failures in virt-ls and
other tools because they work only with a single root.

Update the btrfs subvolume call to use the -o option. This fixes two
cases: first it skips the subvolume for the root filesystem, so the
virt-ls case is covered. Second case is failure of mount(1) in
guestfs___check_for_filesystem_on. Without this change the subvol would
be a relative path, which causes mount(1) to return with ENOENT.

The option -o changes the output to print path as absolute:

 rescue btrfs subvolume list  /sysroot/
ID 257 gen 135 top level 5 path @
ID 258 gen 124 top level 257 path boot/grub2/i386-pc

vs.

 rescue btrfs subvolume list -o /sysroot/
ID 258 gen 124 top level 257 path @/boot/grub2/i386-pc

mount -osubvol=boot/grub2/i386-pc $dev /sysroot will fail, while
mount -osubvol=@/boot/grub2/i386-pc $dev /sysroot will succeed.

Signed-off-by: Olaf Hering o...@aepfle.de
---
 daemon/btrfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 7a4d43d..3aceffc 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -356,6 +356,7 @@ do_btrfs_subvolume_list (const mountable_t *fs)
 ADD_ARG (argv, i, str_btrfs);
 ADD_ARG (argv, i, subvolume);
 ADD_ARG (argv, i, list);
+ADD_ARG (argv, i, -o);
 ADD_ARG (argv, i, fs_buf);
 ADD_ARG (argv, i, NULL);
 
@@ -399,7 +400,7 @@ do_btrfs_subvolume_list (const mountable_t *fs)
* updated.
* top level n is the top level subvolume ID.
* path str is the subvolume path, relative to the top of the
-   * filesystem.
+   * filesystem. Using the option -o will print the absolute path.
*
* Note that the order that each of the above is fixed, but
* different versions of btrfs may display different sets of data.

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] missing btrfs subvol support

2014-10-13 Thread Olaf Hering
On Fri, Oct 10, Richard W.M. Jones wrote:

 We use Augeas to parse the /etc/fstab btrfs entries, see
 src/inspect-fs-unix.c: check_fstab:
 
 https://github.com/libguestfs/libguestfs/blob/master/src/inspect-fs-unix.c#L1089
 
 And we then pass the subvol back to the mount command in
 daemon/mount.c (which doesn't alter it).
 
 https://github.com/libguestfs/libguestfs/blob/master/daemon/mount.c#L154

Something between add_fstab_entry and the actual mount call removes the
'@/'. My debug() shows:

add_fstab_entry(1048): fstab: mountable=btrfsvol:/dev/sda2/@/var/spool 
mountpoint=/var/spool
libguestfs: check_for_filesystem_on: btrfsvol:/dev/sda2/var/spool (btrfs)

So 'fs-fstab[].mountable' gets tweaked somewhere.


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] missing btrfs subvol support

2014-10-10 Thread Olaf Hering

Is btrfs subvol support failing just for me? Looks like nothing adds the
required '@/' string. virt-ls uses the first variant of the command:

rescue mount -vo subvol=var/spool,ro /dev/sda2 /sysroot/
[  113.852047] BTRFS info (device sda2): disk space caching is enabled
[  113.852869] BTRFS: has skinny extents
mount: mount(2) failed: No such file or directory
rescue mount -vo subvol=@var/spool,ro /dev/sda2 /sysroot/
[  116.082642] BTRFS info (device sda2): disk space caching is enabled
[  116.083476] BTRFS: has skinny extents
mount: mount(2) failed: No such file or directory
rescue mount -vo subvol=@/var/spool,ro /dev/sda2 /sysroot/
[  123.995343] BTRFS info (device sda2): disk space caching is enabled
[  123.996238] BTRFS: has skinny extents
mount: /dev/sda2 mounted on /sysroot.
rescue exit

fstab is:
UUID=d538a81f-9778-424d-96cc-e48dd2d4a323 swap swap defaults
  0 0
UUID=65b72f12-eccb-4cf2-a4f4-9c4bb462456f /btrfs defaults   
   0 0
UUID=65b72f12-eccb-4cf2-a4f4-9c4bb462456f /var/spool   btrfs 
subvol=@/var/spool0 0


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] missing btrfs subvol support

2014-10-10 Thread Olaf Hering
On Fri, Oct 10, Richard W.M. Jones wrote:

 My guess is that the last one (opt/value) will be different for you.

Thanks for the pointers. I will poke around. At least augtool on the
host seems to behave correctly:

olaf@bax:~ $ cd /dev/shm/$$
bash: cd: /dev/shm/3570: Datei oder Verzeichnis nicht gefunden
olaf@bax:~ $ mkdir $_
olaf@bax:~ $ cd $_
olaf@bax:/dev/shm/3570 $ mkdir etc
olaf@bax:/dev/shm/3570 $ cat  etc/fstab
UUID=d538a81f-9778-424d-96cc-e48dd2d4a323 swap swap defaults
  0 0
UUID=65b72f12-eccb-4cf2-a4f4-9c4bb462456f /btrfs defaults   
   0 0
UUID=65b72f12-eccb-4cf2-a4f4-9c4bb462456f /var/spool   btrfs 
subvol=@/var/spool0 0
olaf@bax:/dev/shm/3570 $ augtool -r $PWD
augtool ls /files/etc/fstab/3/vfstype
augtool get /files/etc/fstab/3/vfstype
/files/etc/fstab/3/vfstype = btrfs
augtool get /files/etc/fstab/3/opt/value
/files/etc/fstab/3/opt/value = @/var/spool
augtool

I will poke around to see what I find.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] Plan for libguestfs 1.28

2014-10-09 Thread Olaf Hering
On Tue, Oct 07, Richard W.M. Jones wrote:

 It has been an amazing 6½ months since the last stable release of
 libguestfs.
 
 I'd like to plan a new 1.28 release soon.
 
 Please follow-up if there are features / blockers / bugs that need to
 be addressed for 1.28.

I see master failing in my SLE11 builds since some time. Currently it
fails with a syntax error. Are bison-2.3 of flex-2.5.35 too old?

Olaf

...
[  413s] make[2]: Leaving directory 
`/usr/src/packages/BUILD/libguestfs-1.27.60/builder'
[  413s] make[2]: Entering directory 
`/usr/src/packages/BUILD/libguestfs-1.27.60/builder'
[  413s] make index-parse.h
[  413s]   YACC index-parse.c
[  413s]   CC   virt_index_validate-index-struct.o
[  413s]   CC   index-struct.o
[  413s] make[3]: Entering directory 
`/usr/src/packages/BUILD/libguestfs-1.27.60/builder'
[  413s] make index-parse.h
[  413s] 
/usr/src/packages/BUILD/libguestfs-1.27.60/builder/index-parse.y:60.1-5: 
invalid directive: `%code'
[  413s] 
/usr/src/packages/BUILD/libguestfs-1.27.60/builder/index-parse.y:60.7-14: 
syntax error, unexpected identifier
[  413s] make[2]: *** [index-parse.c] Error 1
[  413s] make[2]: *** Waiting for unfinished jobs
[  413s] make[4]: Entering directory 
`/usr/src/packages/BUILD/libguestfs-1.27.60/builder'
[  413s] make index-parse.h
[  413s] make[5]: Entering directory 
`/usr/src/packages/BUILD/libguestfs-1.27.60/builder'
[  413s] make index-parse.h
[  413s] make[6]: Entering directory 
`/usr/src/packages/BUILD/libguestfs-1.27.60/builder'
[  413s] make index-parse.h
[  413s] make[7]: Entering directory 
`/usr/src/packages/BUILD/libguestfs-1.27.60/builder'
[  413s] make index-parse.h
[  413s] make[8]: Entering directory 
`/usr/src/packages/BUILD/libguestfs-1.27.60/builder'
[  413s] make index-parse.h
...

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

Re: [Libguestfs] Plan for libguestfs 1.28

2014-10-09 Thread Olaf Hering
On Thu, Oct 09, Olaf Hering wrote:

 I see master failing in my SLE11 builds since some time. Currently it
 fails with a syntax error. Are bison-2.3 of flex-2.5.35 too old?

The last successful build was 1.27.9, next commit was 1.27.46.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] Plan for libguestfs 1.28

2014-10-09 Thread Olaf Hering
On Thu, Oct 09, Richard W.M. Jones wrote:

 Is there a chance of using a newer version of bison?  The alternative
 might be to see if reverting that patch still works, and carrying the
 revert as a downstream patch.

I will try to build a copy of bison before starting libguestfs, that
should cure the error.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH v2 1/4] appliance: Use dhclient instead of hard-coding IP address of appliance.

2014-10-02 Thread Olaf Hering
On Thu, Oct 02, Richard W.M. Jones wrote:

 +if grep -sq guestfs_network=1 /proc/cmdline; then
 +dhclient
 +fi

dhclient will be missing at least in openSUSE. Not an issue now, does
the script fail if the command fails to execute due to ENOENT?

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH v2 1/4] appliance: Use dhclient instead of hard-coding IP address of appliance.

2014-10-02 Thread Olaf Hering
On Thu, Oct 02, Richard W.M. Jones wrote:

 The script won't fail, but the network won't work.  What's the
 alternative on SuSE?

I think that would be dhcpcd, which is also used by NetworkManager.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH v2 1/4] appliance: Use dhclient instead of hard-coding IP address of appliance.

2014-10-02 Thread Olaf Hering
On Thu, Oct 02, Richard W.M. Jones wrote:

 It seems as if it would, from reading the dhcpcd man page ..

Looks like the syntax is 'dhcpcd interface'.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH v2 1/4] appliance: Use dhclient instead of hard-coding IP address of appliance.

2014-10-02 Thread Olaf Hering
On Thu, Oct 02, Richard W.M. Jones wrote:

 I'm mainly worried that we won't know how interfaces are named,
 although the old code assumed eth0 and appeared to work until now.

Yes. And if the appliance is booted with net.ifnames=0, or whatever
keeps systemd out of the picture, the name will be predictable.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH v2 1/4] appliance: Use dhclient instead of hard-coding IP address of appliance.

2014-10-02 Thread Olaf Hering
On Thu, Oct 02, Olaf Hering wrote:

 On Thu, Oct 02, Richard W.M. Jones wrote:
 
  The script won't fail, but the network won't work.  What's the
  alternative on SuSE?
 I think that would be dhcpcd, which is also used by NetworkManager.

Scratch that. At least in SLED12 dhclient comes from dhcp-client.rpm.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] Xen drivers for virt-builder images

2014-06-12 Thread Olaf Hering
On Thu, Jun 12, Richard W.M. Jones wrote:

 dracut --add-drivers some list of xen kmods ...

Whatever you do: please use modaliases like 'xen:vbd xen:vif' or
whatever the actual name is.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] new warnings in hivex-1.3.10

2014-05-13 Thread Olaf Hering

hivex-1.3.10 does not pass the sles11sp3 post-build-checks anymore,
1.3.8 was still ok. The relevant output is:

...
[   57s] Hivex.xs: In function 'XS_Win__Hivex_node_name':
[   57s] Hivex.xs:236: warning: implicit declaration of function 'newSVpvn_utf8'
[   57s] Hivex.xs:236: warning: assignment makes pointer from integer without a 
cast
[   57s] Hivex.xs: In function 'XS_Win__Hivex_value_key':
[   57s] Hivex.xs:384: warning: assignment makes pointer from integer without a 
cast
[   57s] Hivex.xs: In function 'XS_Win__Hivex_value_data_cell_offset':
[   57s] Hivex.xs:448: warning: too many arguments for format
...
[  155s] E: hivex 64bit-portability-issue Hivex.xs:236, 384
...

How can this be fixed? I'm not seeing this in openSUSE 12.x.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH supermin v4] Supermin 5 rewrite.

2014-03-28 Thread Olaf Hering
On Tue, Feb 25, Richard W.M. Jones wrote:

  configure.ac  |  27 +-

Commit breaks expectations during pkg build.
Before commit 29eb7d6a0 (configure: Use AC_PATH_PROG for package
manager binaries.) it was possible to pass an executable via
environment like env ZYPPER=zypper ./configure $args. The result is
that the string zypper is called by supermin, even if it was not
installed at build time. This reduced the dependency chain.

Now its required to pass the absolute path, like env
ZYPPER=/usr/bin/zypper ./configure $args. The result is that at runtime
the user is forced to use the built-in string /usr/bin/zypper. Looks
like over there the concept of PATH got lost, not just in supermin.

What is the reason for this change, what does it fix?
The comment added in this commit does not really explains the why, just the 
what.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH supermin v4] Supermin 5 rewrite.

2014-03-28 Thread Olaf Hering
On Fri, Mar 28, Richard W.M. Jones wrote:

 I guess the question from me is why the user would want to use zypper
 from $PATH, instead of zypper which supermin had been configured and
 tested against?  Is it common that SUSE users want to try different
 versions of zypper?

It might be a corner case, but in case one wants to use a specific
binary from PATH for testing its now required to rebuild either supermin
(and maybe libguestfs if it also uses AC_PATH_PROG). And its not
specific to zypper, any other binary would have the same issue.

For the time being the specfile now exports the full path to zypper.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] ANNOUNCE: libguestfs 1.26 released

2014-03-28 Thread Olaf Hering
On Thu, Mar 27, Richard W.M. Jones wrote:

 I'm pleased to announce libguestfs 1.26, a library and set of tools

This fails to link at least in sles11sp3, 1.25.37 was still ok:

...
[  288s] virt_index_validate-index-validate.o: In function `main':
[  288s] index-validate.c:(.text+0x94): undefined reference to `rpl_getopt_long'
[  288s] index-validate.c:(.text+0x165): undefined reference to `rpl_optind'
[  288s] index-validate.c:(.text+0x177): undefined reference to `rpl_optind'
[  288s] index-validate.c:(.text+0x18c): undefined reference to `rpl_optind'
[  288s] index-validate.c:(.text+0x498): undefined reference to `rpl_perror'
[  288s] collect2: ld returned 1 exit status
[  288s] make[2]: *** [virt-index-validate] Error 1
...

Sorry for not testing more recent devel snapshots.


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] ANNOUNCE: libguestfs 1.26 released

2014-03-28 Thread Olaf Hering
On Fri, Mar 28, Richard W.M. Jones wrote:

 I'd say this is a gnulib problem, although why gnulib has decided to
 use replacement functions is a mystery.  My understanding is that
 getopt_long is part of glibc, so gnulib shouldn't need to replace it.
 Did ./configure output mention getopt*?  If there is a config.cache
 file, can you delete it and run ./configure again.

Its always a clean build:

...
[   12s] + CFLAGS='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -Wno-unused'
[   12s] + export CFLAGS
[   12s] + CXXFLAGS='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -Wno-unused'
[   12s] + export CXXFLAGS
[   12s] + FFLAGS='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 
-fstack-protector -funwind-tables -fasynchronous-unwind-tables'
[   12s] + export FFLAGS
[   12s] + ./configure --host=x86_64-suse-linux-gnu 
--build=x86_64-suse-linux-gnu --target=x86_64-suse-linux --program-prefix= 
--prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin 
--sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include 
--libdir=/usr/lib64 --libexecdir=/usr/lib64 --localstatedir=/var 
--sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info 
--docdir=/usr/share/doc/packages/libguestfs --enable-daemon 
--enable-install-daemon --with-qemu=/usr/bin/qemu-kvm --without-java 
--enable-appliance 
'--with-supermin-packager-config=/usr/src/packages/BUILD/libguestfs-1.26.0/zypper.priv.conf
 --use-installed --verbose' --disable-haskell --disable-php --enable-fuse 
--enable-lua --enable-ocaml --enable-perl --enable-python --disable-ruby 
--disable-rpath --disable-static
...
[   14s] checking for netinet/in.h... yes
[   14s] checking getopt.h usability... yes
[   14s] checking getopt.h presence... yes
[   14s] checking for getopt.h... yes
[   14s] checking sys/time.h usability... yes
...
[   22s] checking whether getlogin is declared... yes
[   22s] checking for getopt.h... (cached) yes
[   22s] checking for getopt_long_only... yes
[   22s] checking whether getopt is POSIX compatible... yes
[   22s] checking for working GNU getopt function... no
[   22s] checking whether getenv is declared... yes
...

Does your build have working GNU getopt function... yes?

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] Fix building on architectures where ocamlopt is not available

2014-03-11 Thread Olaf Hering
On Fri, Feb 28, Richard W.M. Jones wrote:

 I can't test if it will specifically break this because I don't have
 access to any machines that don't have ocamlopt, but it's something to
 watch out for.
 
 In any case, I have pushed this since it works fine for me.

Any chance this can be backported to 1.24?

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] enable build for ocaml bytecode

2014-02-28 Thread Olaf Hering
On Fri, Feb 28, Richard W.M. Jones wrote:

 I believe this patch has now been superseded by Hilko's commit here:

I'm backporting it right now, will send my version once it actually
builds.


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] Fix building on architectures where ocamlopt is not available

2014-02-28 Thread Olaf Hering
On Fri, Feb 28, Hilko Bengen wrote:

 ---
  builder/Makefile.am| 18 +-
  configure.ac   |  2 ++
  mllib/Makefile.am  | 60 
 +++---
  ocaml/Makefile.am  | 28 +++---

Something like this is required:


diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index 708b2e7..698e13a 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -37,6 +37,11 @@ CLEANFILES += t/*.cmi t/*.cmo t/*.cmx t/*.o t/*.a t/*.so
 
 if HAVE_OCAML
 
+DATA_HOOK_FILES = META *.so *.a *.cma *.cmi $(srcdir)/*.mli
+if HAVE_OCAMLOPT
+DATA_HOOK_FILES += *.cmx *.cmxa
+endif
+
 OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX
 OCAMLOPTFLAGS = $(OCAMLCFLAGS)
 
@@ -177,7 +182,7 @@ install-data-hook:
$(OCAMLFIND) install \
  -ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
  guestfs \
- META *.so *.a *.cma *.cmx *.cmxa *.cmi $(srcdir)/*.mli
+ $(DATA_HOOK_FILES)
rm $(DESTDIR)$(OCAMLLIB)/guestfs/bindtests.*
rm $(DESTDIR)$(OCAMLLIB)/guestfs/libguestfsocaml.a
 

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] enable build for ocaml bytecode

2014-02-26 Thread Olaf Hering
On Thu, Jan 17, Richard W.M. Jones wrote:

 On Wed, Jan 16, 2013 at 05:51:53PM +0100, Olaf Hering wrote:
  On Mon, Jan 14, Olaf Hering wrote:
   This is a first attempt to build libguestfs with just a ocaml bytecode
   compiler. The three tools written in ocaml will be build only when an
   ocamlopt compiler is available.
  Here is a more complete change which covers also resize, sysprep and
  sparsify. ocaml/examples are still disabled.
 Generally looks good.  Did you want to submit this second version or
 should we wait for more?

So here is a 1.24.X version which appears to work, at least for the
bytecode case.

Olaf

---
 builder/Makefile.am| 50 ++
 configure.ac   |  2 ++
 mllib/Makefile.am  | 54 ++
 ocaml/Makefile.am  | 32 ++-
 ocaml/examples/Makefile.am | 25 +++--
 resize/Makefile.am | 43 
 sparsify/Makefile.am   | 39 +
 sysprep/Makefile.am| 40 --
 8 files changed, 260 insertions(+), 25 deletions(-)

diff --git a/builder/Makefile.am b/builder/Makefile.am
index b8bf6ac..83ef46b 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -43,7 +43,30 @@ SOURCES = \
 if HAVE_OCAML
 
 # Note this list must be in dependency order.
-OBJECTS = \
+OBJECTS_bc = \
+   $(top_builddir)/mllib/libdir.cmo \
+   $(top_builddir)/mllib/common_gettext.cmo \
+   $(top_builddir)/mllib/common_utils.cmo \
+   $(top_builddir)/mllib/urandom.cmo \
+   $(top_builddir)/mllib/random_seed.cmo \
+   $(top_builddir)/mllib/hostname.cmo \
+   $(top_builddir)/mllib/firstboot.cmo \
+   $(top_builddir)/mllib/perl_edit.cmo \
+   $(top_builddir)/mllib/crypt-c.o \
+   $(top_builddir)/mllib/crypt.cmo \
+   $(top_builddir)/mllib/fsync-c.o \
+   $(top_builddir)/mllib/fsync.cmo \
+   $(top_builddir)/mllib/password.cmo \
+   $(top_builddir)/mllib/config.cmo \
+   get_kernel.cmo \
+   downloader.cmo \
+   sigchecker.cmo \
+   index_parser.cmo \
+   list_entries.cmo \
+   cmdline.cmo \
+   builder.cmo
+
+OBJECTS_opt = \
$(top_builddir)/mllib/libdir.cmx \
$(top_builddir)/mllib/common_gettext.cmx \
$(top_builddir)/mllib/common_utils.cmx \
@@ -66,6 +89,12 @@ OBJECTS = \
cmdline.cmx \
builder.cmx
 
+if HAVE_OCAMLOPT
+FINAL_BINARY = virt-builder.opt
+else
+FINAL_BINARY = virt-builder.bc
+endif
+
 bin_SCRIPTS = virt-builder
 
 # -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
@@ -73,7 +102,6 @@ bin_SCRIPTS = virt-builder
 # installed copy of libguestfs.
 OCAMLPACKAGES = \
-package str,unix \
-   -I $(top_builddir)/src/.libs \
-I $(top_builddir)/ocaml \
-I $(top_builddir)/mllib
 if HAVE_OCAML_PKG_GETTEXT
@@ -81,15 +109,29 @@ OCAMLPACKAGES += -package gettext-stub
 endif
 
 OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX $(OCAMLPACKAGES)
-OCAMLOPTFLAGS = $(OCAMLCFLAGS)
+OCAMLOPTFLAGS = \
+   -I $(top_builddir)/src/.libs \
+   $(OCAMLCFLAGS)
 
-virt-builder: $(OBJECTS)
+virt-builder.bc: $(OBJECTS_bc)
+   $(top_builddir)/libtool -dlopen $(top_builddir)/src/.libs/libguestfs.la 
--mode=execute \
+   $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
+ -custom \
+ mlguestfs.cma -linkpkg $^ \
+ -cclib '-lncurses -lcrypt' \
+ $(OCAML_GCOV_LDFLAGS) \
+ -o $@
+
+virt-builder.opt: $(OBJECTS_opt)
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
  mlguestfs.cmxa -linkpkg $^ \
  -cclib '-lncurses -lcrypt' \
  $(OCAML_GCOV_LDFLAGS) \
  -o $@
 
+virt-builder: $(FINAL_BINARY)
+   cp -vf $ $@
+
 .mli.cmi:
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $ -o $@
 .ml.cmo:
diff --git a/configure.ac b/configure.ac
index d7430db..d0063e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1024,6 +1024,8 @@ AS_IF([test x$enable_ocaml != xno],[
 ])
 AM_CONDITIONAL([HAVE_OCAML],
[test x$OCAMLC != xno  test x$OCAMLFIND != xno])
+AM_CONDITIONAL([HAVE_OCAMLOPT],
+   [test x$OCAMLOPT != xno  test x$OCAMLC != xno  test 
x$OCAMLFIND != xno])
 AM_CONDITIONAL([HAVE_OCAMLDOC],
[test x$OCAMLDOC != xno])
 
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
index 8c8d508..4312283 100644
--- a/mllib/Makefile.am
+++ b/mllib/Makefile.am
@@ -62,7 +62,31 @@ if HAVE_OCAML
 # - We're not actually building a functioning program here, we're just
 #   linking everything together to check all the modules build OK.
 # - This list must be in dependency order.
-OBJECTS = \
+OBJECTS_bc = \
+   $(top_builddir)/fish/guestfish-progress.o \
+   $(top_builddir)/fish/guestfish-uri.o \
+   tty-c.o \
+   fsync-c.o \
+   progress-c.o \
+   uri-c.o \
+   crypt-c.o \
+   config.cmo \
+   libdir.cmo

[Libguestfs] progress output during guestfish sh commands

2014-02-04 Thread Olaf Hering
Is there any way to flush the output of a long running 'guestfish sh
cmd.sh' call?
It seems to me that output is only shown once cmd.sh has finished. I
already split cmd.sh into smaller pieces to see overall progress. But
output from a verbose, long running single command within cmd.sh is not
shown.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] progress output during guestfish sh commands

2014-02-04 Thread Olaf Hering
On Tue, Feb 04, Richard W.M. Jones wrote:

  It seems to me that output is only shown once cmd.sh has finished. I
  already split cmd.sh into smaller pieces to see overall progress. But
  output from a verbose, long running single command within cmd.sh is not
  shown.
 
 Verbose output is carried over a separate channel from qemu, so things
 like kernel messages appear asynchronously:
 
 https://github.com/libguestfs/libguestfs/blob/master/src/conn-socket.c#L301

Thanks.
I think doing 'cmd  /dev/null  /dev/kmsg' will help, I will try that
way to see whats actually going on.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH] appliance: Disable ipv6 in the appliance because qemu usernet is ipv4 only

2014-01-23 Thread Olaf Hering
Signed-off-by: Olaf Hering o...@aepfle.de
---

Untested in this environment.

 appliance/init | 4 
 1 file changed, 4 insertions(+)

diff --git a/appliance/init b/appliance/init
index b25ea26..cc8c978 100755
--- a/appliance/init
+++ b/appliance/init
@@ -71,6 +71,10 @@ for f in /sys/block/{h,s,ub,v}d*/queue/scheduler; do echo 
noop  $f; done
 # Update the system clock.
 hwclock -u -s
 
+# Disable ipv6 because host names resolve to ipv4 and ipv6
+# Resolver may prefer ipv6 and qemu usernet does only ipv4
+for f in /proc/sys/net/ipv6/conf/*/disable_ipv6; do if test -w $f ; then echo 
1  $f; fi; done
+
 # Set up the network.
 ip addr add 127.0.0.1/8 brd + dev lo scope host
 ip link set dev lo up

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] appliance: Disable ipv6 in the appliance because qemu usernet is ipv4 only

2014-01-23 Thread Olaf Hering
On Thu, Jan 23, Olaf Hering wrote:

 +++ b/appliance/init
  # Update the system clock.
  hwclock -u -s

Why is that needed? Just wondering...


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] mke2fs fails due to wipefs --force

2014-01-20 Thread Olaf Hering
On Sun, Jan 19, Richard W.M. Jones wrote:

 How about the attached patch (only compile-tested)?

This patch works for me. Thanks.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] guestfish and luks-format

2014-01-20 Thread Olaf Hering
On Mon, Jan 20, Richard W.M. Jones wrote:

 For example:
 
 $ echo 123456 | guestfish -x --keys-from-stdin -N part luks-format /dev/sda1 0

thanks, I changed my code like this:

(
echo 123456
echo 123456
) | \
guestfish \
-x \
--keys-from-stdin \
\
luks-format $part 0 : \
luks-open   $part crypt_part

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] newlines with write-append

2014-01-20 Thread Olaf Hering
On Mon, Jan 20, Richard W.M. Jones wrote:

 Have you considered using a real programming language, like Perl +
 Sys::Guestfs, Python + guestfs etc.?  Whenever I bump into the limits
 of guestfish, I usually turn to Perl.

For my hackery I will use guestfish because I'm used to it.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] mke2fs fails due to wipefs --force

2014-01-19 Thread Olaf Hering
My wipefs has no --force option, as a result mke2fs command in guestfish fails.

Looks like 72dd398679cd0bb803daf306d12558369615ba70 needs an adjustment
to make use of do_wipefs?
Also str_wipefs is not used in that file.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH] daemon: add missing GUESTFSD_EXT_CMD usage

2014-01-19 Thread Olaf Hering
Signed-off-by: Olaf Hering o...@aepfle.de
---
Not even compile tested, against 1.24 branch.

 daemon/btrfs.c   | 2 +-
 daemon/command.c | 3 ++-
 daemon/debug.c   | 3 ++-
 daemon/ldm.c | 4 ++--
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 0b877f8..a0c1542 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -597,7 +597,7 @@ test_btrfs_device_add_needs_force (void)
   int r;
   CLEANUP_FREE char *out = NULL, *err = NULL;
 
-  r = command (out, err, btrfs, device, add, --help, NULL);
+  r = command (out, err, str_btrfs, device, add, --help, NULL);
   if (r == -1) {
 reply_with_error (%s: %s, btrfs device add --help, err);
 return -1;
diff --git a/daemon/command.c b/daemon/command.c
index 02e1dd4..066c773 100644
--- a/daemon/command.c
+++ b/daemon/command.c
@@ -30,6 +30,7 @@
 
 #include ignore-value.h
 
+GUESTFSD_EXT_CMD(str_cp, cp);
 GUESTFSD_EXT_CMD(str_mount, mount);
 GUESTFSD_EXT_CMD(str_umount, umount);
 
@@ -179,7 +180,7 @@ set_up_etc_resolv_conf (struct resolver_state *rs)
   /* Now that the guest's sysroot/etc/resolv.conf is out the way, we
* can create our own copy of the appliance /etc/resolv.conf.
*/
-  ignore_value (command (NULL, NULL, cp, /etc/resolv.conf,
+  ignore_value (command (NULL, NULL, str_cp, /etc/resolv.conf,
  rs-sysroot_etc_resolv_conf, NULL));
 
   rs-mounted = true;
diff --git a/daemon/debug.c b/daemon/debug.c
index 9fe57fc..b5470d7 100644
--- a/daemon/debug.c
+++ b/daemon/debug.c
@@ -41,6 +41,7 @@ GUESTFSD_EXT_CMD(str_xargs, xargs);
 GUESTFSD_EXT_CMD(str_file, file);
 GUESTFSD_EXT_CMD(str_grep, grep);
 GUESTFSD_EXT_CMD(str_gawk, gawk);
+GUESTFSD_EXT_CMD(str_sh, sh);
 
 /* This command exposes debugging information, internals and
  * status.  There is no comprehensive documentation for this
@@ -335,7 +336,7 @@ debug_binaries (const char *subcmd, size_t argc, char 
*const *const argv)
 | %s -F: '{print $1}',
 str_find, str_xargs, str_file, str_grep, str_gawk);
 
-  r = command (out, err, sh, -c, cmd, NULL);
+  r = command (out, err, str_sh, -c, cmd, NULL);
   if (r == -1) {
 reply_with_error (find: %s, err);
 free (out);
diff --git a/daemon/ldm.c b/daemon/ldm.c
index aed8a0d..e89fc90 100644
--- a/daemon/ldm.c
+++ b/daemon/ldm.c
@@ -130,7 +130,7 @@ do_ldmtool_create_all (void)
   int r;
   CLEANUP_FREE char *err = NULL;
 
-  r = command (NULL, err, ldmtool, create, all, NULL);
+  r = command (NULL, err, str_ldmtool, create, all, NULL);
   if (r == -1) {
 reply_with_error (%s, err);
 return -1;
@@ -144,7 +144,7 @@ do_ldmtool_remove_all (void)
   int r;
   CLEANUP_FREE char *err = NULL;
 
-  r = command (NULL, err, ldmtool, remove, all, NULL);
+  r = command (NULL, err, str_ldmtool, remove, all, NULL);
   if (r == -1) {
 reply_with_error (%s, err);
 return -1;

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] sysprep: handle distro specific sysv scripts

2013-12-12 Thread Olaf Hering
On Thu, Dec 12, Pino Toscano wrote:

 What do you think?

I think that your Should-Start handling is broken. Required means the
given file can not properly work without the listed servers, insserv
will error out. Should means it can very well work without them if they
are not present or enabled. Otherwise the given file has to be scheduled
after the listed services.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] augeas changes in stable branches

2013-10-18 Thread Olaf Hering

commit f59b87f7f18d9df89ff9940a317ff1fb452cbd28 breaks compile with older
augeas (0.7.4). AFAIK there is no requirement for augeas 1.0 until 1.24.

 augeas.c: In function 'do_aug_init':
 augeas.c:102:38: error: 'AUG_NO_ERR_CLOSE' undeclared (first use in this 
function)


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] augeas changes in stable branches

2013-10-18 Thread Olaf Hering
On Fri, Oct 18, Richard W.M. Jones wrote:

 On Fri, Oct 18, 2013 at 11:15:54AM +0200, Olaf Hering wrote:
  
  commit f59b87f7f18d9df89ff9940a317ff1fb452cbd28 breaks compile with older
  augeas (0.7.4). AFAIK there is no requirement for augeas 1.0 until 1.24.
  
   augeas.c: In function 'do_aug_init':
   augeas.c:102:38: error: 'AUG_NO_ERR_CLOSE' undeclared (first use in this 
  function)
 
 That's a mistake on the stable-1.22 branch.  Does simply reverting
 that patch fix the problem?  If so I will push a revert commit.

AUG_NO_ERR_CLOSE is not a define but an enum. So
f59b87f7f18d9df89ff9940a317ff1fb452cbd28 is correct by itself, but
3d132f29204e8c5c77f08841b5288dfe3013f4f0 will cause the error by using
an undeclared value.

I suggest to revert both commits.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] --disable-appliance creates supermin.d files

2013-08-22 Thread Olaf Hering

Why does the toplevel Makefile process appliance/, and creates
supermin.d during make install, whith configure --disable-appliance?  I
have to double check what actually happens, it seems it causes startup
failures if the resulting binary packages are started on a host that
happens to have supermin installed.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] missing mount cmd confuses guestfish

2013-08-22 Thread Olaf Hering
On Sun, Aug 18, Olaf Hering wrote:

 
 I think calling sh before mount should not confuse guestfish like
 that:
 
 # guestfish (1.20.4 on sles11sp3)

Doing the same, by accident, with 1.22.5 causes a crash:


# guestfish -r -v --network
fs add-drive /work/kvm/images/opensuse12.3/disk0.raw
fs launch

fs sh ip a
guestfsd: main_loop: new request, len 0x30
guestfsd: error: do_command: you must call 'mount' first to mount the root 
filesystem
*** glibc detected *** guestfsd: free(): invalid pointer: 0x7fffd8425ba0 ***
libguestfs: error: sh: do_command: you must call 'mount' first to mount the 
root filesystem
fs mount /de=== Backtrace: =
/lib64/libc.so.6(+0x733b6)[0x7f4994ae83b6]
/lib64/libc.so.6(cfree+0x6c)[0x7f4994aed2dc]
guestfsd[0x409e6f]
guestfsd[0x40a01b]
guestfsd[0x43e9a1]
guestfsd[0x422bd7]
guestfsd[0x41606c]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x7f4994a93bfd]
uestfsd[0x405189]

...


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH] daemon: fix build without systemd-journal

2013-08-20 Thread Olaf Hering
Fix typo in OPTGROUP_JOURNAL_NOT_AVAILABLE
Define empty journal_finalize, called by mount.c

Signed-off-by: Olaf Hering o...@aepfle.de
---
 daemon/journal.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/daemon/journal.c b/daemon/journal.c
index 0cb50e3..97e1874 100644
--- a/daemon/journal.c
+++ b/daemon/journal.c
@@ -216,6 +216,11 @@ do_journal_set_data_threshold (int64_t threshold)
 
 #else /* !HAVE_SD_JOURNAL */
 
-OPTGROUP_SD_JOURNAL_NOT_AVAILABLE
+OPTGROUP_JOURNAL_NOT_AVAILABLE
+
+void
+journal_finalize (void)
+{
+}
 
 #endif /* !HAVE_SD_JOURNAL */

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH] lib: avoid pragma usage in journal.c

2013-08-20 Thread Olaf Hering
journal.c: In function 'guestfs__journal_get':
journal.c:120:9: error: #pragma GCC diagnostic not allowed inside functions
journal.c:121:9: error: #pragma GCC diagnostic not allowed inside functions
journal.c:123:9: error: #pragma GCC diagnostic not allowed inside functions
make[3]: *** [libguestfs_la-journal.lo] Error 1

Signed-off-by: Olaf Hering o...@aepfle.de
---

Not compiled.

 src/journal.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/journal.c b/src/journal.c
index cac8040..61ab352 100644
--- a/src/journal.c
+++ b/src/journal.c
@@ -117,10 +117,8 @@ guestfs__journal_get (guestfs_h *g)
  size=%zu, i=%zu, size, i);
   goto err;
 }
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored -Wcast-align
-len = be64toh (* (uint64_t *) buf[i]);
-#pragma GCC diagnostic pop
+memcpy(len, buf[i], sizeof(len));
+len = be64toh (len);
 i += 8;
 eofield = buf[i+len];
 if (eofield  eobuf) {

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] OPTGROUP_SD_JOURNAL_NOT_AVAILABLE

2013-08-19 Thread Olaf Hering

Current master fails to build if certain systemd functionality is not
available at build time, daemon/journal.c has
OPTGROUP_SD_JOURNAL_NOT_AVAILABLE at the end of the file. Is this a
typo, what should be done in that case?

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH] tests: change noinst to check

2013-08-19 Thread Olaf Hering
This change avoids the hard requirement for qemu-tools during package
build.

Signed-off-by: Olaf Hering o...@aepfle.de
---

The current OPTGROUP_SD_JOURNAL_NOT_AVAILABLE failure blocks a complete build 
for me,
I think the build got past the point of the failure fixed by this patch.

 tests/data/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 03315de..5aa3219 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -82,7 +82,7 @@ images_files_build = \
initrd-x86_64.img.gz \
test-grep.txt.gz
 
-noinst_DATA = $(images_files_build) test.iso
+check_DATA = $(images_files_build) test.iso
 
 CLEANFILES = $(images_files_build) test.iso
 

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] missing chdir before chroot in guestfsd

2013-08-19 Thread Olaf Hering
On Mon, Aug 19, Richard W.M. Jones wrote:

 If you look at the upstream code, this has been fixed, or at
 least, the code is quite different.  See:
 
 commit 2aa731e7c441581f0d72bcd06e9431b92931466a

It does not happen with 1.23.17. Thanks.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] missing mount cmd confuses guestfish

2013-08-18 Thread Olaf Hering

I think calling sh before mount should not confuse guestfish like
that:


# guestfish (1.20.4 on sles11sp3)

Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.

Type: 'help' for help on commands
  'man' to read the manual
  'quit' to quit the shell

fs add-drive /dev/shm/olaf/vdisk-sles11sp2_full_fate310510-disk0
fs launch
 100% ⟦▒⟧ 00:00
fs sh cd / ; chroot / ; /bin/pwd
libguestfs: error: sh: do_command: you must call 'mount' first to mount the 
root filesystem
fs mount /dev/sda2 /
libguestfs: error: mount: call launch before using this function\n(in 
guestfish, don't forget to use the 'run' command)
fs launch
libguestfs: error: you must call guestfs_add_drive before guestfs_launch
fs


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

[Libguestfs] [PATCH / RFC] Handle --packager-config in zypp_rpm

2013-06-04 Thread Olaf Hering
This is an attempt to handle a different --reposd-dir in the zypp_rpm
driver. Up to now the system repositories in /etc/zypp/repos.d were
used.

To specify a different set of repositories for zypp a parser for a
simple zypper.conf is added in this patch. It just looks for reposdir=
in section main, like this:

 [main]
 reposdir=/path/to/other/repofiles

If the config file provided via --packager-config my_zypp.conf is
valid the other directory is passed to zypper, otherwise the system
repos.d is used like its done in current code.

Depending on the kind of provided repos, the current code may fail to
import a repo in non-interactive mode. This happens if the repo data are
not properly signed. For this reason the option --no-gpg-checks is added
by this patch.

Finally, the parser uses ocaml-inifiles to read the config file. This is
a new build dependency. inifiles should be available in various
distributions, copies of the original sources can be found via google.

This patch has received some light testing, I sent it out to the list
for further comments. Particular about the new inifiles dependency..


Signed-off-by: Olaf Hering o...@aepfle.de

---
 src/Makefile.am  |  2 +-
 src/supermin_zypp_rpm.ml | 23 ---
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 3b6ca9b..6ed0faf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -56,7 +56,7 @@ OBJECTS = $(XOBJECTS)
 BEST= opt
 endif
 
-OCAMLPACKAGES = -package unix,str
+OCAMLPACKAGES = -package unix,str,inifiles
 OCAMLFLAGS = -warn-error CDEFLMPSUVXYZ
 
 supermin: $(OBJECTS)
diff --git a/src/supermin_zypp_rpm.ml b/src/supermin_zypp_rpm.ml
index c269aab..c9786ce 100644
--- a/src/supermin_zypp_rpm.ml
+++ b/src/supermin_zypp_rpm.ml
@@ -45,6 +45,7 @@
  *)
 open Unix
 open Printf
+open Inifiles
 
 open Supermin_package_handlers
 open Supermin_utils
@@ -54,6 +55,19 @@ open Supermin_cmdline
 (* Create a temporary directory for use by all the functions in this file. *)
 let tmpdir = tmpdir ()
 
+let get_repos_dir () =
+  let zypper_default = /etc/zypp/repos.d in
+  let parse_repos_dir path = 
+let cfg = new inifile path in
+let dir = (try cfg#getval main reposdir with _ - zypper_default) in
+dir
+  in
+  let dir = (match packager_config with None - zypper_default |
+  Some filename - (try parse_repos_dir filename with _ - zypper_default) 
) in
+  dir
+
+let repos_dir = get_repos_dir ()
+
 let zypp_rpm_detect () =
   (file_exists /etc/SuSE-release) 
 Config.zypper  no  Config.rpm  no
@@ -75,10 +89,11 @@ pkg_cache_dir=%S
 time zypper \
%s \
%s \
-   --root %S --reposd-dir /etc/zypp/repos.d \
+   --root %S --reposd-dir %S \
--cache-dir \${cache_dir}\ \
--pkg-cache-dir \${pkg_cache_dir}\ \
--gpg-auto-import-keys \
+   --no-gpg-checks \
--non-interactive \
install \
--auto-agree-with-licenses \
@@ -92,6 +107,7 @@ time zypper \
 (match packager_config with None - 
  | Some filename - sprintf --config %s filename)
 tmp_root
+repos_dir
 in
   run_shell sh names;
 
@@ -129,9 +145,10 @@ unset LANG ${!LC_*}
 zypper \
%s \
%s \
-   --root %S --reposd-dir /etc/zypp/repos.d \
+   --root %S --reposd-dir %S \
--cache-dir %S \
--gpg-auto-import-keys \
+   --no-gpg-checks \
--non-interactive \
--xml \
install \
@@ -146,7 +163,7 @@ zypper \
 (if verbose then --verbose --verbose else --quiet)
 (match packager_config with None - 
  | Some filename - sprintf --config %s filename)
-tmpdir tmpdir (String.concat   (List.map Filename.quote names)) in
+tmpdir repos_dir tmpdir (String.concat   (List.map Filename.quote 
names)) in
   let pkg_names = run_command_get_lines cmd in
 
   (* Return list of package names, remove empty lines. *)

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH] Set DISTRO to SUSE if /etc/SuSE-release exists

2013-06-04 Thread Olaf Hering
Signed-off-by: Olaf Hering o...@aepfle.de
---

not compile-tested.

 configure.ac | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure.ac b/configure.ac
index 71f7b06..2db9593 100644
--- a/configure.ac
+++ b/configure.ac
@@ -519,6 +519,9 @@ fi
 if test -f /etc/arch-release; then
 DISTRO=ARCHLINUX
 fi
+if test -f /etc/SuSE-release; then
+DISTRO=SUSE
+fi
 AC_MSG_RESULT([$DISTRO])
 AC_SUBST([DISTRO])
 

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] Set DISTRO to SUSE if /etc/SuSE-release exists

2013-06-04 Thread Olaf Hering
On Tue, Jun 04, Richard W.M. Jones wrote:

 Looks fine.  ACKed and pushed.  Of course it'll need corresponding
 adjustments to appliance/packagelist.in, as I'm sure you're aware :-)

Yes. Hopefully there will be a generic set of package names to support
everything from SLES to Factory. Might be problematic with the switch to
systemd, maybe --with-extra-pkgs= will be the rescue.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] ATTN: Denial of service attack possible on libguestfs 1.21.x, libguestfs.1.22.0

2013-05-31 Thread Olaf Hering
On Fri, May 31, Richard W.M. Jones wrote:

 I don't see a problem in parse_lsb_release however.  Do you have a
 stack trace from that?

parse_lsb_release is fine, I was wrong.


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH] Change fallback name for external supermin helper

2013-05-31 Thread Olaf Hering
Use basename of external helper instead of 'no' for external supermin
helpers. This gives a clear error messages what binary is actually
missing, and it is now possible to install the missing package without
recompiling libguestfs. In addition its now also possible to use private
builds of supermin (if they are in PATH) with a given libguestfs binary
package.

Signed-off-by: Olaf Hering o...@aepfle.de
---
 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 30af871..8f025d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -442,9 +442,9 @@ AC_SUBST([ENABLE_APPLIANCE])
 
 dnl Check for supermin = 4.1.0 or febootstrap = 3.20.
 AC_CHECK_PROGS([SUPERMIN],
-   [supermin febootstrap],[no])
+   [supermin febootstrap],[supermin])
 AC_CHECK_PROGS([SUPERMIN_HELPER],
-   [supermin-helper febootstrap-supermin-helper],[no])
+   [supermin-helper febootstrap-supermin-helper],[supermin-helper])
 
 dnl Pass supermin --packager-config option.
 dnl

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] Change fallback name for external supermin helper

2013-05-31 Thread Olaf Hering
On Fri, May 31, Richard W.M. Jones wrote:

 On Fri, May 31, 2013 at 01:38:06PM +0200, Olaf Hering wrote:
  But this requires that febootstrap or supermin is in BuildRequires:,
  while this change removes the hard dependency of BuildRequires:. But I
  see, if the appliance is enabled then it would now fail with this
  change. In my packaging the appliance is not enabled because zypp
  support in supermin is not yet complete, so I did not spot this part. 
 
 Actually I thought zypp support was complete?  Oh well, how far off is
 complete zypp support in supermin?

supermin can not be used in a chroot when called as builduser, because
there is no repo configured inside that chroot.

supermin need to handle the case '--root X --reposd-dir Y', which is
triggered by the '--packager-config conf' option. Currently the conf
file is expected in X//conf, which will fail. 
The new code has to parse conf, look for reposdir=dir and replace
the current hardcode path Y with the one from conf so that libzypp
continues to oerate below X (--root X --repos-dir dir).

I think there is some odd ocaml-iniparser package, which I could use.
Or I just grep for reposdir= and use that.

 On the slightly related subject, I need to add dnf/libsolv support to
 supermin.  I don't know how much code could be shared.  Unfortunately
 I suspect not very much since although both zypper and dnf are using
 the same underlying library, there's not much else in common.

I dont know much about the underlying libsolv, its very likely that in
the end libzypp does all the required work.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] Usage of 'no' as external helper

2013-05-30 Thread Olaf Hering

libguestfs and supermin use 'no' instead of either the basename of the
desired application, or 'false', as helper string. This happens when
configure does not find things like rpm or supermin during build.

Wouldnt it be more logical to use the basename instead of 'no' so that
at runtime one has the chance to install the required packages and in
addition get an obvious error message in verbose mode what external
helper is actually missing? In my package I force a few things like
'export ZYPPER=zypper' to avoid the unneeded BuildRequires: zypper. But
doing that for every binary that maybe called is cumbersome.

I think its best to rely on PATH to let libguestfs and supermin packages
find their external helpers at runtime. And one who has a need to
actually hardcode absolute paths to external helpers into his
libguestfs/supermin binaries can do that by doing the 'export
HELPER=/path/to/helper' during his own configure run.

Thoughts?


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] Usage of 'no' as external helper

2013-05-30 Thread Olaf Hering
On Thu, May 30, Richard W.M. Jones wrote:

 On Thu, May 30, 2013 at 10:02:10PM +0200, Olaf Hering wrote:
  
  libguestfs and supermin use 'no' instead of either the basename of the
  desired application, or 'false', as helper string. This happens when
  configure does not find things like rpm or supermin during build.
  
  Wouldnt it be more logical to use the basename instead of 'no' so that
  at runtime one has the chance to install the required packages and in
  addition get an obvious error message in verbose mode what external
  helper is actually missing? In my package I force a few things like
  'export ZYPPER=zypper' to avoid the unneeded BuildRequires: zypper. But
  doing that for every binary that maybe called is cumbersome.
  
  I think its best to rely on PATH to let libguestfs and supermin packages
  find their external helpers at runtime. And one who has a need to
  actually hardcode absolute paths to external helpers into his
  libguestfs/supermin binaries can do that by doing the 'export
  HELPER=/path/to/helper' during his own configure run.
  
  Thoughts?
 
 I suspect it depends on the application on a case-by-case basis.

I looked just now at configure.ac, there are a few
AC_CHECK_PROG/AC_CHECK_PROGS. I was thinking of supermin and also the
netpbm tools. Now I see the latter are compiled conditionally.

So as you say its not that bad, maybe the no for supermin can be
replaced with supermin, the others I will check.


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] ATTN: Denial of service attack possible on libguestfs 1.21.x, libguestfs.1.22.0

2013-05-30 Thread Olaf Hering
On Tue, May 28, Richard W.M. Jones wrote:

 
 There's a denial of service attack possible from guests on any program
 that does inspection (eg. virt-inspector, many other virt-* tools,
 virt-v2v, OpenStack).
 
 The attack causes the host process to crash because of a double free.
 It's probably not exploitable (definitely not on Fedora because of the
 default memory hardening settings).
 
 This patch contains the fix and a reproducer:
 
 https://github.com/libguestfs/libguestfs/commit/fa6a76050d82894365dfe32916903ef7fee3ffcd

This is appearently incomplete, bt from a 1.20.4:


head -n 10
libguestfs: recv_from_daemon: 44 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 7a 
| 00 00 00 01 | 00 12 34 24 | ...

Program received signal SIGSEGV, Segmentation fault.
0x769deae2 in __strlen_sse2 () from /lib64/libc.so.6
(gdb) bt
#0  0x769deae2 in __strlen_sse2 () from /lib64/libc.so.6
#1  0x769de7e6 in strdup () from /lib64/libc.so.6
#2  0x77b7936c in guestfs___safe_strdup (g=0x65da50, str=0x0) at 
alloc.c:96
#3  0x77b8b65e in parse_suse_release (filename=optimized out, 
fs=optimized out, g=optimized out) at inspect-fs-unix.c:343
#4  guestfs___check_linux_root (g=0x65da50, fs=0x6665b0) at 
inspect-fs-unix.c:560
#5  0x77b88522 in check_filesystem (is_partnum=optimized out, 
is_block=optimized out, device=optimized out, g=optimized out) at 
inspect-fs.c:238
#6  guestfs___check_for_filesystem_on (g=0x65da50, device=0x617930 /dev/sda2, 
is_block=0, is_partnum=2) at inspect-fs.c:152
#7  0x77b86980 in guestfs__inspect_os (g=0x65da50) at inspect.c:86
#8  0x77b1c91b in guestfs_inspect_os (g=0x65da50) at actions-1.c:397
#9  0x00406ba9 in main (argc=3, argv=optimized out) at 
virt-inspector.c:273

Looks like parse_lsb_release and parse_suse_release needs a similar
change. I will test a patch.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] handle --use-installed in zypp driver

2013-04-29 Thread Olaf Hering
On Thu, Apr 11, Olaf Hering wrote:

 + -m \stream/install-summary/to-install/solvable[%@type='package']\ \
 + -c \string(%@name)\ -n

This is supposed to be [@type='package'] and string(@name). Some of
the ocaml printf docs made me believe that %@ is the way to print a
single @.
Now I see this part was changed to %%@, which puts an extra % into the
output string.

Is the @ sign a special char in ocaml printf? 


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH] always work with empty --root in zypp driver

2013-04-11 Thread Olaf Hering
The current mode of operation in the zypp driver is to download all
packages into a temporary pkg-cache-dir. Installed packages in the root
filesystem are ignored, otherwise zypper would download only a subset of
packages, and it would not provide a list of all required dependencies.

Remove the getuid check to force an empty root directory and use the
configured system repositories.

This works for root and non-root users.

Signed-off-by: Olaf Hering o...@aepfle.de
---
 src/supermin_zypp_rpm.ml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/supermin_zypp_rpm.ml b/src/supermin_zypp_rpm.ml
index 51f01eb..2089837 100644
--- a/src/supermin_zypp_rpm.ml
+++ b/src/supermin_zypp_rpm.ml
@@ -50,7 +50,7 @@ pkg_cache_dir=%S
 time zypper \
%s \
%s \
-   %s \
+   --root %S --reposd-dir /etc/zypp/repos.d \
--cache-dir \${cache_dir}\ \
--pkg-cache-dir \${pkg_cache_dir}\ \
--gpg-auto-import-keys \
@@ -65,7 +65,7 @@ time zypper \
 (if verbose then --verbose --verbose else --quiet)
 (match packager_config with None - 
  | Some filename - sprintf --config %s filename)
-(if Unix.getuid()  0 then sprintf --root %S --reposd-dir 
/etc/zypp/repos.d tmp_root else )
+tmp_root
 in
   run_shell sh names;
 

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH] handle --use-installed in zypp driver

2013-04-11 Thread Olaf Hering
An attempt to use installed files in zypp driver.
Add also a comment about the theory of operation.
Enable set -x in shell only in verbose mode.
This adds a dependency to xmlstarlet, which is required to parse zypper output.

Signed-off-by: Olaf Hering o...@aepfle.de
---
 src/supermin_zypp_rpm.ml | 93 +---
 1 file changed, 80 insertions(+), 13 deletions(-)

diff --git a/src/supermin_zypp_rpm.ml b/src/supermin_zypp_rpm.ml
index 2089837..720f50a 100644
--- a/src/supermin_zypp_rpm.ml
+++ b/src/supermin_zypp_rpm.ml
@@ -18,6 +18,31 @@
 
 (* Zypper and RPM support. *)
 
+(*
+ * Theory of operation:
+ * called as root:
+ *  - without --use-installed:
+ *-ph_resolve_dependencies_and_download() returns a list of filenames
+ *Need to download all packages into an empty --root directory so that
+ *zypper places all dependencies into --pkg-cache-dir
+ *  - with --use-installed:
+ *-ph_resolve_dependencies_and_download() returns a list of package names
+ *Need to work with an empty --root directory so that zypper can list
+ *all dependencies of names. This mode assumes that all required packages
+ *are installed and the system is consistent. Downloading just the missing 
+ *packages is not implemented.
+ * called as non-root:
+ *(Due to the usage of --root zypper does not require root permissions.)
+ *  - without --use-installed:
+ *Same as above.
+ *  - with --use-installed:
+ *Same as above.
+ *
+ * The usage of --packager-config is tricky: If --root is used zypper assumes
+ * that every config file is below rootdir. So the config has to be parsed
+ * and relevant files/dirs should be copied into rootdir so that zypper can
+ * use the specified config.
+ *)
 open Unix
 open Printf
 
@@ -34,15 +59,15 @@ let zypp_rpm_detect () =
 Config.zypper  no  Config.rpm  no
 
 let zypp_rpm_init () =
-  if use_installed  Unix.getuid()  0 then
-failwith zypp_rpm driver doesn't support --use-installed when called as 
non-root user
+  if use_installed then
+eprintf supermin: zypp_rpm driver assumes all packages are already 
installed when called with option --use-installed.\n%!
 
-let zypp_rpm_resolve_dependencies_and_download names =
+let zypp_rpm_resolve_dependencies_and_download_no_installed names =
   (* Liberate this data from shell. *)
   let tmp_pkg_cache_dir = tmpdir // pkg_cache_dir in
   let tmp_root = tmpdir // root in
   let sh = sprintf 
-set -ex
+%s
 unset LANG ${!LC_*}
 tmpdir=%S
 cache_dir=\${tmpdir}/cache-dir\
@@ -60,6 +85,7 @@ time zypper \
--download-only \
$@
 
+(if verbose then set -x else )
 tmpdir
 tmp_pkg_cache_dir
 (if verbose then --verbose --verbose else --quiet)
@@ -96,10 +122,47 @@ time zypper \
   (* Return list of package filenames. *)
   pkgs
 
+let zypp_rpm_resolve_dependencies_and_download_use_installed names =
+  let cmd = sprintf 
+%s
+unset LANG ${!LC_*}
+zypper \
+   %s \
+   %s \
+   --root %S --reposd-dir /dev/shm/supermin/zypp/repos.d \
+   --cache-dir %S \
+   --gpg-auto-import-keys \
+   --non-interactive \
+   --xml \
+   install \
+   --auto-agree-with-licenses \
+   --dry-run \
+   %s | \
+   xml sel -t \
+   -m \stream/install-summary/to-install/solvable[%@type='package']\ \
+   -c \string(%@name)\ -n
+
+(if verbose then set -x else )
+(if verbose then --verbose --verbose else --quiet)
+(match packager_config with None - 
+ | Some filename - sprintf --config %s filename)
+tmpdir tmpdir (String.concat   (List.map Filename.quote names)) in
+  let pkg_names = run_command_get_lines cmd in
+
+  (* Return list of package names, remove empty lines. *)
+  List.filter (fun s - s  ) pkg_names
+
+let zypp_rpm_resolve_dependencies_and_download names =
+  if use_installed then
+zypp_rpm_resolve_dependencies_and_download_use_installed names
+  else
+zypp_rpm_resolve_dependencies_and_download_no_installed names
+
 let rec zypp_rpm_list_files pkg =
   (* Run rpm -qlp with some extra magic. *)
   let cmd =
-sprintf rpm -q --qf '[%%{FILENAMES} %%{FILEFLAGS:fflags} %%{FILEMODES} 
%%{FILESIZES}\\n]' -p %S
+sprintf rpm -q --qf '[%%{FILENAMES} %%{FILEFLAGS:fflags} %%{FILEMODES} 
%%{FILESIZES}\\n]' %s %S
+  (if use_installed then  else -p)
   pkg in
   let lines = run_command_get_lines cmd in
 
@@ -153,14 +216,18 @@ let rec zypp_rpm_list_files pkg =
   files
 
 let zypp_rpm_get_file_from_package pkg file =
-  debug extracting %s from %s ... file (Filename.basename pkg);
-
-  let outfile = tmpdir // file in
-  let cmd =
-sprintf umask ; rpm2cpio %s | (cd %s  cpio --quiet -id .%s)
-  (Filename.quote pkg) (Filename.quote tmpdir) (Filename.quote file) in
-  run_command cmd;
-  outfile
+  if use_installed then
+file
+  else (
+debug extracting %s from %s ... file (Filename.basename pkg);
+
+let outfile = tmpdir // file in
+let cmd =
+  sprintf umask 

[Libguestfs] [PATCH] skip unreadable files in zypp_rpm_list_files

2013-04-11 Thread Olaf Hering
Signed-off-by: Olaf Hering o...@aepfle.de
---
 src/supermin_zypp_rpm.ml | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/supermin_zypp_rpm.ml b/src/supermin_zypp_rpm.ml
index 720f50a..1c6243d 100644
--- a/src/supermin_zypp_rpm.ml
+++ b/src/supermin_zypp_rpm.ml
@@ -175,12 +175,18 @@ let rec zypp_rpm_list_files pkg =
 let mode = int_of_string mode in
let size = int_of_string size in
 if test_flag 'd' then None  (* ignore documentation *)
-else
+else (
+  (* Skip unreadable files when called as non-root *)
+  if Unix.getuid()  0 
+(try Unix.access filename [Unix.R_OK]; false with
+   Unix_error _ - eprintf supermin: EPERM %s\n%! filename; 
true) then None
+  else
   Some (filename, {
   ft_dir = mode land 0o4  0;
   ft_ghost = test_flag 'g'; ft_config = test_flag 'c';
   ft_mode = mode; ft_size = size;
 })
+)
 | _ -
 eprintf supermin: bad output from rpm command: '%s' line;
 exit 1

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH] add --with-supermin-extra-options configure option

2013-04-11 Thread Olaf Hering
Useful to pass --use-installed and other options to supermin.

Signed-off-by: Olaf Hering o...@aepfle.de
---

Not even compile tested!!
Just copypaste from SUPERMIN_PACKAGER_CONFIG


 appliance/make.sh.in |  3 +++
 configure.ac | 13 +
 2 files changed, 16 insertions(+)

diff --git a/appliance/make.sh.in b/appliance/make.sh.in
index 42d6b23..8ba1fa4 100755
--- a/appliance/make.sh.in
+++ b/appliance/make.sh.in
@@ -33,6 +33,9 @@ exec 5-
 if [ x@SUPERMIN_PACKAGER_CONFIG@ != xno ]; then
 extra=--yum-config @SUPERMIN_PACKAGER_CONFIG@
 fi
+if [ x@SUPERMIN_EXTRA_OPTIONS@ != xno ]; then
+extra=$extra @SUPERMIN_EXTRA_OPTIONS@
+fi
 
 echo @SUPERMIN@ -v -o supermin.d --names $( packagelist ) $excludes $extra
 @SUPERMIN@ -v -o supermin.d --names $( packagelist ) $excludes $extra
diff --git a/configure.ac b/configure.ac
index f94a411..87d517b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -473,6 +473,19 @@ AC_ARG_WITH([febootstrap-packager-config],
 
 AC_SUBST([SUPERMIN_PACKAGER_CONFIG])
 
+dnl Pass additional supermin options.
+dnl
+SUPERMIN_EXTRA_OPTIONS=no
+AC_MSG_CHECKING([for --with-supermin-extra-options option])
+AC_ARG_WITH([supermin-extra-options],
+[AS_HELP_STRING([--with-supermin-extra-options=STRING],
+[Pass additional supermin options. @:@default=no@:@])],
+[SUPERMIN_EXTRA_OPTIONS=$withval
+ AC_MSG_RESULT([$SUPERMIN_EXTRA_OPTIONS])],
+[AC_MSG_RESULT([not set])])
+
+AC_SUBST([SUPERMIN_EXTRA_OPTIONS])
+
 if test x$enable_appliance = xyes; then
 test x$SUPERMIN = xno 
 AC_MSG_ERROR([supermin (formerly called febootstrap) must be 
installed])

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH 1/2] add run_shell helper

2013-04-09 Thread Olaf Hering
The new run_shell helper is a copy of run_python,
and will be used by upcoming changes.

Signed-off-by: Olaf Hering o...@aepfle.de
---
 src/supermin_utils.ml  | 9 +
 src/supermin_utils.mli | 5 +
 2 files changed, 14 insertions(+)

diff --git a/src/supermin_utils.ml b/src/supermin_utils.ml
index f98e09a..cb8a27e 100644
--- a/src/supermin_utils.ml
+++ b/src/supermin_utils.ml
@@ -70,6 +70,15 @@ let run_command cmd =
 exit 1
   )
 
+let run_shell code args =
+  let cmd = sprintf sh -c %s arg0 %s
+(Filename.quote code)
+(String.concat   (List.map Filename.quote args)) in
+  if Sys.command cmd  0 then (
+eprintf supermin: external shell program failed, see earlier error 
messages\n;
+exit 1
+  )
+
 let run_python code args =
   let cmd = sprintf python -c %s %s
 (Filename.quote code)
diff --git a/src/supermin_utils.mli b/src/supermin_utils.mli
index 54df1e8..c4a52c6 100644
--- a/src/supermin_utils.mli
+++ b/src/supermin_utils.mli
@@ -41,6 +41,11 @@ val run_command : string - unit
   when constructing the command to properly quote any arguments
   (using {!Filename.quote}). *)
 
+val run_shell : string - string list - unit
+  (** [run_shell code args] runs shell [code] with arguments [args].
+  This does not return anything, but exits with an error message
+  if the shell code returns an error. *)
+
 val run_python : string - string list - unit
   (** [run_python code args] runs Python [code] with arguments [args].
   This does not return anything, but exits with an error message

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] build failures due to missing rpl_optarg

2013-02-25 Thread 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

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] daemon: copy entire lvm directory

2013-01-18 Thread Olaf Hering
On Fri, Jan 18, Richard W.M. Jones wrote:

 On Thu, Jan 17, 2013 at 02:14:00PM +, Richard W.M. Jones wrote:
  On Wed, Jan 02, 2013 at 04:13:06PM +0100, Olaf Hering wrote:
   cp will fail if /etc/lvm is an empty directory. Copy the entire
   directory and adjust environment variable.
  
  Thanks - pushed.  I changed the whitespace and removed some
  unnecessary parens in this line:
  
   +  snprintf(env, sizeof(env), %s/lvm, lvm_system_dir);
 
 Actually this breaks the lvm_set_filter test and clearing the LVM
 cache (since they expect to find lvm_system_dir/lvm.conf but the file
 has now moved to lvm_system_dir/lvm/lvm.conf).  I added this patch to
 fix it:

Sorry for that, and thanks for the followup fix.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] ruby: add -DGUESTFS_PRIVATE_FUNCTIONS=1 to CFLAGS

2013-01-17 Thread Olaf Hering
On Thu, Jan 17, Richard W.M. Jones wrote:

 On Wed, Jan 02, 2013 at 07:27:54PM +0100, Olaf Hering wrote:
  -  #{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE_FUNCTIONS=1  
  +  #{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE_FUNCTIONS=1 
  -DGUESTFS_PRIVATE_FUNCTIONS=1 
 @WARN_CFLAGS@ @WERROR_CFLAGS@
 
 I may be missing something, but doesn't this add
 -DGUESTFS_PRIVATE_FUNCTIONS=1 twice?

Indeed. I will double check whats wrong.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] enable build for ocaml bytecode

2013-01-17 Thread Olaf Hering
On Thu, Jan 17, Richard W.M. Jones wrote:

 On Wed, Jan 16, 2013 at 05:51:53PM +0100, Olaf Hering wrote:
  On Mon, Jan 14, Olaf Hering wrote:
  
   This is a first attempt to build libguestfs with just a ocaml bytecode
   compiler. The three tools written in ocaml will be build only when an
   ocamlopt compiler is available.
  
  Here is a more complete change which covers also resize, sysprep and
  sparsify. ocaml/examples are still disabled.
  
 
 Generally looks good.  Did you want to submit this second version or
 should we wait for more?

If the approach is ok I will convert also ocaml/examples and submit a
final patch.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] enable build for ocaml bytecode

2013-01-16 Thread Olaf Hering
On Mon, Jan 14, Olaf Hering wrote:

 This is a first attempt to build libguestfs with just a ocaml bytecode
 compiler. The three tools written in ocaml will be build only when an
 ocamlopt compiler is available.

Here is a more complete change which covers also resize, sysprep and
sparsify. ocaml/examples are still disabled.

Olaf

---
 configure.ac   |2 ++
 ocaml/Makefile.am  |   20 +---
 ocaml/examples/Makefile.am |2 +-
 resize/Makefile.am |   32 
 sparsify/Makefile.am   |   28 ++--
 sysprep/Makefile.am|   28 ++--
 6 files changed, 100 insertions(+), 12 deletions(-)

Index: libguestfs-1.20.1/configure.ac
===
--- libguestfs-1.20.1.orig/configure.ac
+++ libguestfs-1.20.1/configure.ac
@@ -865,6 +865,8 @@ AS_IF([test x$enable_ocaml != xno],
 ])
 AM_CONDITIONAL([HAVE_OCAML],
[test x$OCAMLC != xno  test x$OCAMLFIND != xno])
+AM_CONDITIONAL([HAVE_OCAMLOPT],
+   [test x$OCAMLOPT != xno  test x$OCAMLC != xno  test 
x$OCAMLFIND != xno])
 AM_CONDITIONAL([HAVE_OCAMLDOC],
[test x$OCAMLDOC != xno])
 
Index: libguestfs-1.20.1/ocaml/Makefile.am
===
--- libguestfs-1.20.1.orig/ocaml/Makefile.am
+++ libguestfs-1.20.1/ocaml/Makefile.am
@@ -43,10 +43,20 @@ CLEANFILES += t/*.cmi t/*.cmo t/*.cmx t/
 
 if HAVE_OCAML
 
+DATA_HOOK_FILES = META *.so *.a *.cma \
+ *.cmi $(srcdir)/*.mli
+if HAVE_OCAMLOPT
+DATA_HOOK_FILES += *.cmx *.cmxa
+endif
+
 OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX
 OCAMLOPTFLAGS = $(OCAMLCFLAGS)
 
-noinst_DATA = mlguestfs.cma mlguestfs.cmxa META
+noinst_DATA = mlguestfs.cma
+if HAVE_OCAMLOPT
+noinst_DATA += mlguestfs.cmxa
+endif
+noinst_DATA += META
 
 # Build the C part into a library, so that automake handles the C
 # compilation step for us.  Note that we don't directly use this
@@ -101,9 +111,13 @@ TESTS = run-bindtests \
$(patsubst %,%.opt,$(test_progs)))
 
 noinst_DATA += \
-   bindtests.bc bindtests.opt \
+   bindtests.bc
+if HAVE_OCAMLOPT
+noinst_DATA += \
+   bindtests.opt \
$(test_progs:%=%.bc) \
$(test_progs:%=%.opt)
+endif
 
 bindtests.bc: bindtests.cmo mlguestfs.cma
mkdir -p t
@@ -217,7 +231,7 @@ install-data-hook:
$(OCAMLFIND) install \
  -ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
  guestfs \
- META *.so *.a *.cma *.cmx *.cmxa *.cmi $(srcdir)/*.mli
+ $(DATA_HOOK_FILES)
rm $(DESTDIR)$(OCAMLLIB)/guestfs/bindtests.*
rm $(DESTDIR)$(OCAMLLIB)/guestfs/libguestfsocaml.a
 
Index: libguestfs-1.20.1/ocaml/examples/Makefile.am
===
--- libguestfs-1.20.1.orig/ocaml/examples/Makefile.am
+++ libguestfs-1.20.1/ocaml/examples/Makefile.am
@@ -41,7 +41,7 @@ stamp-guestfs-ocaml.pod: guestfs-ocaml.p
  $
touch $@
 
-if HAVE_OCAML
+if HAVE_OCAMLOPT
 
 noinst_SCRIPTS = create_disk inspect_vm
 
Index: libguestfs-1.20.1/resize/Makefile.am
===
--- libguestfs-1.20.1.orig/resize/Makefile.am
+++ libguestfs-1.20.1/resize/Makefile.am
@@ -43,7 +43,15 @@ SOURCES = \
 if HAVE_OCAML
 
 # Note this list must be in dependency order.
-OBJECTS = \
+OBJECTS_bc = \
+   $(top_builddir)/fish/guestfish-progress.o \
+   progress-c.o \
+   resize_gettext.cmo \
+   resize_utils.cmo \
+   progress.cmo \
+   resize.cmo
+
+OBJECTS_opt = \
$(top_builddir)/fish/guestfish-progress.o \
progress-c.o \
resize_gettext.cmx \
@@ -51,26 +59,42 @@ OBJECTS = \
progress.cmx \
resize.cmx
 
+if HAVE_OCAMLOPT
+FINAL_BINARY = virt-resize.opt
+else
+FINAL_BINARY = virt-resize.bc
+endif
 bin_SCRIPTS = virt-resize
 
 # -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
 # option to be passed to gcc, so we don't try linking against an
 # installed copy of libguestfs.
-OCAMLPACKAGES = -package str,unix -I $(top_builddir)/src/.libs -I ../ocaml
+OCAMLPACKAGES = -package str,unix -I ../ocaml -I .
 if HAVE_OCAML_PKG_GETTEXT
 OCAMLPACKAGES += -package gettext-stub
 endif
 
 OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX $(OCAMLPACKAGES)
-OCAMLOPTFLAGS = $(OCAMLCFLAGS)
+OCAMLOPTFLAGS = -I $(top_builddir)/src/.libs $(OCAMLCFLAGS)
 
-virt-resize: $(OBJECTS)
+virt-resize.bc: $(OBJECTS_bc)
+   $(top_builddir)/libtool -dlopen $(top_builddir)/src/.libs/libguestfs.la 
--mode=execute \
+   $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
+ -custom \
+ mlguestfs.cma -linkpkg $^ \
+ $(OCAML_GCOV_LDFLAGS) \
+ -o $@
+
+virt-resize.opt: $(OBJECTS_opt)
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
  mlguestfs.cmxa -linkpkg $^ \
  -cclib -lncurses \
  $(OCAML_GCOV_LDFLAGS

[Libguestfs] enable build for ocaml bytecode

2013-01-14 Thread Olaf Hering

This is a first attempt to build libguestfs with just a ocaml bytecode
compiler. The three tools written in ocaml will be build only when an
ocamlopt compiler is available.

Olaf

---
 Makefile.am  |5 -
 configure.ac |2 ++
 ocaml/Makefile.am|   20 +---
 resize/Makefile.am   |2 +-
 sparsify/Makefile.am |2 +-
 sysprep/Makefile.am  |2 +-
 6 files changed, 26 insertions(+), 7 deletions(-)

Index: libguestfs-1.20.1/Makefile.am
===
--- libguestfs-1.20.1.orig/Makefile.am
+++ libguestfs-1.20.1/Makefile.am
@@ -74,7 +74,10 @@ if HAVE_PERL
 SUBDIRS += perl perl/examples
 endif
 if HAVE_OCAML
-SUBDIRS += ocaml ocaml/examples
+SUBDIRS += ocaml
+endif
+if HAVE_OCAMLOPT
+SUBDIRS += ocaml/examples
 endif
 if HAVE_PYTHON
 SUBDIRS += python python/examples
Index: libguestfs-1.20.1/configure.ac
===
--- libguestfs-1.20.1.orig/configure.ac
+++ libguestfs-1.20.1/configure.ac
@@ -865,6 +865,8 @@ AS_IF([test x$enable_ocaml != xno],
 ])
 AM_CONDITIONAL([HAVE_OCAML],
[test x$OCAMLC != xno  test x$OCAMLFIND != xno])
+AM_CONDITIONAL([HAVE_OCAMLOPT],
+   [test x$OCAMLOPT != xno  test x$OCAMLC != xno  test 
x$OCAMLFIND != xno])
 AM_CONDITIONAL([HAVE_OCAMLDOC],
[test x$OCAMLDOC != xno])
 
Index: libguestfs-1.20.1/ocaml/Makefile.am
===
--- libguestfs-1.20.1.orig/ocaml/Makefile.am
+++ libguestfs-1.20.1/ocaml/Makefile.am
@@ -43,10 +43,20 @@ CLEANFILES += t/*.cmi t/*.cmo t/*.cmx t/
 
 if HAVE_OCAML
 
+DATA_HOOK_FILES = META *.so *.a *.cma \
+ *.cmi $(srcdir)/*.mli
+if HAVE_OCAMLOPT
+DATA_HOOK_FILES += *.cmx *.cmxa
+endif
+
 OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX
 OCAMLOPTFLAGS = $(OCAMLCFLAGS)
 
-noinst_DATA = mlguestfs.cma mlguestfs.cmxa META
+noinst_DATA = mlguestfs.cma
+if HAVE_OCAMLOPT
+noinst_DATA += mlguestfs.cmxa
+endif
+noinst_DATA += META
 
 # Build the C part into a library, so that automake handles the C
 # compilation step for us.  Note that we don't directly use this
@@ -101,9 +111,13 @@ TESTS = run-bindtests \
$(patsubst %,%.opt,$(test_progs)))
 
 noinst_DATA += \
-   bindtests.bc bindtests.opt \
+   bindtests.bc
+if HAVE_OCAMLOPT
+noinst_DATA += \
+   bindtests.opt \
$(test_progs:%=%.bc) \
$(test_progs:%=%.opt)
+endif
 
 bindtests.bc: bindtests.cmo mlguestfs.cma
mkdir -p t
@@ -217,7 +231,7 @@ install-data-hook:
$(OCAMLFIND) install \
  -ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
  guestfs \
- META *.so *.a *.cma *.cmx *.cmxa *.cmi $(srcdir)/*.mli
+ $(DATA_HOOK_FILES)
rm $(DESTDIR)$(OCAMLLIB)/guestfs/bindtests.*
rm $(DESTDIR)$(OCAMLLIB)/guestfs/libguestfsocaml.a
 
Index: libguestfs-1.20.1/resize/Makefile.am
===
--- libguestfs-1.20.1.orig/resize/Makefile.am
+++ libguestfs-1.20.1/resize/Makefile.am
@@ -40,7 +40,7 @@ SOURCES = \
resize_utils.ml \
resize_utils_tests.ml
 
-if HAVE_OCAML
+if HAVE_OCAMLOPT
 
 # Note this list must be in dependency order.
 OBJECTS = \
Index: libguestfs-1.20.1/sparsify/Makefile.am
===
--- libguestfs-1.20.1.orig/sparsify/Makefile.am
+++ libguestfs-1.20.1/sparsify/Makefile.am
@@ -36,7 +36,7 @@ SOURCES = \
sparsify_gettext.ml \
sparsify_utils.ml
 
-if HAVE_OCAML
+if HAVE_OCAMLOPT
 
 # Note this list must be in dependency order.
 OBJECTS = \
Index: libguestfs-1.20.1/sysprep/Makefile.am
===
--- libguestfs-1.20.1.orig/sysprep/Makefile.am
+++ libguestfs-1.20.1/sysprep/Makefile.am
@@ -86,7 +86,7 @@ SOURCES = \
utils.ml \
utils.mli
 
-if HAVE_OCAML
+if HAVE_OCAMLOPT
 
 # Note this list must be in dependency order.
 OBJECTS = \

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] rb_alloc_func_t undeclared in ruby 1.8

2013-01-03 Thread Olaf Hering

ruby bindings fail to build with ruby 1.8.7 because rb_alloc_func_t does
not exist in this version of ruby. This happens due to commit
448a02373df95dafc0d4b3e4db0e77c96a09074d

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH] daemon: copy entire lvm directory

2013-01-02 Thread Olaf Hering
cp will fail if /etc/lvm is an empty directory. Copy the entire
directory and adjust environment variable.

Signed-off-by: Olaf Hering o...@aepfle.de
---
 daemon/lvm-filter.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/daemon/lvm-filter.c b/daemon/lvm-filter.c
index 52d6b3d..204e238 100644
--- a/daemon/lvm-filter.c
+++ b/daemon/lvm-filter.c
@@ -47,7 +47,7 @@ void
 copy_lvm (void)
 {
   struct stat statbuf;
-  char cmd[64];
+  char cmd[64], env[64];
   int r;
 
   /* If /etc/lvm directory doesn't exist (or isn't a directory) assume
@@ -68,8 +68,8 @@ copy_lvm (void)
 exit (EXIT_FAILURE);
   }
 
-  /* Hopefully no dotfiles in there ... XXX */
-  snprintf (cmd, sizeof cmd, %s -a /etc/lvm/* %s, str_cp, lvm_system_dir);
+  /* Copy the entire directory */
+  snprintf (cmd, sizeof cmd, %s -a /etc/lvm/ %s, str_cp, lvm_system_dir);
   r = system (cmd);
   if (r == -1) {
 perror (cmd);
@@ -85,7 +85,8 @@ copy_lvm (void)
   }
 
   /* Set environment variable so we use the copy. */
-  setenv (LVM_SYSTEM_DIR, lvm_system_dir, 1);
+  snprintf(env, sizeof(env), %s/lvm, lvm_system_dir);
+  setenv (LVM_SYSTEM_DIR, env, 1);
 
   /* Set a handler to remove the temporary directory at exit. */
   atexit (rm_lvm_system_dir);
-- 
1.8.0.1

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH] ruby: add -DGUESTFS_PRIVATE_FUNCTIONS=1 to CFLAGS

2013-01-02 Thread Olaf Hering
Signed-off-by: Olaf Hering o...@aepfle.de
---

This, and the CFLAGS change it depends on should be backported to 1.20.x

 ruby/ext/guestfs/extconf.rb.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ruby/ext/guestfs/extconf.rb.in b/ruby/ext/guestfs/extconf.rb.in
index 15259ea..808ff9e 100644
--- a/ruby/ext/guestfs/extconf.rb.in
+++ b/ruby/ext/guestfs/extconf.rb.in
@@ -30,7 +30,7 @@ unless have_library(guestfs, guestfs_create, guestfs.h)
 end
 
 $CFLAGS =
-  #{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE_FUNCTIONS=1  
+  #{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE_FUNCTIONS=1 
-DGUESTFS_PRIVATE_FUNCTIONS=1 
   @WARN_CFLAGS@ @WERROR_CFLAGS@
 
 create_header
-- 
1.8.0.1

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] febootstrap and zypper

2012-11-30 Thread Olaf Hering
On Fri, Nov 30, Richard W.M. Jones wrote:

 On Thu, Nov 29, 2012 at 10:24:54PM +0100, Olaf Hering wrote:
  On Thu, Nov 29, Richard W.M. Jones wrote:
  
   On Thu, Nov 29, 2012 at 09:02:34PM +, Richard W.M. Jones wrote:
 zypper \
 --verbose \
 --verbose \
 --gpg-auto-import-keys \
 --root /dev/shm/${LOGNAME} \
 --reposd-dir /etc/zypp/repos.d \
 --pkg-cache-dir /dev/shm/${LOGNAME}--pkg-cache-dir \
 --non-interactive \
 install \
 --auto-agree-with-licenses \
 --no-recommends \
 --download-only \
 kernel-default
   
   By the way, does this download everything (even, for example,
   packages which are already installed at the latest version)?
  
  It will download kernel-default from the configured repos in
  /etc/zypp/repos.d into --pkg-cache-dir. Installed packaged will not be
  considered.
 
 I was reading the last sentence again this morning.  Did I
 misunderstand it?  Does this zypper command not consider installed
 packages and download all of them regardless of what is installed on
 the host?

I think it does. With the --root option above it considers only packages
within that directory. Other than that, I think only --pkg-cache-dir
needs to be set because an unprivileged user has no write permissions in
/var/cache/zypp.

So I think if febootstrap takes files from the installed system and in
addition looks at the possibly downloaded packages then all should be
fine.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] febootstrap and zypper

2012-11-29 Thread Olaf Hering
On Mon, Oct 08, Richard W.M. Jones wrote:

 On Mon, Oct 08, 2012 at 08:50:47PM +0200, Olaf Hering wrote:
  On Mon, Oct 08, Richard W.M. Jones wrote:
  
   But out of interest, how are you creating this appliance?  I thought
   we'd ripped out support for old-style appliances from the rest of the
   toolchain ...
  
  I use mkinitrd to pull in all tools and run guestfsd instead of
  /sysroot/sbin/init. This allows me to build the package automated as
  unprivileged user in the buildsystem. Creating a loop file requires
  root, which is cumbersome in the openSuSE buildservice.
 
 BTW, febootstrap (which is what we use) runs unprivileged and should
 be able to process SuSE rpms.  However it does require yum, not
 zypper, but that's probably easy to fix if zypper has a way to take a
 list of package names and resolve all the dependencies without needing
 root and without needing to install any packages.

I just looked at this.

Does febootstrap do some sort of unrpm? Does it call %pre/%post install
scripts? 

zypper alone can not be used because it calls rpm, which does chroot.
It can however download the required rpms and place them into a
directory:

zypper \
--verbose \
--verbose \
--gpg-auto-import-keys \
--root /dev/shm/${LOGNAME} \
--reposd-dir /etc/zypp/repos.d \
--pkg-cache-dir /dev/shm/${LOGNAME}--pkg-cache-dir \
--non-interactive \
install \
--auto-agree-with-licenses \
--no-recommends \
--download-only \
kernel-default

So what do you suggest to do on a system with zypper/libzypp?

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH] lua: fix build error due to LUA_GLOBALSINDEX usage

2012-11-23 Thread Olaf Hering
lua 5.2 changed API, LUA_GLOBALSINDEX is no longer available.
http://www.lua.org/manual/5.2/manual.html#8.3

Signed-off-by: Olaf Hering o...@aepfle.de
---

Fix is only compile tested.

 generator/lua.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/generator/lua.ml b/generator/lua.ml
index 88748ae..7461cbd 100644
--- a/generator/lua.ml
+++ b/generator/lua.ml
@@ -723,7 +723,7 @@ push_int64_array (lua_State *L, const int64_t *array, 
size_t len)
 static void
 print_any (lua_State *L, int index, FILE *out)
 {
-  lua_getfield (L, LUA_GLOBALSINDEX, \tostring\);
+  lua_getglobal(L, \tostring\);
   lua_pushvalue (L, index = 0 ? index : index-1);
   lua_call (L, 1, 1);
   fprintf (out, \%%s\, luaL_checkstring (L, -1));
-- 
1.8.0

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] sysprep: remove crash data generated by kexec-tools

2012-11-21 Thread Olaf Hering
On Wed, Nov 21, Wanlong Gao wrote:

 +  heading = s_Remove the crash data generated by kexec-tools;
 +  pod_description = Some (s_\
 +Remove the automatically generated kdump kernel crash data in
 +C/var/crash/.);

Is that the standard location? At least in SLES its /var/log/dump/

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] Notes on compiling libguestfs 1.19.59 on Debian 7 (Wheezy) beta

2012-11-14 Thread Olaf Hering
On Wed, Nov 14, Richard W.M. Jones wrote:

 In no particular order.  Some of these need further investigation.
 
 --
 
 I had to patch libguestfs not to use febootstrap-supermin-helper
 --copy-kernel option.  See attachment #1.  This could be avoided by
 providing a newer febootstrap in Wheezy.
 
 I had to patch libguestfs to make it not use the (not working)
 virtio-scsi in old kvm.  See attachment #2.

This is the patch I use to force virtio-blk for sles11sp2, opensuse12.1
and older:


# From 61db8e97180efa70243d8b7b116f11ca1f36b375 Mon Sep 17 00:00:00 2001
# From: Olaf Hering o...@aepfle.de
# Date: Mon, 3 Sep 2012 19:50:44 +0200
# Subject: [PATCH] force virtio_blk in old guest kernel

Signed-off-by: Olaf Hering o...@aepfle.de
---
 df/output.c| 13 +
 fish/options.c |  8 +++-
 src/guestfs-internal.h |  2 ++
 src/handle.c   | 16 
 src/inspect-fs-unix.c  |  4 ++--
 src/launch-appliance.c |  3 +++
 src/launch-libvirt.c   |  7 +++
 test-tool/test-tool.c  | 16 +---
 8 files changed, 59 insertions(+), 10 deletions(-)

diff --git a/df/output.c b/df/output.c
index 5729dd4..fb33ca1 100644
--- a/df/output.c
+++ b/df/output.c
@@ -42,6 +42,7 @@
 #include virt-df.h
 
 static void write_csv_field (const char *field);
+static int use_virtio_blk;
 
 void
 print_title (void)
@@ -82,7 +83,7 @@ print_title (void)
   }
 }
 
-static char *adjust_device_offset (const char *device, int offset);
+static char *adjust_device_offset (guestfs_h *g, const char *device, int 
offset);
 
 void
 print_stat (const char *name, const char *uuid_param,
@@ -110,7 +111,7 @@ print_stat (const char *name, const char *uuid_param,
 exit (EXIT_FAILURE);
   if (offset = 0) {
 char *p = dev;
-dev = adjust_device_offset (p, offset);
+dev = adjust_device_offset (g, p, offset);
 free (p);
   }
 
@@ -237,8 +238,9 @@ write_csv_field (const char *field)
 static char *drive_name (int index, char *ret);
 
 static char *
-adjust_device_offset (const char *device, int offset)
+adjust_device_offset (guestfs_h *g, const char *device, int offset)
 {
+  ;
   int index;
   int part_num;
   char *whole_device;
@@ -282,7 +284,10 @@ adjust_device_offset (const char *device, int offset)
 exit (EXIT_FAILURE);
   }
 
-  strcpy (ret, /dev/sd);
+#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK
+  use_virtio_blk = 1;
+#endif
+  strcpy (ret, use_virtio_blk ? /dev/vd : /dev/sd);
   drive_name (index, ret[7]);
   len = strlen (ret);
   if (part_num  0)
diff --git a/fish/options.c b/fish/options.c
index 0db790e..54190bc 100644
--- a/fish/options.c
+++ b/fish/options.c
@@ -27,6 +27,8 @@
 
 #include options.h
 
+static int use_virtio_blk;
+
 char
 add_drives (struct drv *drv, char next_drive)
 {
@@ -40,13 +42,17 @@ add_drives (struct drv *drv, char next_drive)
 exit (EXIT_FAILURE);
   }
 
+#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK
+  use_virtio_blk = 1;
+#endif
+
   if (drv) {
 next_drive = add_drives (drv-next, next_drive);
 
 free (drv-device);
 drv-device = NULL;
 
-if (asprintf (drv-device, /dev/sd%c, next_drive) == -1) {
+if (asprintf (drv-device, /dev/%s%c, use_virtio_blk ? vd : sd, 
next_drive) == -1) {
   perror (asprintf);
   exit (EXIT_FAILURE);
 }
diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index 6e0b368..fe7b7dd 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
@@ -350,6 +350,8 @@ struct guestfs_h
 virDomainPtr dom;   /* libvirt domain */
   } virt;
 #endif
+
+  int use_virtio_blk;
 };
 
 /* Per-filesystem data stored for inspect_os. */
diff --git a/src/handle.c b/src/handle.c
index fd7db69..d9ecc5d 100644
--- a/src/handle.c
+++ b/src/handle.c
@@ -210,6 +210,22 @@ parse_environment (guestfs_h *g,
   return -1;
   }
 
+/*
+ * Currently virtio_scsi is forced if qemu in the host supports this
+ * feature. This test does however not take the capabilities of the started
+ * guest into account. As a result no disks will be found if the guest
+ * kernel is older than 3.4.
+ */
+#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK
+  static const char env_string[] = GUESTFS_QEMU_NO_VIRTIO_BLK;
+  str = getenv(env_string);
+  g-use_virtio_blk = str == NULL;
+  if (str)
+debug (g, SuSE: %s in environment, preserving virtio-scsi setting., 
env_string);
+  else
+debug (g, SuSE: %s not in environment, preventing virtio-scsi usage in 
old guest kernel., env_string);
+#endif
+
   return 0;
 }
 
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
index a48d176..b2d6766 100644
--- a/src/inspect-fs-unix.c
+++ b/src/inspect-fs-unix.c
@@ -1411,7 +1411,7 @@ resolve_fstab_device_diskbyid (guestfs_h *g, const char 
*part,
 return 0;
 
   /* Make the partition name and check it exists. */
-  device = safe_asprintf (g, /dev/sda%s, part);
+  device = safe_asprintf (g, /dev/%sa%s, g-use_virtio_blk ? vd : sd, 
part);
   if (!is_partition (g, device)) {
 free (device

Re: [Libguestfs] building resize fails due to lack of Unix module

2012-10-22 Thread Olaf Hering
On Mon, Oct 22, Richard W.M. Jones wrote:

 This is actually a bug in resize/Makefile.am introduced by a0722c7a.
 It was masked if you had the optional ocaml-gettext package installed
 because that implicitly depends on Unix.  Try the attached patch.

Thanks, this patch fixes the build failures.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] building resize fails due to lack of Unix module

2012-10-19 Thread Olaf Hering

Building 1.9.53 fails for me with ocaml 3.10.2 and 3.12.1, likely due to
commit a0722c7ad846960be54978a31ebe73b76e119203:

[  318s] ocamlfind ocamlopt -g -warn-error CDEFLMPSUVYZX -package str -I 
../src/.libs -I ../ocaml  \
[  318s]  mlguestfs.cmxa -linkpkg ../fish/guestfish-progress.o 
progress-c.o resize_gettext.cmx resize_utils.cmx progress.cmx resize.cmx -cclib 
-lncurses -o virt-resize
[  318s] No implementations provided for the following modules:
[  318s]   Unix referenced from progress.cmx
[  318s] make[2]: *** [virt-resize] Error 2
[  318s] make[2]: Leaving directory 
`/usr/src/packages/BUILD/libguestfs-1.19.53/resize'

I'm not sure where Unix is supposed to come from, the Printf files exist:

bax:~ rpm -ql ocaml | grep -iw unix
/usr/lib64/ocaml/unix.a
/usr/lib64/ocaml/unix.cma
/usr/lib64/ocaml/unix.cmi
/usr/lib64/ocaml/unix.cmx
/usr/lib64/ocaml/unix.cmxa
/usr/lib64/ocaml/unix.mli
/usr/lib64/ocaml/vmthreads/unix.cma
bax:~ rpm -ql ocaml | grep -iw printf
/usr/lib64/ocaml/printf.cmi
/usr/lib64/ocaml/printf.cmx
/usr/lib64/ocaml/printf.ml
/usr/lib64/ocaml/printf.mli
/usr/lib64/ocaml/printf.p.cmx
bax:~ 


Is the ocaml.rpm built or packaged incorrectly?

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] cdrom device handling

2012-10-12 Thread Olaf Hering

Is there a way for the tools to provide a configured cdrom as cdrom to
the temporary guest? Right now both disk and cdrom retrived from libvirt
will showup as disks in the temporary guest.

This happens for bus ide and scsi. It seems on my test system the guest
can not start from a scsi disk, but the scsi cdrom appears as scsi cdrom
in the guest. So I think its maybe just a matter of generating 'disk
type='file' device='cdrom'' instead of 'disk type='file'
device='disk''?

I'm using this command, which works ok for me:
virt-rescue -v -c qemu+ssh:///system  -d opensuse12 -r

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] launch: show hint to resolve authentication failure from libvirt

2012-10-12 Thread Olaf Hering
On Wed, Oct 10, Richard W.M. Jones wrote:

 libguestfs use of libvirt is a bit of a mess at the moment, since we
 end up opening two connections if you use the -d option ... this is
 something I'm intending to fix.
 
 Nevertheless, it should be using NULL everywhere, so depending on
 whether you run it as root or not, it will use qemu:///system
 or qemu:///session.
 
 It's somewhere on the to-do list to:
 
   (1) Fix the utilities so they only need to open one connection
   (this will matter in the remote case).
 
   (2) Support authentication in libvirt by mapping libvirt auth
   callbacks to libguestfs events.

Is this the reason why the first command fails, but the others work ok
for me?

virt-filesystems -v -c qemu+ssh:///system  -d sles11sp2 --all --long

virt-rescue -v -c qemu+ssh:///system  -d opensuse12 -r
virsh -c qemu+ssh:///system list --all


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] launch: show hint to resolve authentication failure from libvirt

2012-10-12 Thread Olaf Hering
On Fri, Oct 12, Richard W.M. Jones wrote:

 On Fri, Oct 12, 2012 at 04:20:50PM +0200, Olaf Hering wrote:
  On Wed, Oct 10, Richard W.M. Jones wrote:
  
   libguestfs use of libvirt is a bit of a mess at the moment, since we
   end up opening two connections if you use the -d option ... this is
   something I'm intending to fix.
   
   Nevertheless, it should be using NULL everywhere, so depending on
   whether you run it as root or not, it will use qemu:///system
   or qemu:///session.
   
   It's somewhere on the to-do list to:
   
 (1) Fix the utilities so they only need to open one connection
 (this will matter in the remote case).
   
 (2) Support authentication in libvirt by mapping libvirt auth
 callbacks to libguestfs events.
  
  Is this the reason why the first command fails, but the others work ok
  for me?
  
  virt-filesystems -v -c qemu+ssh:///system  -d sles11sp2 --all --long
  
  virt-rescue -v -c qemu+ssh:///system  -d opensuse12 -r
  virsh -c qemu+ssh:///system list --all
 
 virt-rescue doesn't use the libvirt backend.  See:

It gets the list of configured devices from libvirt at least. The
message it prints is clear about what you said:

...
virt-rescue: warning: virt-rescue doesn't work with the libvirt backend
at the moment.  As a workaround, forcing attach-method = 'appliance'.
...


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] cdrom device handling

2012-10-12 Thread Olaf Hering
On Fri, Oct 12, Richard W.M. Jones wrote:

 virt-rescue should come up with the disk and CD-ROM as /dev/sda and
 /dev/sdb respectively.  This should be enough to read the data off the
 CD (/dev/sdb).  What else would you want to do?

I have not tried it, but I can imagine the following can happen:
Depending on the order of devices a disk may come after the first cdrom.
So a disk 'sdb' in the guest may become 'sdc' in the guest. If one does
a chroot into the guest to do some fixup _and_ if something within that
guest is configured to use kernel device names (like sdb) instead of
LABEL/UUID then failures can occur.

So its just about providing some correctness in virt-rescue.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] launch: show hint to resolve authentication failure from libvirt

2012-10-11 Thread Olaf Hering
On Wed, Oct 10, Daniel P. Berrange wrote:

 It depends on what instance of libvirtd you are connecting to.
 
  - The system instance, runs as root and requirs non-root users
to auth with policykit
 
  - The session instance, runs as the same user id as the client
app and does not require auth.
 
 Since libguestfs passes NULL for the URI, it will be connecting
 to the session instance if libguestfs is non-root and thus not
 require any auth. If libguestfs is run as root it will connect
 to the system instance which requires polkit auth, but root already
 has that granted.

Thanks for that summary.

Today I tried it with a openSuSE 12.2 system, which is more uptodate
than a sles11sp2.
Running libguestfs-test-tool fails because root starts a kvm guest, while a
user starts a qemu guest. I think once the os type is correct for type 'qemu'
it will work.

Olaf

olaf@stein-schneider:~ libguestfs-test-tool
 
 *IMPORTANT NOTICE
 *
 * When reporting bugs, include the COMPLETE, UNEDITED
 * output below in your bug report.
 *
 
= Test starts here =
PATH=/home/olaf/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games
library version: 1.19.49
guestfs_get_append: (null)
guestfs_get_attach_method: libvirt
guestfs_get_autosync: 1
guestfs_get_direct: 0
guestfs_get_memsize: 500
guestfs_get_network: 0
guestfs_get_path: /usr/lib64/guestfs
guestfs_get_pgroup: 0
guestfs_get_qemu: /usr/bin/qemu-kvm
guestfs_get_recovery_proc: 1
guestfs_get_selinux: 0
guestfs_get_smp: 1
guestfs_get_trace: 0
guestfs_get_verbose: 1
host_cpu: x86_64
Launching appliance, timeout set to 600 seconds.
libguestfs: libvirt version = 10002
libguestfs: [0ms] connect to libvirt
libguestfs: [3ms] get libvirt capabilities
libguestfs: [00048ms] build appliance
libguestfs: [00048ms] create libvirt XML
libguestfs: libvirt XML:\n?xml version=1.0?\ndomain type=qemu 
xmlns:qemu=http://libvirt.org/schemas/domain/qemu/1.0;\n  
nameguestfs-fs1ubzlxkfco2kz9/name\n  memory unit=MiB500/memory\n  
currentMemory unit=MiB500/currentMemory\n  cpu model=host-model/\n  
vcpu1/vcpu\n  clock offset=utc/\n  os\ntypehvm/type\n
kernel/usr/lib64/guestfs/vmlinuz.x86_64/kernel\n
initrd/usr/lib64/guestfs/initramfs.x86_64.img/initrd\ncmdlinepanic=1 
console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 
cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=screen 
/cmdline\n  /os\n  on_rebootdestroy/on_reboot\n  devices\n
controller type=scsi index=0 model=virtio-scsi/\ndisk 
device=disk type=file\n  source 
file=/tmp/libguestfs-test-tool-sda-7iYTxF/\n  target dev=sda 
bus=scsi/\n  driver name=qemu type=raw cache=none/\n  
address type=drive contr!
 oller=0 bus=0 target=0 unit=0/\n/disk\nserial 
type=unix\n  source mode=connect 
path=/tmp/libguestfss1xgHv/console.sock/\n  target port=0/\n
/serial\nchannel type=unix\n  source mode=connect 
path=/tmp/libguestfss1xgHv/guestfsd.sock/\n  target type=virtio 
name=org.libguestfs.channel.0/\n/channel\n  /devices\n  
qemu:commandline/\n/domain\n
libguestfs: [00048ms] launch libvirt guest
libguestfs: error: could not create appliance through libvirt: unknown OS type 
hvm [code=16 domain=20]
libguestfs-test-tool: failed to launch appliance
libguestfs: closing guestfs handle 0x1608ec0 (state 0)


--- root2012-10-11 12:50:54.0 +0200
+++ olaf2012-10-11 12:51:15.0 +0200
@@ -1,7 +1,7 @@
 libguestfs: libvirt XML:
 ?xml version=1.0?
-domain type=kvm xmlns:qemu=http://libvirt.org/schemas/domain/qemu/1.0;
-  nameguestfs-zftfuc2yqwc8qhyk/name
+domain type=qemu xmlns:qemu=http://libvirt.org/schemas/domain/qemu/1.0;
+  nameguestfs-fs1ubzlxkfco2kz9/name
   memory unit=MiB500/memory
   currentMemory unit=MiB500/currentMemory
   cpu model=host-model/
@@ -17,17 +17,17 @@ libguestfs: libvirt XML:
   devices
 controller type=scsi index=0 model=virtio-scsi/
 disk device=disk type=file
-  source file=/tmp/libguestfs-test-tool-sda-uzaB2z/
+  source file=/tmp/libguestfs-test-tool-sda-7iYTxF/
   target dev=sda bus=scsi/
   driver name=qemu type=raw cache=none/
   address type=drive controller=0 bus=0 target=0 unit=0/
 /disk
 serial type=unix
-  source mode=connect path=/tmp/libguestfs3kAQMc/console.sock/
+  source mode=connect path=/tmp/libguestfss1xgHv/console.sock/
   target port=0/
 /serial
 channel type=unix
-  source mode=connect path=/tmp/libguestfs3kAQMc/guestfsd.sock/
+  source mode=connect path=/tmp/libguestfss1xgHv/guestfsd.sock/
   target type=virtio name=org.libguestfs.channel.0/
 /channel
   /devices




___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] launch: show hint to resolve authentication failure from libvirt

2012-10-11 Thread Olaf Hering
On Thu, Oct 11, Daniel P. Berrange wrote:

 Hmm, on Fedora non-root is able to use KVM just fine. If you have a
 new enough libvirt, you should have a 'virt-host-validate' command.
 Can you run that as both root and non-root and provide the output
 for each case.

The issue is that a user is not automatically in the kvm group, which however
does not prevent a successful run of 'LIBGUESTFS_ATTACH_METHOD=appliance
libguestfs-test-tool'.

root@stein-schneider:~ # virt-host-validate
  QEMU: Checking for hardware virtualization : 
PASS
  QEMU: Checking for device /dev/kvm : 
PASS
  QEMU: Checking for device /dev/vhost-net   : 
PASS
  QEMU: Checking for device /dev/net/tun : 
PASS
   LXC: Checking for Linux = 2.6.26 : 
PASS

olaf@stein-schneider:~ virt-host-validate
  QEMU: Checking for hardware virtualization : 
PASS
  QEMU: Checking for device /dev/kvm : 
FAIL (Check that the 'kvm-intel' or 'kvm-amd' modules are loaded  the BIOS has 
enabled virtualization)
  QEMU: Checking for device /dev/vhost-net   : 
WARN (Load the 'vhost_net' module to improve performance of virtio networking)
  QEMU: Checking for device /dev/net/tun : 
PASS
   LXC: Checking for Linux = 2.6.26 : 
PASS
olaf@stein-schneider:~ l /dev/kvm 
crw-rw 1 root kvm 10, 232 Okt 11 12:37 /dev/kvm
olaf@stein-schneider:~ id
uid=1000(olaf) gid=100(users) groups=100(users),33(video)

However, adding 'olaf' into group 'kvm' does not help to run
libguestfs-test-tool, its still a 'qemu' guest.


olaf@stein-schneider:~ virsh -c qemu:///session capabilities
capabilities

  host
uuid30826d35-f748-ac09-3792-1386d0a79891/uuid
cpu
  archx86_64/arch
  modelNehalem/model
  vendorIntel/vendor
  topology sockets='1' cores='4' threads='2'/
  feature name='rdtscp'/
  feature name='dca'/
  feature name='pdcm'/
  feature name='xtpr'/
  feature name='tm2'/
  feature name='est'/
  feature name='vmx'/
  feature name='ds_cpl'/
  feature name='monitor'/
  feature name='dtes64'/
  feature name='pbe'/
  feature name='tm'/
  feature name='ht'/
  feature name='ss'/
  feature name='acpi'/
  feature name='ds'/
  feature name='vme'/
/cpu
power_management
  suspend_disk/
/power_management
migration_features
  live/
  uri_transports
uri_transporttcp/uri_transport
  /uri_transports
/migration_features
topology
  cells num='1'
cell id='0'
  cpus num='8'
cpu id='0'/
cpu id='1'/
cpu id='2'/
cpu id='3'/
cpu id='4'/
cpu id='5'/
cpu id='6'/
cpu id='7'/
  /cpus
/cell
  /cells
/topology
secmodel
  modelnone/model
  doi0/doi
/secmodel
  /host

/capabilities


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] launch: show hint to resolve authentication failure from libvirt

2012-10-11 Thread Olaf Hering
On Thu, Oct 11, Daniel P. Berrange wrote:

 On Thu, Oct 11, 2012 at 01:10:16PM +0200, Olaf Hering wrote:
  However, adding 'olaf' into group 'kvm' does not help to run
  libguestfs-test-tool, its still a 'qemu' guest.
 Did you login + logout and restart libvirtd after adding yourself
 to the kvm group ?

Yes, id shows the new group.
 
 This is peculiar - it doesn't show any QEMU guests at all.
 What does 'virsh -c qemu:///system capabilities' report ?

I think a user has not enough permissions per default.

root@stein-schneider:~ # virsh -c qemu:///system capabilities
capabilities

  host
uuid1269ce01-fe8f-11d5-90fd-00265523ecea/uuid
cpu
  archx86_64/arch
  modelNehalem/model
  vendorIntel/vendor
  topology sockets='1' cores='4' threads='2'/
  feature name='rdtscp'/
  feature name='dca'/
  feature name='pdcm'/
  feature name='xtpr'/
  feature name='tm2'/
  feature name='est'/
  feature name='vmx'/
  feature name='ds_cpl'/
  feature name='monitor'/
  feature name='dtes64'/
  feature name='pbe'/
  feature name='tm'/
  feature name='ht'/
  feature name='ss'/
  feature name='acpi'/
  feature name='ds'/
  feature name='vme'/
/cpu
power_management
  suspend_disk/
/power_management
migration_features
  live/
  uri_transports
uri_transporttcp/uri_transport
  /uri_transports
/migration_features
topology
  cells num='1'
cell id='0'
  cpus num='8'
cpu id='0'/
cpu id='1'/
cpu id='2'/
cpu id='3'/
cpu id='4'/
cpu id='5'/
cpu id='6'/
cpu id='7'/
  /cpus
/cell
  /cells
/topology
secmodel
  modelnone/model
  doi0/doi
/secmodel
secmodel
  modeldac/model
  doi0/doi
/secmodel
  /host

  guest
os_typehvm/os_type
arch name='i686'
  wordsize32/wordsize
  emulator/usr/bin/qemu-kvm/emulator
  machinepc-1.1/machine
  machine canonical='pc-1.1'pc/machine
  machinepc-1.0/machine
  machinepc-0.15/machine
  machinepc-0.14/machine
  machinepc-0.13/machine
  machinepc-0.12/machine
  machinepc-0.11/machine
  machinepc-0.10/machine
  machineisapc/machine
  domain type='qemu'
  /domain
  domain type='kvm'
emulator/usr/bin/qemu-kvm/emulator
  /domain
/arch
features
  cpuselection/
  deviceboot/
  pae/
  nonpae/
  acpi default='on' toggle='yes'/
  apic default='on' toggle='no'/
/features
  /guest

  guest
os_typehvm/os_type
arch name='x86_64'
  wordsize64/wordsize
  emulator/usr/bin/qemu-kvm/emulator
  machinepc-1.1/machine
  machine canonical='pc-1.1'pc/machine
  machinepc-1.0/machine
  machinepc-0.15/machine
  machinepc-0.14/machine
  machinepc-0.13/machine
  machinepc-0.12/machine
  machinepc-0.11/machine
  machinepc-0.10/machine
  machineisapc/machine
  domain type='qemu'
  /domain
  domain type='kvm'
emulator/usr/bin/qemu-kvm/emulator
  /domain
/arch
features
  cpuselection/
  deviceboot/
  acpi default='on' toggle='yes'/
  apic default='on' toggle='no'/
/features
  /guest

/capabilities


Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] launch: show hint to resolve authentication failure from libvirt

2012-10-11 Thread Olaf Hering
On Thu, Oct 11, Olaf Hering wrote:

 On Thu, Oct 11, Daniel P. Berrange wrote:
 
  On Thu, Oct 11, 2012 at 01:10:16PM +0200, Olaf Hering wrote:
   However, adding 'olaf' into group 'kvm' does not help to run
   libguestfs-test-tool, its still a 'qemu' guest.
  Did you login + logout and restart libvirtd after adding yourself
  to the kvm group ?
 
 Yes, id shows the new group.

After some more testing with a new user it finally works if the given
user is in group 'kvm'. I made these user changes with yast, appearently
there is some syncing going on in the background. nscd does not run.
No idea why it initially failed for user 'olaf'.

So for short: its now working for me with 12.2, and 'virsh -c
qemu:///session capabilities' prints also os_type hvm.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


Re: [Libguestfs] [PATCH] launch: show hint to resolve authentication failure from libvirt

2012-10-11 Thread Olaf Hering
On Thu, Oct 11, Daniel P. Berrange wrote:

 Ah interesting. So this machine only has the qemu-kvm binary installed,
 none of the other non-KVM binaries.
 
 What is the version of libvirt that you have ? Until fairly recently
 libvirt would not detect the fact that /usr/bin/qemu-kvm was able to
 support non-KVM modes, which could be causing some of the pain here.

Its 0.10.2, which is what libguestfs expects at runtime.

Olaf

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


  1   2   >