Shown Cloudmin LVs
authorJamie Cameron <jcameron@webmin.com>
Mon, 13 Jun 2011 22:58:47 +0000 (15:58 -0700)
committerJamie Cameron <jcameron@webmin.com>
Mon, 13 Jun 2011 22:58:47 +0000 (15:58 -0700)
lvm/CHANGELOG
lvm/index.cgi
lvm/lang/en
lvm/lvm-lib.pl

index ae59415..3063b26 100644 (file)
@@ -29,3 +29,5 @@ When editing a logical volume that is already in /etc/fstab, don't allow the fil
 When editing a physical volume, its size can be increased to match the underlying device, such as a partition that has been grown.
 ---- Changes since 1.530 ----
 When creating a new striped logical volume, the strip size can now be selected.
+---- Changes since 1.550 ----
+LVs being used by Cloudmin on the same system are now shown on the Logical Volumes page.
index d3be395..dd02e77 100755 (executable)
@@ -186,9 +186,11 @@ if (@vgs) {
                        if (@stat[2]) {
                                ($total, $free) = &mount::disk_space(
                                        $stat[1], $stat[0]);
-                               $usedmsg = &text('lv_petotals',
-                                       &nice_size(($total-$free)*1024),
-                                       &nice_size($total*1024));
+                               if ($total) {
+                                       $usedmsg = &text('lv_petotals',
+                                               &nice_size(($total-$free)*1024),
+                                               &nice_size($total*1024));
+                                       }
                                }
                        print &ui_columns_row([
                          "<a href='edit_lv.cgi?vg=".&urlize($v->{'name'}).
index 47c79da..160c7bc 100644 (file)
@@ -59,6 +59,8 @@ lv_umount=For mounting on $1 as $2
 lv_mountvm=Mounted as virtual memory
 lv_umountvm=For mounting as virtual memory
 lv_mountraid=Part of RAID device $1
+lv_mountcm=Used by Cloudmin system $1
+lv_umountcm=For use by Cloudmin system $1
 lv_notused=Not in use
 lv_cannot=This logical volume cannot be renamed or resized as it is currently in use.
 lv_perm=Volume access
index c670836..b132394 100755 (executable)
@@ -679,6 +679,30 @@ elsif ($has_raid) {
                        }
                }
        }
+if (&foreign_check("server-manager")) {
+       # Look for Cloudmin systems using the disk, hosted on this system
+       if (!@server_manager_systems) {
+               &foreign_require("server-manager");
+               @server_manager_systems =
+                       grep { my $p = &server_manager::get_parent_server($_);
+                              $p && $p->{'id'} eq '0' }
+                            &server_manager::list_managed_servers();
+               }
+       foreach my $s (@server_manager_systems) {
+               if ($s->{$s->{'manager'}.'_filesystem'} eq $_[0]) {
+                       return ( $s->{'host'}, 'cloudmin', 
+                                $s->{'status'} ne 'down' );
+                       }
+               my $ffunc = "type_".$s->{'manager'}."_list_disk_devices";
+               if (&foreign_defined("server-manager", $ffunc)) {
+                       my @disks = &foreign_call("server-manager", $ffunc, $s);
+                       if (&indexof($_[0], @disks) >= 0) {
+                               return ( $s->{'host'}, 'cloudmin', 
+                                        $s->{'status'} ne 'down' );
+                               }
+                       }
+               }
+       }
 return ();
 }
 
@@ -686,10 +710,19 @@ return ();
 # Returns a text string about the status of an LV
 sub device_message
 {
-$msg = $_[2] ? 'lv_mount' : 'lv_umount';
-$msg .= 'vm' if ($_[1] eq 'swap');
-$msg .= 'raid' if ($_[1] eq 'raid');
-return &text($msg, "<tt>$_[0]</tt>", "<tt>$_[1]</tt>");
+my $msg;
+if ($_[1] eq 'cloudmin') {
+       # Used by Cloudmin system
+       $msg = $_[2] ? 'lv_mountcm' : 'lv_umountcm';
+       return &text($msg, "<tt>$_[0]</tt>");
+       }
+else {
+       # Used by filesystem or RAID
+       $msg = $_[2] ? 'lv_mount' : 'lv_umount';
+       $msg .= 'vm' if ($_[1] eq 'swap');
+       $msg .= 'raid' if ($_[1] eq 'raid');
+       return &text($msg, "<tt>$_[0]</tt>", "<tt>$_[1]</tt>");
+       }
 }
 
 # list_lvmtab()