Libguestfs (1.22.6) driver/changes for mingw/win32
by Or Goshen
Hi,
I attached the changes I made to a vanilla libguestfs-1.22.6 in order to
make it work in mingw/win32.
Added is also the patch required to make QEMU compatible (add a command to
QMP that lists the supported devices (the regilat way you do it print it to
stderr, which is difficult to redirect in win32)).
This is done on behalf of Intel Corp.
Thanks,
Or (oberon in irc)
10 years, 10 months
Handling different architectures in virt-builder
by Pino Toscano
Hi,
currently virt-builder's index contains only x86_64/amd64 images, so
asking virt-builder to produce an image always produce a x86_64 image,
regardless of the host. This also mean that trying to produce, say, a
new fedora-20 image from an i686 not only would produce an unexpected
result, but also would prevent to e.g. install packages on it.
So virt-builder and its index need to be able to distinguish the
architecture; choosing the architecture could be a --arch parameter for
virt-builder, but what about the keys in the index since it needs to
preserve compatibility with former versions?
Maybe a solution could be:
a) adding arch=.. keys in entries
b) rename (or just copy, to avoid breaking older virt-builders) keys to
$distro-$version-$arch
c) to not break compatibility with user input virt-builder joins
$user_selection + $arch = $user_selection-$arch, and looks in the
index
d) default $arch to `uname -m/p`, if --arch is not specified
Or maybe an even idea could be to give the index file a suffix with the
architecture name... although that could break users specifying an
absolute URL for an own index of distros...
Also, two side notes related to the "different architecture handling"
issue:
1) the naming of architectures can change between distros (e.g. amd64 vs
x86_64 vs x64, powerpc vs ppc) -- a simple hardcoded mapping in
virt-builder should do the job, I guess?
2) what should be done with commands/operations (e.g. --install) that
try to run stuff from the guest, when the host and guest
architectures are different? Always deny, deny but allow with a
configure switch, or don't bother and let the user get their failure?
--
Pino Toscano
10 years, 10 months
[PATCH] builder: add index-struct.h as dependency for index-parser-c.c
by Pino Toscano
Just like with index-parse.h, also index-struct.h is a dependency of
index-parser-c.c which automake cannot generate correctly.
Thus, add it manually.
---
builder/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builder/Makefile.am b/builder/Makefile.am
index fc4c552..6565abb 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -231,7 +231,7 @@ CLEANFILES += \
# Fix dependencies which automake doesn't generate correctly.
if HAVE_OCAML
-index-parser-c.o: index-parse.h
+index-parser-c.o: index-parse.h index-struct.h
index-scan.o: index-parse.h
endif
index-validate.o: index-parse.h
--
1.8.3.1
10 years, 10 months
[PATCH v2] builder: Fix dependencies which are not generated correctly by automake.
by Richard W.M. Jones
See the error messages here:
https://www.redhat.com/archives/libguestfs/2014-February/msg00148.html
This fixes commit e2cc8b6465a400024fe2f0fcce0d0ff5f7e7719c.
---
builder/Makefile.am | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/builder/Makefile.am b/builder/Makefile.am
index 3087ac4..6313bad 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -246,9 +246,11 @@ CLEANFILES += \
index-scan.c \
stamp-virt-index-validate.pod
-# Fix dependencies which automake doesn't generate correctly.
if HAVE_OCAML
-index-parser-c.o: index-parse.h index-struct.h
-index-scan.o: index-parse.h
+# Automake-generated makefile has a rule ".l.c:" but lacks a rule ".l.h:".
+# Also it doesn't generate dependencies for the C files that include
+# index-parse.h.
+index-parser-c.c index-scan.c index-validate.c: index-parse.h
+index-parse.h: index-parse.y
+ $(MAKE) index-parse.c
endif
-index-validate.o: index-parse.h
--
1.8.4.2
10 years, 10 months
[PATCH] builder: Really add extra dependencies on index-parse.h that automake doesn't generate correctly.
by Richard W.M. Jones
See:
https://www.redhat.com/archives/libguestfs/2014-February/msg00148.html
This updates commit e2cc8b6465a400024fe2f0fcce0d0ff5f7e7719c.
Also use $(OBJECT) instead of hard-coding the .o extension.
---
builder/Makefile.am | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/builder/Makefile.am b/builder/Makefile.am
index 3087ac4..39e6588 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -248,7 +248,7 @@ CLEANFILES += \
# Fix dependencies which automake doesn't generate correctly.
if HAVE_OCAML
-index-parser-c.o: index-parse.h index-struct.h
-index-scan.o: index-parse.h
+index-parser-c.$(OBJECT): index-parse.h index-struct.h
+index-scan.$(OBJECT): index-parse.h
endif
-index-validate.o: index-parse.h
+virt_index_validate-index-validate.$(OBJECT): index-parse.h
--
1.8.4.2
10 years, 10 months
Debugging nested KVM guest (L2) booting with libguestfs/gdb
by Kashyap Chamarthy
Heya,
With latest Fedora Rawhide Kernel, I see a nested KVM guest hanging at
boot (not unusual). Rich once suggested this[1] to try to attach gdb to
the nested L2 guest to find out where_ it's stuck, tonight I set out to
try it out (with KVM & TCG).
Below is all what I tried.
In guest hypervisor (L1):
$ git clone git://github.com/libguestfs/libguestfs.git
$ git log | head -1
commit 82a4a8f02c5706979d961ad6c4ac767a37a3a7c9
# Activate gdb debugging code by turning its
# conditional compilation directive: s/#if 0/#if 1
$ vi src/launch.c
[. . .] # Edit, save it
Double ensure the gdb pre-processor directive is turned on:
$ grep "\-S" src/launch-direct.c -A4 -B2
*/
#if 1
ADD_CMDLINE ("-S");
ADD_CMDLINE ("-s");
warning (g, "qemu debugging is enabled, connect gdb to tcp::1234 to begin");
#endif
Compile:
$ ./autogen.sh
$ make -j4
[. . .] # Compile, address anything that comes up
$ echo $?
0
Install Kernel-debug info:
$ yum install --enablerepo=fedora-debuginfo kernel-debuginfo
Enable the 'direct' backend and invoke the appliance using the `run` script:
$ export LIBGUESTFS_BACKEND=direct
$ ./run libguestfs-test-tool
The 'qemu-kvm' command-line just hung at:
$ ./run libguestfs-test-tool
[. . .]
-chardev socket,path=/home/tuser1/src/libguestfs/tmp/libguestfspCGc1F/guestfsd.sock,id=channel0 \
-device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
-append 'panic=1 console=ttyS0 udevtimeout=600 no_timer_check lpj=2294686 acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=screen'
Let's try with TCG
------------------
$ guestfish get_backend
direct
$ export LIBGUESTFS_BACKEND_SETTINGS=force_tcg
$ guestfish get_backend_settings
force_tcg
Run the appliance:
$ ./run libguestfs-test-tool
Again, `qemu-kvm` CLI just hung just like with KVM acceleration case
Try a couple more things
------------------------
- Run `qemu-sanity-check` in L1 -- Of course, this fails too.
- Invoke (from a different shell, as root) QEMU directly with gdb
debugging options -s -S with KVM on L1:
$ qemu-system-x86_64 -s -S -nographic -nodefconfig \
-nodefaults -machine accel=kvm -m 4000 \
-drive file=/home/tuser1/vmimages/fedora-20.qcow2,if=ide,format=qcow2,cache=none \
-serial stdio
Result: Just hung there.
Tru with TCG:
$ qemu-system-x86_64 -s -S -nographic -nodefconfig \
-nodefaults -machine accel=tcg -m 4000 \
-drive file=/home/tuser1/vmimages/fedora-20.qcow2,if=ide,format=qcow2,cache=none \
-serial stdio
to no avail: it's just hung there, again.
What else I can try?
Did I get this right or am I making any elementary mistake here? (I'm yet
to try on a different L1 guest on a different hardware, before that I
just wanted to run this by the list.)
Version info
------------
On L1:
$ virt-what
kvm
$ uname -r; rpm -q libvirt-daemon-kvm qemu-system-x86 \
libguestfs kernel-debuginfo
3.14.0-0.rc2.git0.1.fc21.x86_64
libvirt-daemon-kvm-1.2.1-2.fc21.x86_64
qemu-system-x86-1.7.0-4.fc21.x86_64
libguestfs-1.25.33-1.fc21.x86_64
kernel-debuginfo-3.11.10-301.fc20.x86_64
[1] https://github.com/libguestfs/libguestfs/blob/master/src/launch-direct.c#...
--
/kashyap
10 years, 10 months
[PATCH] test-tool: docs: update reference to febootstrap env variables
by Kashyap Chamarthy
---
test-tool/libguestfs-test-tool.pod | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test-tool/libguestfs-test-tool.pod b/test-tool/libguestfs-test-tool.pod
index c4284684f8c4ca3dfba0cb734d9cc46f0330b5b9..8999286848d79225c43c8fead674b998be93d4b3 100644
--- a/test-tool/libguestfs-test-tool.pod
+++ b/test-tool/libguestfs-test-tool.pod
@@ -87,7 +87,7 @@ variables C<SUPERMIN_KERNEL> and/or C<SUPERMIN_MODULES>
(C<FEBOOTSTRAP_KERNEL> and C<FEBOOTSTRAP_MODULES> if still using the
old febootstrap 3.21 program).
-Refer to L<supermin-helper(1)/ENVIRONMENT VARIABLES>
+Refer to L<febootstrap-supermin-helper(8)/ENVIRONMENT VARIABLES>
for further information.
=head1 TRYING OUT A DIFFERENT VERSION OF LIBVIRT
--
1.8.3.1
10 years, 10 months
[PATCH 1/2] nbdkit: Work around what seems like an bug in automake 1.14
by Hilko Bengen
"AM_INIT_AUTOMAKE(foreign) dnl ..." seems to trigger Debian bug#738716
---
configure.ac | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index ee9d377..df31014 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,7 +35,8 @@ AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
-AM_INIT_AUTOMAKE(foreign) dnl NB: Do not [quote] this parameter.
+dnl NB: Do not [quote] this parameter.
+AM_INIT_AUTOMAKE(foreign)
LT_INIT
dnl Check for basic C environment.
--
1.9.0.rc3
10 years, 10 months
[PATCH] podwrapper: Recognize git-style dates in ChangeLog
by Hilko Bengen
---
podwrapper.pl.in | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/podwrapper.pl.in b/podwrapper.pl.in
index 9bceec3..61d5e12 100755
--- a/podwrapper.pl.in
+++ b/podwrapper.pl.in
@@ -235,9 +235,17 @@ my $date;
my $filename = "$abs_top_srcdir/ChangeLog";
if (-r $filename) {
open FILE, $filename or die "$progname: $filename: $!";
- $_ = <FILE>;
+ while (<FILE>) {
+ if (/^Date:\s+...\s+(...)\s+(\d+)\s+..:..:..\s+(\d{4})\s+.*$/) {
+ my $i = 0;
+ my %month =
+ map { $_ => ++$i }
+ (qw< Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec >);
+ $date = sprintf '%04d-%02d-%02d', $3, $month{$1}, $2;
+ last;
+ }
+ }
close FILE;
- $date = $1 if /^(\d+-\d+-\d+)\s/;
}
$filename = "$abs_top_srcdir/.git";
if (!$date && -d $filename) {
--
1.9.0.rc3
10 years, 10 months
[PATCH 1/2] mllib: hostname: replace the hostname on Debian also in /etc/hosts (RHBZ#953907).
by Pino Toscano
In Debian/Ubuntu systems, read the previous hostname from /etc/hostname
before replacing it, and try to carefully replace it in /etc/hosts with
the new hostname.
Since Perl_edit to edit /etc/hosts, it is added/changed as dependency
for Hostname.
---
builder/Makefile.am | 2 +-
mllib/Makefile.am | 2 +-
mllib/hostname.ml | 22 ++++++++++++++++++++++
sysprep/Makefile.am | 1 +
4 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/builder/Makefile.am b/builder/Makefile.am
index 9d2dbc5..0880e03 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -69,10 +69,10 @@ OBJECTS = \
$(top_builddir)/mllib/common_utils.cmx \
$(top_builddir)/mllib/urandom.cmx \
$(top_builddir)/mllib/random_seed.cmx \
+ $(top_builddir)/mllib/perl_edit.cmx \
$(top_builddir)/mllib/hostname.cmx \
$(top_builddir)/mllib/timezone.cmx \
$(top_builddir)/mllib/firstboot.cmx \
- $(top_builddir)/mllib/perl_edit.cmx \
$(top_builddir)/mllib/crypt-c.o \
$(top_builddir)/mllib/crypt.cmx \
$(top_builddir)/mllib/fsync-c.o \
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
index 67f0a0a..fc328d6 100644
--- a/mllib/Makefile.am
+++ b/mllib/Makefile.am
@@ -80,10 +80,10 @@ OBJECTS = \
common_utils.cmx \
urandom.cmx \
random_seed.cmx \
+ perl_edit.cmx \
hostname.cmx \
timezone.cmx \
firstboot.cmx \
- perl_edit.cmx \
tTY.cmx \
fsync.cmx \
progress.cmx \
diff --git a/mllib/hostname.ml b/mllib/hostname.ml
index 6702f29..e1c5d4b 100644
--- a/mllib/hostname.ml
+++ b/mllib/hostname.ml
@@ -42,7 +42,12 @@ let rec set_hostname (g : Guestfs.guestfs) root hostname =
true
| "linux", ("debian"|"ubuntu"), _ ->
+ let old_hostname = read_etc_hostname g in
update_etc_hostname g hostname;
+ (match old_hostname with
+ | Some old_hostname -> replace_host_in_etc_hosts g old_hostname hostname
+ | None -> ()
+ );
true
| "linux", ("fedora"|"rhel"|"centos"|"scientificlinux"|"redhat-based"), _ ->
@@ -78,3 +83,20 @@ and update_etc_hostname g hostname =
and update_etc_machine_info g hostname =
replace_line_in_file g "/etc/machine-info" "PRETTY_HOSTNAME" hostname
+
+and read_etc_hostname g =
+ let filename = "/etc/hostname" in
+ if g#is_file filename then (
+ let lines = Array.to_list (g#read_lines filename) in
+ match lines with
+ | hd :: _ -> Some hd
+ | [] -> None
+ ) else
+ None
+
+and replace_host_in_etc_hosts g oldhost newhost =
+ let filename = "/etc/hosts" in
+ if g#is_file filename then (
+ Perl_edit.edit_file ~debug:false g filename
+ ("s,(\\s)" ^ (Str.quote oldhost) ^ "(\\s|\\$),\\1" ^ (Str.quote newhost) ^ "\\2, if ($_ !~ /^#/)")
+ )
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index 4c03c7f..25cdaa5 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -95,6 +95,7 @@ OBJECTS = \
$(top_builddir)/mllib/urandom.cmx \
$(top_builddir)/mllib/password.cmx \
$(top_builddir)/mllib/random_seed.cmx \
+ $(top_builddir)/mllib/perl_edit.cmx \
$(top_builddir)/mllib/hostname.cmx \
$(top_builddir)/mllib/timezone.cmx \
$(top_builddir)/mllib/firstboot.cmx \
--
1.8.3.1
10 years, 10 months