[PATCH] builder: test-virt-builder: check some results
by Pino Toscano
Check at least some basic modifications in the image created with
virt-builder.
---
builder/test-virt-builder.sh | 47 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/builder/test-virt-builder.sh b/builder/test-virt-builder.sh
index 47d20a4..3c8eb60 100755
--- a/builder/test-virt-builder.sh
+++ b/builder/test-virt-builder.sh
@@ -65,6 +65,51 @@ $VG ./virt-builder phony-fedora \
--firstboot Makefile --firstboot-command 'echo "hello"' \
--firstboot-install "minicom,inkscape"
-# XXX Test that the modifications were made.
+# Check that some modifications were made.
+$VG ../fish/guestfish --ro -i -a $output > test.out <<EOF
+# Uploaded files
+is-file /etc/foo/bar/baz/Makefile
+cat /etc/foo/bar/baz/foo
+is-symlink /foo
+is-symlink /foo1
+is-symlink /foo2
+is-symlink /foo3
+
+echo -----
+# Hostname
+cat /etc/sysconfig/network | grep HOSTNAME=
+
+echo -----
+# Timezone
+is-file /usr/share/zoneinfo/Europe/London
+is-symlink /etc/localtime
+readlink /etc/localtime
+
+echo -----
+# Password
+is-file /etc/shadow
+cat /etc/shadow | sed -r '/^root:/!d;s,^(root:\\\$6\\\$).*,\\1,g'
+EOF
+
+if [ "$(cat test.out)" != "true
+Hello World
+true
+true
+true
+true
+-----
+HOSTNAME=test.example.com
+-----
+true
+true
+/usr/share/zoneinfo/Europe/London
+-----
+true
+root:\$6\$" ]; then
+ echo "$0: unexpected output:"
+ cat test.out
+ exit 1
+fi
rm $output
+rm test.out
--
1.8.3.1
10 years, 11 months
RFC: copy-attributes command
by Pino Toscano
Hi,
attached there is a prototype of patch for adding a new copy-attributes
command. Such command would allow copy the attributes of a "file" to
another, so for example in guestfish:
copy-attributes foo bar permissions:true xattributes:false
would only copy the permissions of foo to bar, not copying its extended
attributes too.
Just few notes:
- my first daemon command, so possibly I could be missing something
- copy_xattrs is in xattr.c to avoid spreading the usage of xattr API in
many places
- copy_xattrs does a bit of code repetition with other stuff in xattr.c,
but I'm not sure how to avoid it without making the xattr listing code
(getxattrs) a bit more complex that what it is already
Comments?
--
Pino Toscano
10 years, 11 months
Re: [Libguestfs] [Bug 1046905] New: RFE: add argument to virt-sysprep to disable individual default operations
by Pino Toscano
On Friday 27 December 2013 10:58:15 you wrote:
> virt-sysprep either runs with all default operations or a selected
> list of operations with the --enable argument. A few times I've
> found I'd like to use the default list, but minus one or two
> operations in particular, however there's no easy way to specify
> this.
>
> A --disable argument that took the default operation list and skipped
> selected operations would be useful.
A rough idea I had about this is adding a new --operations parameter,
which would take a a comma-separated list of operations (just like the
current --enable), but with the following differences:
- a leading minus would disable the specified operation
- it would recognize the meta-keywords "all" (for all the available
operations) and "defaults" (for the ones enabled by default)
Processing the list of operations would add/remove them from the current
set of operations, bailing out whether the resulting set is empty (just
like right now --enable rejects an empty string).
This way, you could write e.g.:
- --operations defaults,-hostname,user-account
runs the default ones but not "hostname", and the non-default
"user-account"
- --operations all
easy shortcut to run all the available operations
and so on.
--enable could just be an alias for --operations, or this new syntax
could be added directly to --enable directly.
Maybe I'm over-engineering, but IMHO seems a better way than potentially
adding a --disable argument and deal with the order of
--enable & --disable and their interactions.
--
Pino Toscano
10 years, 11 months
Re: [Libguestfs] Virt-builder?
by Richard W.M. Jones
On Thu, Jan 09, 2014 at 12:05:35PM -0800, Scott Baker wrote:
> I just upgraded to Fedora 20 and I see it includes
> libguestfs-1.24.3-1.fc20.x86_64. After I install that I do NOT see
> virt-builder though :(
>
> I thought 1.24 included virt-builder?
You probably want:
yum install libguestfs-tools-c
or even easier:
yum install /usr/bin/virt-builder
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
10 years, 11 months
[PATCH] virt-v2v: Default to non-virtio drivers if driver path is missing
by Mike Latimer
During a Windows conversion, _prepare_virtio_drivers aborts the conversion
completely if the configured virtio driver path does not exist. If the path
exists but is empty, the conversion completes correctly by defaulting to the
non-virtio drivers. This patch treats a missing directory just like missing
drivers, by reporting a message, then defaulting to non-virtio drivers.
---
lib/Sys/VirtConvert/Converter/Windows.pm | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/lib/Sys/VirtConvert/Converter/Windows.pm b/lib/Sys/VirtConvert/Converter/Windows.pm
index ce8b474..feeb2b9 100644
--- a/lib/Sys/VirtConvert/Converter/Windows.pm
+++ b/lib/Sys/VirtConvert/Converter/Windows.pm
@@ -312,13 +312,24 @@ sub _prepare_virtio_drivers
return ($block, $net);
}
- # We can't proceed if there are any files missing
+ # We can't install any drivers if the defined virtio path is missing
my $virtio_guest = $config->get_transfer_path($virtio_host);
- v2vdie __x('Installation failed because the following '.
- 'files referenced in the configuration file are '.
- 'required, but missing: {list}',
- list => $virtio_host)
- unless (defined($virtio_host) && $g->exists($virtio_guest));
+ if (!(defined($virtio_host) && $g->exists($virtio_guest))) {
+ my $block = 'ide';
+ my $net = 'rtl8139';
+
+ logmsg WARN, __x('The installation of virtio drivers failed because '.
+ 'the driver path referenced in the configuration file '.
+ '({path}) is required, but missing. The guest will be '.
+ 'configured with a {block} block storage adapter and a {net} '.
+ 'network adapter, but no drivers will be installed for them. '.
+ 'If the {block} driver is not already installed in the guest,'.
+ ' it will fail to boot. If the {net} driver is not already '.
+ 'installed in the guest, you must install it manually after '.
+ 'conversion.', path => $virtio_host, block => $block,
+ net => $net);
+ return ($block, $net);
+ }
my ($block, $net);
my $viostor_guest = File::Spec->catfile($virtio_guest, 'viostor.sys');
--
1.8.1.4
10 years, 11 months
[PATCH] virt-v2v: Check for firstboot before unconfiguring XenPV
by Mike Latimer
Although not fatal, _unconfigure_xenpv should report a warning and return
if firstboot is not available (during Windows conversions).
---
lib/Sys/VirtConvert/Converter/Windows.pm | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/Sys/VirtConvert/Converter/Windows.pm b/lib/Sys/VirtConvert/Converter/Windows.pm
index 59d273f..ce8b474 100644
--- a/lib/Sys/VirtConvert/Converter/Windows.pm
+++ b/lib/Sys/VirtConvert/Converter/Windows.pm
@@ -564,6 +564,12 @@ sub _unconfigure_xenpv
{
my ($g, $h_soft, $firstboot) = @_;
+ if (!defined($firstboot)) {
+ logmsg WARN, __x('Unable to uninstall Xen PV drivers without '.
+ 'firstboot');
+ return;
+ }
+
my @regkey = ('Microsoft', 'Windows', 'CurrentVersion', 'Uninstall',
'Red Hat Paravirtualized Xen Drivers for Windows(R)');
--
1.8.1.4
10 years, 11 months
Issue with virt-sysprep
by Graeme Lambert
Hi,
I'm trying to run virt-sysprep against a disk in Ceph RBD storage but I
appear to be unable to do so.
The commands (bold) and outputs I've had are:
On Ceph node:
*virt-sysprep -a rbd://localhost/libvirt-pool/ubuntu-12-04-beanstalk001*
libguestfs: new guestfs handle 0x113b060
rbd://localhost/libvirt-pool/ubuntu-12-04-beanstalk001: No such file or
directory
libguestfs: trace: close
libguestfs: closing guestfs handle 0x113b060 (state 0)
On libvirt node:
*virt-sysprep -d beanstalk002 --hostname beanstalk002 --format rbd*
Examining the guest ...
Fatal error: exception Guestfs.Error("libvirt domain has no disks")
I'm using Ubuntu 13.04 on libvirt node and Ubuntu 12.04.3 LTS on the
Ceph node. The libguestfs version showing in dpkg is 1:1.14.8-1.
This works fine on qcow2 images that are on disk but I'm moving towards
having all disks in Ceph RBD and would like to be able to virt-sysprep
disks in there if at all possible.
Please can you advise where I'm going wrong?
--
Best regards
*Graeme*
10 years, 11 months
[PATCH] virt-v2v: Fix typo in Windows conversion warning message
by Mike Latimer
---
lib/Sys/VirtConvert/Converter/Windows.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Sys/VirtConvert/Converter/Windows.pm b/lib/Sys/VirtConvert/Converter/Windows.pm
index 765ed9f..59d273f 100644
--- a/lib/Sys/VirtConvert/Converter/Windows.pm
+++ b/lib/Sys/VirtConvert/Converter/Windows.pm
@@ -338,7 +338,7 @@ sub _prepare_virtio_drivers
'configured with a {block} block storage '.
'adapter, but no driver will be installed for '.
'it. If the {block} driver is not already '.
- 'installed in the guest, it will fail to boot.'.
+ 'installed in the guest, it will fail to boot.',
block => $block);
}
--
1.8.1.4
10 years, 11 months
Build libguestfs error with undefined reference to `tgetnum'
by Nguyễn Trường Sơn
Hi
I want to build libguestfs on my laptop.
I run Centos 6.4, libguestfs libguestfs-1.24.3.
I get this error:
Wide character in print at /root/libguestfs-1.24.3/podwrapper.pl line 418.
podwrapper.pl: wrote guestfish.1
podwrapper.pl: wrote ../html/guestfish.1.html
touch stamp-guestfish.pod
CCLD guestfish
guestfish-progress.o: In function `progress_bar_set':
/root/libguestfs-1.24.3/fish/progress.c:282: undefined reference to
`tgetnum'
guestfish-progress.o: In function `fprintf':
/usr/include/bits/stdio2.h:98: undefined reference to `UP'
guestfish-progress.o: In function `progress_bar_init':
/root/libguestfs-1.24.3/fish/progress.c:123: undefined reference to
`tgetent'
collect2: ld returned 1 exit status
make[3]: *** [guestfish] Error 1
make[3]: Leaving directory `/root/libguestfs-1.24.3/fish'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/root/libguestfs-1.24.3/fish'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/libguestfs-1.24.3'
make: *** [all] Error 2
I've read this page
http://www.redhat.com/archives/libguestfs/2012-September/msg00025.html
I have libtinfo on my machine:
/lib64/libtinfo.so.5
/lib64/libtinfo.so.5.7
/usr/lib/libtinfo.so
Check the tgetnum, UP, tgetent
nm -D /usr/lib64/libtinfo.so | grep tgetnum
0000003cd1210c40 T tgetnum
nm -D /usr/lib64/libtinfo.so | grep UP
0000003cd1420fa8 B UP
nm -D /usr/lib64/libtinfo.so | grep tgetent
0000003cd1210f00 T tgetent
Even get this error on older libguestfs libguestfs-1.20.12
Thanks
10 years, 11 months