Matthew Booth
2010-Apr-22 13:38 UTC
[Libguestfs] [PATCH 1/2] Try to load the loop module before running mkinitrd
mkinitrd needs to mount files using loop. loop might be a module, so try to load it first. --- lib/Sys/VirtV2V/GuestOS/RedHat.pm | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/lib/Sys/VirtV2V/GuestOS/RedHat.pm b/lib/Sys/VirtV2V/GuestOS/RedHat.pm index 0e469f5..08027b6 100644 --- a/lib/Sys/VirtV2V/GuestOS/RedHat.pm +++ b/lib/Sys/VirtV2V/GuestOS/RedHat.pm @@ -1114,6 +1114,13 @@ sub prepare_bootable $g->modprobe("ext2"); }; + # loop is a module in RHEL 5. Try to load it. Doesn't matter for other + # OSs if it doesn't exist, but RHEL 5 will complain: + # All of your loopback devices are in use. + eval { + $g->modprobe("loop"); + }; + $g->command(["/sbin/mkinitrd", @preload_args, $initrd, $version]); } -- 1.6.6.1
Matthew Booth
2010-Apr-22 13:38 UTC
[Libguestfs] [PATCH 2/2] ESX: Work with older LWP::UserAgent api
Update ESX to work with newer and older LWP::UserAgent api. --- lib/Sys/VirtV2V/Transfer/ESX.pm | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/Sys/VirtV2V/Transfer/ESX.pm b/lib/Sys/VirtV2V/Transfer/ESX.pm index 705ca25..4d65d5e 100644 --- a/lib/Sys/VirtV2V/Transfer/ESX.pm +++ b/lib/Sys/VirtV2V/Transfer/ESX.pm @@ -59,21 +59,15 @@ sub new { agent => 'virt-v2v/'.$Sys::VirtV2V::VERSION, protocols_allowed => [ 'https' ] ); - $self->show_progress(1); - $self->add_handler(response_header => sub { - my ($response, $self, $h) = @_; - - if ($response->is_success) { - $self->verify_certificate($response) unless ($noverify); - $self->create_volume($response); - } - }); + # Older versions of LWP::UserAgent don't support show_progress + $self->show_progress(1) if ($self->can('show_progress')); $self->{_v2v_server} = $server; $self->{_v2v_target} = $target; $self->{_v2v_username} = $username; $self->{_v2v_password} = $password; + $self->{_v2v_noverify} = $noverify; if ($noverify) { # Unset HTTPS_CA_DIR if it is already set @@ -177,6 +171,12 @@ sub handle_data my ($data, $response) = @_; + # Create the volume if it hasn't been created already + if (!defined($self->{_v2v_vol}) && $response->is_success) { + $self->verify_certificate($response) unless ($self->{_v2v_noverify}); + $self->create_volume($response); + } + $self->{_v2v_received} += length($data); $self->{_v2v_vol}->write($data); } -- 1.6.6.1
Richard W.M. Jones
2010-Apr-22 16:02 UTC
[Libguestfs] [PATCH 1/2] Try to load the loop module before running mkinitrd
On Thu, Apr 22, 2010 at 02:38:11PM +0100, Matthew Booth wrote:> mkinitrd needs to mount files using loop. loop might be a module, so try to load > it first. > --- > lib/Sys/VirtV2V/GuestOS/RedHat.pm | 7 +++++++ > 1 files changed, 7 insertions(+), 0 deletions(-) > > diff --git a/lib/Sys/VirtV2V/GuestOS/RedHat.pm b/lib/Sys/VirtV2V/GuestOS/RedHat.pm > index 0e469f5..08027b6 100644 > --- a/lib/Sys/VirtV2V/GuestOS/RedHat.pm > +++ b/lib/Sys/VirtV2V/GuestOS/RedHat.pm > @@ -1114,6 +1114,13 @@ sub prepare_bootable > $g->modprobe("ext2"); > }; > > + # loop is a module in RHEL 5. Try to load it. Doesn't matter for other > + # OSs if it doesn't exist, but RHEL 5 will complain: > + # All of your loopback devices are in use. > + eval { > + $g->modprobe("loop"); > + }; > + > $g->command(["/sbin/mkinitrd", @preload_args, $initrd, $version]); > } > > -- > 1.6.6.1ACK, modprobing that should always be safe. 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