[PATCH 2/3] Make sure multipathd starts on systems using mpath storage (#615040)

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

 



Multipath storage is currently the only type of storage where we need to
make sure a userspace service is running.  Add in support for us to
expand on this later if necessary.
---
 storage/__init__.py         |    4 ++++
 storage/devices.py          |   33 +++++++++++++++++++++++++++++++++
 storage/formats/__init__.py |    6 ++++++
 3 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index 42a9142..f0de972 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -165,6 +165,10 @@ def storageComplete(anaconda):
             if dev.format.type == "luks" and not dev.format.exists:
                 dev.format.passphrase = anaconda.id.storage.encryptionPassphrase
 
+    services = set()
+    map(lambda device: services.add(device.services), anaconda.id.storage.fsset)
+    anaconda.id.ksdata.services.enabled = list(services)
+
     if anaconda.isKickstart:
         return
 
diff --git a/storage/devices.py b/storage/devices.py
index 8833ae2..e5dd16e 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -199,6 +199,7 @@ class Device(object):
 
     _type = "generic device"
     _packages = []
+    _services = []
 
     def __init__(self, name, parents=None):
         """ Create a Device instance.
@@ -370,6 +371,20 @@ class Device(object):
         return packages
 
     @property
+    def services(self):
+        """ List of services required to manage devices of this type.
+
+            This list includes the services required by its parent devices."
+        """
+        services = self._services
+        for parent in self.parents:
+            for service in parent.services:
+                if service not in services:
+                    services.append(service)
+
+        return services
+
+    @property
     def mediaPresent(self):
         return True
 
@@ -487,6 +502,23 @@ class StorageDevice(Device):
         return packages
 
     @property
+    def services(self):
+        """ List of services required to manage devices of this type.
+
+            This list includes the services required by this device's
+            format type as well those required by all of its parent
+            devices.
+        """
+        services = super(StorageDevice, self).services
+        services.extend(self.format.services)
+        for parent in self.parents:
+            for service in parent.format.services:
+                if service not in services:
+                    services.append(service)
+
+        return services
+
+    @property
     def partedDevice(self):
         if self.exists and self.status and not self._partedDevice:
             log.debug("looking up parted Device: %s" % self.path)
@@ -3067,6 +3099,7 @@ class MultipathDevice(DMDevice):
     """ A multipath device """
     _type = "dm-multipath"
     _packages = ["device-mapper-multipath"]
+    _services = ["multipathd"]
     _partitionable = True
     _isDisk = True
 
diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py
index 2decf4c..906790c 100644
--- a/storage/formats/__init__.py
+++ b/storage/formats/__init__.py
@@ -145,6 +145,7 @@ class DeviceFormat(object):
     _supported = False                  # is supported
     _linuxNative = False                # for clearpart
     _packages = []                      # required packages
+    _services = []                      # required services
     _resizable = False                  # can be resized
     _bootable = False                   # can be used as boot
     _migratable = False                 # can be migrated
@@ -341,6 +342,11 @@ class DeviceFormat(object):
         return self._packages
 
     @property
+    def services(self):
+        """ Services required to manage formats of this type. """
+        return self._services
+
+    @property
     def resizable(self):
         """ Can formats of this type be resized? """
         return self._resizable and self.exists
-- 
1.7.2

_______________________________________________
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