[PATCH] GuestOS: Reload augeas after rpm installation and removal
by Matthew Booth
---
lib/Sys/VirtV2V/GuestOS/RedHat.pm | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib/Sys/VirtV2V/GuestOS/RedHat.pm b/lib/Sys/VirtV2V/GuestOS/RedHat.pm
index cd2f8e6..380dacb 100644
--- a/lib/Sys/VirtV2V/GuestOS/RedHat.pm
+++ b/lib/Sys/VirtV2V/GuestOS/RedHat.pm
@@ -862,6 +862,9 @@ sub remove_application
$g->command(['rpm', '-e', $name]);
};
die($@) if($@);
+
+ # Make augeas reload in case the removal changed anything
+ $g->aug_load();
}
=item get_application_owner(file)
@@ -902,6 +905,9 @@ sub _install_rpms
# Propagate command failure
die($@) if($@);
+
+ # Reload augeas in case the rpm installation changed anything
+ $g->aug_load();
}
# Get full, local path of a file on the transfer mount
--
1.6.6
14 years, 10 months
[PATCH] Build: Make changelog action call git directly without Git module
by Matthew Booth
The changelog action needs to checkout git2cl as a submodule. For some reason,
when called through the Git module, command('submodule', 'update') was doing
something unfathomable, and different to just calling 'git submodule update'. As
Git is just a command line wrapper anyway, I've sidestepped this by just calling
the command directly.
---
Build.PL | 18 ++----------------
1 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/Build.PL b/Build.PL
index efce5dd..51afae8 100644
--- a/Build.PL
+++ b/Build.PL
@@ -150,22 +150,8 @@ sub ACTION_changelog
return 1;
}
- # Check that git is available
- eval "use Git;";
- if($@) {
- $self->log_info("Git is not installed\n");
- return 1;
- }
-
- # Update submodules to get git2cl
- my $repo = Git->repository(Directory => '.');
-
- eval {
- $repo->command_noisy('submodule', 'update');
- };
-
- if($@) {
- $self->log_info("Failed to initialise git2cl\n");
+ unless(system("git", "submodule", "update") == 0) {
+ $self->log_info("Failed to initialise git2cl: $@\n");
return 1;
}
--
1.6.6
14 years, 10 months
Re: [Libguestfs] Followup: libguestfs on Ubuntu
by Richard W.M. Jones
On Tue, Feb 16, 2010 at 11:18:21PM +0100, Guido Günther wrote:
> Yes, that was the intention. I've import 1.0.84:
> http://git.debian.org/?p=pkg-libvirt/libguestfs.git;a=summary
OK, hope this works ...
[1/6] This adds the 5 patches which I posted upstream some time ago
(https://www.redhat.com/archives/libguestfs/2009-December/thread.html#00039).
They are rebased to libguestfs 1.0.84, but otherwise unchanged. I use
quilt here to manage the patches, but actually quilt is a bit of a
pain because it doesn't cooperate well with git. I wonder if it is
better to store these as git commits? In any case, they need to be
reworked and go upstream at some point.
[2/6] Change the mirror and repo for Ubuntu.
[3/6] Add a changelog entry. (Not sure if this is necessary or the
'proper' way to do this).
[4/6] 'make check' fails. In libguestfs >= 1.0.85 we will have a
'make quickcheck' rule, but in the meantime just run
libguestfs-test-tool as a quick test that the package is mostly
working.
[5/6] For some reason I don't understand, Ubuntu's Python
site-packages are stored in /usr/lib/python2.5/site-packages, even
though Python _2.6_ is installed. This breaks the configure script,
so we have to patch configure.ac _and_ configure. It's just a single
line change to configure.ac, but the (generated) configure change is
much larger.
[6/6] This patch contains two separate, mostly unrelated changes:
(a) Ubuntu doesn't have libsys-virt-perl. Drop it as a dependency.
(b) Also install virt-inspector, virt-df and virt-cat (might be
applicable to the Debian branch too?)
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
14 years, 10 months
[PATCH] Converter: Remove argument checking from internal functions
by Matthew Booth
These checks found not to be useful.
---
lib/Sys/VirtV2V/Converter/Linux.pm | 28 ----------------------------
1 files changed, 0 insertions(+), 28 deletions(-)
diff --git a/lib/Sys/VirtV2V/Converter/Linux.pm b/lib/Sys/VirtV2V/Converter/Linux.pm
index 87eeeb3..1186430 100644
--- a/lib/Sys/VirtV2V/Converter/Linux.pm
+++ b/lib/Sys/VirtV2V/Converter/Linux.pm
@@ -133,14 +133,6 @@ sub convert
sub _remap_block_devices
{
my ($guestos, $dom, $desc, $virtio) = @_;
- die("remap_block_devices called without guestos argument")
- unless defined($guestos);
- die("remap_block_devices called without dom argument")
- unless defined($dom);
- die("remap_block_devices called without desc argument")
- unless defined($desc);
- die("remap_block_devices called without virtio argument")
- unless defined($virtio);
my %map = ();
@@ -167,12 +159,6 @@ sub _remap_block_devices
sub _configure_kernel_modules
{
my ($guestos, $desc, $virtio) = @_;
- die("configure_kernel_modules called without guestos argument")
- unless defined($guestos);
- die("configure_kernel_modules called without desc argument")
- unless defined($desc);
- die("configure_kernel_modules called without virtio argument")
- unless defined($virtio);
# Get a list of all old-hypervisor specific kernel modules which need to be
# replaced or removed
@@ -235,10 +221,6 @@ sub _configure_kernel_modules
sub _configure_display_driver
{
my ($guestos, $virtio) = @_;
- die("configure_display_driver called without guestos argument")
- unless defined($guestos);
- die("configure_display_driver called without virtio argument")
- unless defined($virtio);
$guestos->update_display_driver("cirrus");
}
@@ -246,10 +228,6 @@ sub _configure_display_driver
sub _configure_kernel
{
my ($guestos, $desc) = @_;
- die("configure_kernel called without guestos argument")
- unless defined($guestos);
- die("configure_kernel called without desc argument")
- unless defined($desc);
my %kernels;
@@ -331,12 +309,6 @@ sub _configure_kernel
sub _configure_boot
{
my ($guestos, $kernel, $virtio) = @_;
- die("configure_boot called without guestos argument")
- unless defined($guestos);
- die("configure_boot called without kernel argument")
- unless defined($kernel);
- die("configure_boot called without virtio argument")
- unless defined($virtio);
if($virtio) {
$guestos->prepare_bootable($kernel, "virtio_pci", "virtio_blk");
--
1.6.6
14 years, 10 months
[PATCH 1/2] ESX: Look harder for potential transfer failures
by Matthew Booth
Although I can't reproduce, I seem to have had an incomplete transfer which
wasn't picked up by the existing error handling. This change adds some more
sanity checks:
* Check for error on close() (should have been doing this anyway)
* Check that the bytes received == reported content length
---
lib/Sys/VirtV2V/Transfer/ESX.pm | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/lib/Sys/VirtV2V/Transfer/ESX.pm b/lib/Sys/VirtV2V/Transfer/ESX.pm
index f270938..1da382a 100644
--- a/lib/Sys/VirtV2V/Transfer/ESX.pm
+++ b/lib/Sys/VirtV2V/Transfer/ESX.pm
@@ -140,6 +140,7 @@ sub get_volume
"{error}", error => $@->stringify())));
}
+ $self->{_v2v_received} = 0;
my $r = $self->SUPER::get($url,
':content_cb' => sub { $self->handle_data(@_); },
':read_size_hint' => 64 * 1024);
@@ -150,10 +151,18 @@ sub get_volume
die($died) if (defined($died));
# Close the volume file descriptor
- close($self->{_v2v_volfh});
+ close($self->{_v2v_volfh})
+ or die(user_message(__x("Error closing volume handle: {error}",
+ error => $!)));
return $self->{_v2v_vol};
}
+ die(user_message(__x("Didn't receive full volume. Received {received} of ".
+ "{total} bytes.",
+ received => $self->{_v2v_received},
+ total => $self->{_v2v_volsize})))
+ unless ($self->{_v2v_received} == $self->{_v2v_volsize});
+
if ($r->code == 401) {
die(user_message(__x("Authentication error connecting to ".
"{server}. Used credentials for {username} ".
@@ -185,6 +194,8 @@ sub handle_data
my $volfh = $self->{_v2v_volfh};
+ $self->{_v2v_received} += length($data);
+
syswrite($volfh, $data)
or die(user_message(__x("Error writing to {path}: {error}",
path => $self->{_v2v_volpath},
@@ -205,6 +216,7 @@ sub create_volume
unless (defined($name));
my $size = $response->content_length();
+ $self->{_v2v_volsize} = $size;
my $vol_xml = "
<volume>
--
1.6.6
14 years, 10 months
[PATCH 1/3] Build: Make changelog action call git directly without Git module
by Matthew Booth
The changelog action needs to checkout git2cl as a submodule. For some reason,
when called through the Git module, command('submodule', 'update') was doing
something unfathomable, and different to just calling 'git submodule update'. As
Git is just a command line wrapper anyway, I've sidestepped this by just calling
the command directly.
---
Build.PL | 18 ++----------------
1 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/Build.PL b/Build.PL
index efce5dd..51afae8 100644
--- a/Build.PL
+++ b/Build.PL
@@ -150,22 +150,8 @@ sub ACTION_changelog
return 1;
}
- # Check that git is available
- eval "use Git;";
- if($@) {
- $self->log_info("Git is not installed\n");
- return 1;
- }
-
- # Update submodules to get git2cl
- my $repo = Git->repository(Directory => '.');
-
- eval {
- $repo->command_noisy('submodule', 'update');
- };
-
- if($@) {
- $self->log_info("Failed to initialise git2cl\n");
+ unless(system("git", "submodule", "update") == 0) {
+ $self->log_info("Failed to initialise git2cl: $@\n");
return 1;
}
--
1.6.6
14 years, 10 months
libguestfs on Ubuntu
by Richard W.M. Jones
So I got a lot further building libguestfs on Ubuntu, up to the point
where I can boot the appliance and run some simple commands. We need
to push some patches upstream, and there are still some things in
Ubuntu itself which are broken. This documents how far I've got.
(1) libguestfs from git, Ubuntu 9.10, all updated to the latest
versions. You will of course also need to read the README file and
install the long list of dependencies, all of which are in the Ubuntu
repositories.
http://git.annexia.org/?p=libguestfs.git;a=summary
http://libguestfs.org/README.txt
(2) I'm going to post patches as follow-ups to this email, of which
most/all will be required.
(3) You will need debirf 0.25. I installed it from:
http://gb.archive.ubuntu.com/ubuntu/pool/universe/d/debirf/
(4) This is how I'm configuring:
./autogen.sh \
--with-readline \
--with-repo=karmic \
--with-mirror=http://gb.archive.ubuntu.com/ubuntu/ \
--enable-debug-command
(5) make
(6) 'make check' fails during the Gnulib tests.
(7) After building you can do a quick sanity check:
$ ./fish/guestfish alloc /tmp/test.img 10M : run : list-devices
/dev/sda
If it doesn't work, add the '-v' option and post the full output here.
I was able to run some basic guestfish commands, but I didn't yet test
it extensively.
Rich.
----------------------------------------------------------------------
$ ./fish/guestfish
Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.
Type: 'help' for help with commands
'quit' to quit the shell
><fs> alloc /tmp/test.img
use 'alloc file size' to create an image
><fs> alloc /tmp/test.img 10M
><fs> run
open /dev/kvm: No such file or directory
Could not initialize KVM, will disable KVM support
><fs> list-devices
/dev/sda
><fs> help part-disk
NAME
part-disk - partition whole disk with a single primary partition
SYNOPSIS
part-disk device parttype
DESCRIPTION
This command is simply a combination of "part_init" followed by
"part_add" to create a single primary partition covering the whole disk.
"parttype" is the partition table type, usually "mbr" or "gpt", but
other possible values are described in "part_init".
This command is dangerous. Without careful use you can easily destroy
all your data.
><fs> part-disk /dev/sda mbr
><fs> mkfs ext3 /dev/sda1
><fs> mount /dev/sda1 /
><fs> touch /hello
><fs> umount-all
><fs> list-partitions
/dev/sda1
><fs> sync
><fs>
$ strings /tmp/test.img
lost+found
hello
lost+found
hello
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
14 years, 10 months
Re: [Libguestfs] [PATCH 4/9] Converter: Remove disk driver elements other than 'qemu'
by Matthew Booth
On 12/02/10 14:04, Richard W.M. Jones wrote:
> On Fri, Feb 12, 2010 at 02:03:46PM +0000, Matthew Booth wrote:
>> On 12/02/10 13:03, Richard W.M. Jones wrote:
>>> On Fri, Feb 12, 2010 at 09:39:17AM +0000, Matthew Booth wrote:
>>>> QEMU only currently supports the qemu storage driver in libvirt. Remove any
>>>> other driver element.
>>>> ---
>>>> lib/Sys/VirtV2V/Converter.pm | 7 +++++++
>>>> 1 files changed, 7 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/lib/Sys/VirtV2V/Converter.pm b/lib/Sys/VirtV2V/Converter.pm
>>>> index 4b11efd..edc6589 100644
>>>> --- a/lib/Sys/VirtV2V/Converter.pm
>>>> +++ b/lib/Sys/VirtV2V/Converter.pm
>>>> @@ -436,6 +436,13 @@ sub _unconfigure_hvs
>>>> $emulator->getParent()->removeChild($emulator);
>>>> }
>>>>
>>>> + # Remove any disk driver element other than 'qemu'
>>>> + foreach my $driver
>>>> + ($dom->findnodes('/domain/devices/disk/driver[@name != \'qemu\']'))
>>>> + {
>>>> + $driver->getParentNode()->removeChild($driver);
>>>> + }
>>>> +
>>>> _unconfigure_xen_metadata($dom, $default_dom);
>>>> }
>>>>
>>>> --
>>>> 1.6.6
>>>
>>> Not sure I understand this. Looking at:
>>>
>>> http://libvirt.org/formatdomain.html#elementsDisks
>>>
>>> won't this change end up deleting important disks from the guest?
>>
>> No. It's only removing <driver>, not the disk element.
>
> OK. Is it safe to remove the <driver> element and
> leave the rest?
Pretty sure it is. I'll dig out a reason why when I get back on Tuesday.
This is now my only outstanding patch :)
Matt
--
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team
M: +44 (0)7977 267231
GPG ID: D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
14 years, 10 months