[PATCH] Show the total amount of space used by snapshots in the VG editor dialog.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Only show the label if there are snapshots in the VG.
---
 pyanaconda/iw/lvm_dialog_gui.py |   37 ++++++++++++++++++++++++++++++++++---
 1 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/iw/lvm_dialog_gui.py b/pyanaconda/iw/lvm_dialog_gui.py
index 090bbba..e3db5bd 100644
--- a/pyanaconda/iw/lvm_dialog_gui.py
+++ b/pyanaconda/iw/lvm_dialog_gui.py
@@ -65,7 +65,8 @@ class VolumeGroupEditor:
         vgsize = vg.size
         vgfree = vg.freeSpace
         vgused = vgsize - vgfree
-	return (vgsize, vgused, vgfree)
+        vgsnapshots = vg.snapshotSpace
+        return (vgsize, vgused, vgfree, vgsnapshots)
 
     def getPVWastedRatio(self, newpe):
         """ given a new pe value, return percentage of smallest PV wasted
@@ -842,7 +843,7 @@ class VolumeGroupEditor:
                 custom_icon="error")
             return
 
-        (total, used, free) = self.computeSpaceValues()
+        (total, used, free, snapshots) = self.computeSpaceValues()
 	if free <= 0:
 	    self.intf.messageWindow(_("No free space"),
 				    _("There is no room left in the "
@@ -948,7 +949,7 @@ class VolumeGroupEditor:
             self.logvolstore.set_value(iter, 2, "%Ld" % lv['size'])
 
     def updateVGSpaceLabels(self):
-        (total, used, free) = self.computeSpaceValues()
+        (total, used, free, snapshots) = self.computeSpaceValues()
 
 	self.totalSpaceLabel.set_text("%10.2f MB" % (total,))
 	self.usedSpaceLabel.set_text("%10.2f MB" % (used,))
@@ -968,6 +969,15 @@ class VolumeGroupEditor:
 
 	self.freePercentLabel.set_text("(%4.1f %%)" % (freepercent,))
 
+        if snapshots:
+            self.snapshotSpaceLabel.set_text("%10.2f MB" % snapshots)
+            if total > 0:
+                snapshotpercent = (100.0*snapshots)/total
+            else:
+                snapshotpercent = 0.0
+
+            self.snapshotPercentLabel.set_text("(%4.1f %%)" % snapshotpercent)
+
 #
 # run the VG editor we created
 #
@@ -1372,6 +1382,27 @@ class VolumeGroupEditor:
 	maintable.set_row_spacing(row, 0)
         row = row + 1
 
+        if self.vg.snapshotSpace:
+            maintable.attach(createAlignedLabel(_("Snapshot Total:")),
+                             0, 1, row, row + 1, gtk.EXPAND|gtk.FILL,
+                             gtk.SHRINK)
+            lbox = gtk.HBox()
+            self.snapshotSpaceLabel = gtk.Label("")
+            labelalign = gtk.Alignment()
+            labelalign.set(1.0, 0.5, 0.0, 0.0)
+            labelalign.add(self.snapshotSpaceLabel)
+            lbox.pack_start(labelalign, False, False)
+            self.snapshotPercentLabel = gtk.Label("")
+            labelalign = gtk.Alignment()
+            labelalign.set(1.0, 0.5, 0.0, 0.0)
+            labelalign.add(self.snapshotPercentLabel)
+            lbox.pack_start(labelalign, False, False, padding=10)
+
+            maintable.attach(lbox, 1, 2, row, row + 1, gtk.EXPAND|gtk.FILL,
+                             gtk.SHRINK)
+            maintable.set_row_spacing(row, 0)
+            row = row + 1
+
         maintable.attach(createAlignedLabel(_("Free Space:")), 0, 1, row,
 			 row + 1, gtk.EXPAND|gtk.FILL, gtk.SHRINK)
 	lbox = gtk.HBox()
-- 
1.7.2.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux