[blivet] Remove all traces of singlePV. (#1147501)

Samantha N. Bueno sbueno+anaconda at redhat.com
Mon Sep 29 19:21:34 UTC 2014


(This is to go along with my other three patches in this set.)

Won't be needing this anymore.

Related: rhbz#1147501
---
 blivet/__init__.py     | 15 ---------------
 blivet/deviceaction.py |  3 +--
 blivet/devices.py      | 37 ++-----------------------------------
 blivet/partitioning.py |  3 +--
 blivet/partspec.py     | 18 ++++++------------
 5 files changed, 10 insertions(+), 66 deletions(-)

diff --git a/blivet/__init__.py b/blivet/__init__.py
index 45b033d..e89aaa1 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -1606,21 +1606,6 @@ class Blivet(object):
                             "which is required for installation of %s "
                             "to continue.") % (productName,)))
 
-        # Prevent users from installing on s390x with (a) no /boot volume, (b) the
-        # root volume on LVM, and (c) the root volume not restricted to a single
-        # PV
-        # NOTE: There is not really a way for users to create a / volume
-        # restricted to a single PV.  The backend support is there, but there are
-        # no UI hook-ups to drive that functionality, but I do not personally
-        # care.  --dcantrell
-        if arch.isS390() and '/boot' not in self.mountpoints and root:
-            if root.type == 'lvmlv' and not root.singlePV:
-                exns.append(
-                   SanityError(_("This platform requires /boot on a dedicated "
-                                "partition or logical volume.  If you do not "
-                                "want a /boot volume, you must place / on a "
-                                "dedicated non-LVM partition.")))
-
         # FIXME: put a check here for enough space on the filesystems.
         # maybe?
 
         for (mount, size) in checkSizes:
diff --git a/blivet/deviceaction.py b/blivet/deviceaction.py
index db4c7a7..beac246 100644
--- a/blivet/deviceaction.py
+++ b/blivet/deviceaction.py
@@ -318,8 +318,7 @@ class ActionCreateDevice(DeviceAction):
         elif (action.isCreate and action.isDevice and
               isinstance(self.device, LVMLogicalVolumeDevice) and
               isinstance(action.device, LVMLogicalVolumeDevice) and
-              self.device.vg == action.device.vg and
-              action.device.singlePV and not self.device.singlePV):
+              self.device.vg == action.device.vg):
             rc = True
         elif (action.isAdd and action.container == self.container):
             rc = True
diff --git a/blivet/devices.py b/blivet/devices.py
index 990569c..fa75fef 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -2820,8 +2820,7 @@ class LVMLogicalVolumeDevice(DMDevice):
     def __init__(self, name, parents=None, size=None, uuid=None,
                  copies=1, logSize=0, segType=None,
                  fmt=None, exists=False, sysfsPath='',
-                 grow=None, maxsize=None, percent=None,
-                 singlePV=False):
+                 grow=None, maxsize=None, percent=None):
         """
             :param name: the device name (generally a device node's basename)
             :type name: str
@@ -2844,8 +2843,6 @@ class LVMLogicalVolumeDevice(DMDevice):
             :type copies: int
             :keyword logSize: size of log volume (for mirrored lvs)
             :type logSize: :class:`~.size.Size`
-            :keyword singlePV: if true, maps this lv to a single pv
-            :type singlePV: bool
             :keyword segType: segment type (eg: "linear", "raid1")
             :type segType: str
 
@@ -2871,20 +2868,10 @@ class LVMLogicalVolumeDevice(DMDevice):
                           sysfsPath=sysfsPath, parents=parents,
                           exists=exists)
 
-        self.singlePVerr = ("%(mountpoint)s is restricted to a single "
-                            "physical volume on this platform.  No physical "
-                            "volumes available in volume group %(vgname)s "
-                            "with %(size)s of available space." %
-                           {'mountpoint': getattr(self.format, "mountpoint",
-                                                  "A proposed logical volume"),
-                            'vgname': self.vg.name,
-                            'size': self.size})
-
         self.uuid = uuid
         self.copies = copies
         self.logSize = logSize
         self.metaDataSize = 0
-        self.singlePV = singlePV
         self.segType = segType or "linear"
         self.snapshots = []
 
@@ -2900,14 +2887,6 @@ class LVMLogicalVolumeDevice(DMDevice):
             self.req_size = self._size
             self.req_percent = util.numeric_type(percent)
 
-        if self.singlePV:
-            # make sure there is at least one PV that can hold this LV
-            validpvs = [x for x in self.vg.pvs if x.size >= self.req_size]
-            if not validpvs:
-                for dev in self.parents:
-                    dev.removeChild()
-                raise errors.SinglePhysicalVolumeError(self.singlePVerr)
-
         # here we go with the circular references
         self.parents[0]._addLogVol(self)
 
@@ -3059,11 +3038,7 @@ class LVMLogicalVolumeDevice(DMDevice):
         """ Create the device. """
         log_method_call(self, self.name, status=self.status)
         # should we use --zero for safety's sake?
-        if self.singlePV:
-            lvm.lvcreate(self.vg.name, self._name, self.size,
-                         pvs=self._getSinglePV())
-        else:
-            lvm.lvcreate(self.vg.name, self._name, self.size)
+        lvm.lvcreate(self.vg.name, self._name, self.size)
 
     def _preDestroy(self):
         StorageDevice._preDestroy(self)
@@ -3075,14 +3050,6 @@ class LVMLogicalVolumeDevice(DMDevice):
         log_method_call(self, self.name, status=self.status)
         lvm.lvremove(self.vg.name, self._name)
 
-    def _getSinglePV(self):
-        validpvs = [x for x in self.vg.pvs if x.size >= self.size]
-
-        if not validpvs:
-            raise errors.SinglePhysicalVolumeError(self.singlePVerr)
-
-        return [validpvs[0].path]
-
     def resize(self):
         log_method_call(self, self.name, status=self.status)
 
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index 48d72ff..0046f57 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -316,8 +316,7 @@ def _scheduleVolumes(storage, devs):
                            "grow": request.grow,
                            "maxsize": request.maxSize,
                            "size": request.size,
-                           "thin_volume": thinlv,
-                           "singlePV": request.singlePV})
+                           "thin_volume": thinlv})
         else:
             kwargs.update({"parents": [container],
                            "size": request.size,
diff --git a/blivet/partspec.py b/blivet/partspec.py
index 04efc70..129f574 100644
--- a/blivet/partspec.py
+++ b/blivet/partspec.py
@@ -21,8 +21,8 @@
 
 class PartSpec(object):
     def __init__(self, mountpoint=None, fstype=None, size=None, maxSize=None,
-                 grow=False, btr=False, lv=False, singlePV=False, thin=False,
-                 weight=0, requiredSpace=0, encrypted=False):
+                 grow=False, btr=False, lv=False, thin=False, weight=0,
+                 requiredSpace=0, encrypted=False):
         """ Create a new storage specification.  These are used to specify
             the default partitioning layout as an object before we have the
             storage system up and running.  The attributes are obvious
@@ -34,8 +34,6 @@ class PartSpec(object):
                   it will be allocated as a partition.
             thin -- Should this be allocated as a thin logical volume if it is
                     being allocated as a logical volume?
-            singlePV -- Should this logical volume map to a single physical
-                        volume in the volume group?  Implies lv=True
             weight -- An integer that modifies the sort algorithm for partition
                       requests.  A larger value means the partition will end up
                       closer to the front of the disk.  This is mainly used to
@@ -61,25 +59,21 @@ class PartSpec(object):
         self.grow = grow
         self.lv = lv
         self.btr = btr
-        self.singlePV = singlePV
         self.thin = thin
         self.weight = weight
         self.requiredSpace = requiredSpace
         self.encrypted = encrypted
 
-        if self.singlePV and not self.lv:
-            self.lv = True
-
     def __str__(self):
         s = ("%(type)s instance (%(id)s) -- \n"
-             "  mountpoint = %(mountpoint)s  lv = %(lv)s  singlePV = %(singlePV)s"
+             "  mountpoint = %(mountpoint)s  lv = %(lv)s"
              "  thin = %(thin)s  btrfs = %(btrfs)s\n"
              "  weight = %(weight)s  fstype = %(fstype)s  encrypted = %(enc)s\n"
              "  size = %(size)s  maxSize = %(maxSize)s  grow = %(grow)s\n" %
              {"type": self.__class__.__name__, "id": "%#x" % id(self),
               "mountpoint": self.mountpoint, "lv": self.lv, "btrfs": self.btr,
-              "singlePV": self.singlePV, "weight": self.weight,
-              "fstype": self.fstype, "size": self.size, "enc": self.encrypted,
-              "maxSize": self.maxSize, "grow": self.grow, "thin": self.thin})
+              "weight": self.weight, "fstype": self.fstype, "size": self.size,
+              "enc": self.encrypted, "maxSize": self.maxSize, "grow": self.grow,
+              "thin": self.thin})
 
         return s
-- 
1.9.3


More information about the anaconda-patches mailing list