daemon: Reimplement 'mounts' and 'mountpoints' commands.
[libguestfs.git] / tools / virt-resize
index 1e8a6c7..5d0673a 100755 (executable)
@@ -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
@@ -67,7 +67,7 @@ Copy C<olddisk> to C<newdisk>, extending one of the guest's partitions
 to fill the extra 5GB of space.
 
  truncate -r olddisk newdisk; truncate -s +5G newdisk
- virt-filesystems --long --h --all -a olddisk
+ virt-filesystems --long -h --all -a olddisk
  # Note "/dev/sda2" is a partition inside the "olddisk" file.
  virt-resize --expand /dev/sda2 olddisk newdisk
 
@@ -172,9 +172,7 @@ PV, then if virt-resize knows how, it will resize the contents, the
 equivalent of calling a command such as L<pvresize(8)>,
 L<resize2fs(8)> or L<ntfsresize(8)>.  However virt-resize does not
 know how to resize some filesystems, so you would have to online
-resize them after booting the guest.  And virt-resize also does not
-resize anything inside an LVM PV, it just resizes the PV itself and
-leaves the user to resize any LVs inside that PV as desired.
+resize them after booting the guest.
 
 Other options are covered below.
 
@@ -361,9 +359,9 @@ Windows will check the disk.
 
 =item *
 
-LVM PVs (physical volumes).  However virt-resize does I<not>
-resize anything inside the PV.  The user will have to resize
-LVs as desired.
+LVM PVs (physical volumes).  virt-resize does not usually resize
+anything inside the PV, but see the C<--LV-expand> option.  The user
+could also resize LVs as desired after boot.
 
 =back
 
@@ -600,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 ();
 }
 
@@ -1403,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 }