Re: [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]

 



On Tue, 27 Jul 2010, Chris Lumens wrote:

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


The services enablement code in InstallData.write is only going to run
if isKickstart is true, which of course won't be the case for
interactive installs.


That is unfortunate.  How about this:


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

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.
---
 instdata.py                 |   12 ++++++------
 storage/__init__.py         |    4 ++++
 storage/devices.py          |   33 +++++++++++++++++++++++++++++++++
 storage/formats/__init__.py |    6 ++++++
 4 files changed, 49 insertions(+), 6 deletions(-)

diff --git a/instdata.py b/instdata.py
index aefad18..0b60656 100644
--- a/instdata.py
+++ b/instdata.py
@@ -169,6 +169,12 @@ class InstallData:
                                    self.rootPassword["lock"],
                                    algo=self.getPassAlgo())

+        for svc in self.ksdata.services.enabled:
+            iutil.execWithRedirect("/sbin/chkconfig",
+                                   [svc, "on"],
+                                   stdout="/dev/tty5", stderr="/dev/tty5",
+                                   root=self.anaconda.rootPath)
+
         if self.anaconda.isKickstart:
             for svc in self.ksdata.services.disabled:
                 iutil.execWithRedirect("/sbin/chkconfig",
@@ -176,12 +182,6 @@ class InstallData:
                                        stdout="/dev/tty5", stderr="/dev/tty5",
                                        root=self.anaconda.rootPath)

-            for svc in self.ksdata.services.enabled:
-                iutil.execWithRedirect("/sbin/chkconfig",
-                                       [svc, "on"],
-                                       stdout="/dev/tty5", stderr="/dev/tty5",
-                                       root=self.anaconda.rootPath)
-
             for gd in self.ksdata.group.groupList:
                 if not self.users.createGroup(name=gd.name,
                                               gid=gd.gid,
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

--
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

_______________________________________________
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