diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-03-14 19:42:47 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-03-15 12:16:51 +0000 |
commit | bc468c87d04b34faacd208c49cca4a5096e5103c (patch) | |
tree | 75d1da10c27c224f5a114cdf3e50920b41de86e4 /tools/virt-resize | |
parent | 7e51cc94ddb7527b37111d6fecce96dca14b900a (diff) | |
download | libguestfs-bc468c87d04b34faacd208c49cca4a5096e5103c.tar.gz libguestfs-bc468c87d04b34faacd208c49cca4a5096e5103c.tar.xz libguestfs-bc468c87d04b34faacd208c49cca4a5096e5103c.zip |
New event API - Perl bindings (RHBZ#664558).
The methods $h->set_progress_callback and $h->clear_progress_callback
have been removed, and replaced with a complete mechanism for setting
and deleting general-purpose events.
This also updates virt-resize to use the new API.
Diffstat (limited to 'tools/virt-resize')
-rwxr-xr-x | tools/virt-resize | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tools/virt-resize b/tools/virt-resize index 4beb45b5..5d0673a3 100755 --- a/tools/virt-resize +++ b/tools/virt-resize @@ -1,6 +1,6 @@ #!/usr/bin/perl -w # virt-resize -# Copyright (C) 2010 Red Hat Inc. +# Copyright (C) 2010-2011 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -598,7 +598,8 @@ sub launch_guestfs @args = ($outfile); push @args, format => $output_format if defined $output_format; $g->add_drive_opts (@args); - $g->set_progress_callback (\&progress_callback) unless $quiet; + $g->set_event_callback (\&progress_callback, $Sys::Guestfs::EVENT_PROGRESS) + unless $quiet; $g->launch (); } @@ -1401,10 +1402,15 @@ sub canonicalize # I intend to use an external library for this at some point (XXX). sub progress_callback { - my $proc_nr = shift; - my $serial = shift; - my $position = shift; - my $total = shift; + my $event = shift; + my $event_handle = shift; + my $buf = shift; + my $array = shift; + + my $proc_nr = $array->[0]; + my $serial = $array->[1]; + my $position = $array->[2]; + my $total = $array->[3]; my $ratio = $position / $total; if ($ratio < 0) { $ratio = 0 } |