[PATCH] Make sure user-selected mountpoint is not already in use. (#524584)

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

 



---
 iw/lvm_dialog_gui.py       |   14 ++++++++++++--
 iw/partition_dialog_gui.py |   18 ++++++++++++++++--
 iw/raid_dialog_gui.py      |   14 ++++++++++++++
 3 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index e751beb..d98a0bd 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -617,7 +617,7 @@ class VolumeGroupEditor:
             # these may not have been put in master list of requests
             # yet if we have not hit 'OK' for the volume group creation
             if fmt_class().mountable and mountpoint:
-                used = 0
+                used = False
                 curmntpt = getattr(format, "mountpoint", None)
 
                 for _lv in self.lvs.values():
@@ -631,9 +631,19 @@ class VolumeGroupEditor:
                         continue
 
                     if _format.mountpoint == mountpoint:
-                        used = 1
+                        used = True
                         break
 
+                if not used:
+                    # we checked this VG's LVs above; now check the rest of
+                    # the devices in the tree
+                    mountdevs = self.lvs.values()
+                    for (mp,d) in self.storage.mountpoints.iteritems():
+                        if (d.type != "lvmlv" or d.vg.id != self.vg.id) and \
+                           mp == mountpoint:
+                            used = True
+                            break
+
                 if used:
                     self.intf.messageWindow(_("Mount point in use"),
                                             _("The mount point \"%s\" is in "
diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
index 7e885b4..5a9c19d 100644
--- a/iw/partition_dialog_gui.py
+++ b/iw/partition_dialog_gui.py
@@ -111,12 +111,27 @@ class PartitionEditor:
                 self.destroy()
                 return []
 
+            mountpoint = self.mountCombo.get_children()[0].get_text()
+            if mountpoint:
+                used = False
+                for (mp, dev) in self.storage.mountpoints.iteritems():
+                    if mp == mountpoint and dev.id != self.origrequest.id:
+                        used = True
+                        break
+
+                if used:
+                    self.intf.messageWindow(_("Mount point in use"),
+                                            _("The mount point \"%s\" is in "
+                                              "use. Please pick another.") %
+                                            (mountpoint,),
+                                            custom_icon="error")
+                    continue
+
             if not self.origrequest.exists:
                 # read out UI into a partition specification
                 fmt_class = self.newfstypeCombo.get_active_value()
                 # there's nothing about origrequest we care about
                 #request = copy.copy(self.origrequest)
-                mountpoint = self.mountCombo.get_children()[0].get_text()
 
                 if self.primonlycheckbutton.get_active():
                     primary = True
@@ -223,7 +238,6 @@ class PartitionEditor:
                     usedev = request
 
                 origformat = usedev.format
-                mountpoint = self.mountCombo.get_children()[0].get_text()
                 devicetree = self.anaconda.id.storage.devicetree
 
                 if self.fsoptionsDict.has_key("formatcb"):
diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
index 8351f12..64c0a8a 100644
--- a/iw/raid_dialog_gui.py
+++ b/iw/raid_dialog_gui.py
@@ -166,6 +166,20 @@ class RaidEditor:
                 continue
 
             mountpoint = self.mountCombo.get_children()[0].get_text()
+            if mountpoint:
+                used = False
+                for (mp, dev) in self.storage.mountpoints.iteritems():
+                    if mp == mountpoint and dev.id != self.origrequest.id:
+                        used = True
+                        break
+
+                if used:
+                    self.intf.messageWindow(_("Mount point in use"),
+                                            _("The mount point \"%s\" is in "
+                                              "use. Please pick another.") %
+                                            (mountpoint,),
+                                            custom_icon="error")
+                    continue
 
             if not self.origrequest.exists:
                 # new device
-- 
1.6.0.6

_______________________________________________
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