FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 07-27-2010, 07:52 PM
David Cantrell
 
Default 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.
---
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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 07-27-2010, 08:50 PM
Chris Lumens
 
Default Make sure multipathd starts on systems using mpath storage (#615040)

> 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.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 07-27-2010, 09:21 PM
David Cantrell
 
Default Make sure multipathd starts on systems using mpath storage (#615040)

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@redhat.com>
Red Hat / Honolulu, HI

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 07-28-2010, 03:05 PM
Chris Lumens
 
Default Make sure multipathd starts on systems using mpath storage (#615040)

> 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.

You're going in the right direction. However, you won't have a ksdata
object unless you're doing a kickstart install either. I should have
explained that in the previous mail too, I suppose.

Perhaps what you should do is have a storage.services property that does
the map and set stuff, then have instdata refer to that as well...

> 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",

services = self.anaconda.storage.services
if self.anaconda.isKickstart:
services.extend(self.ksdata.services.enabled)

for svc in services:
...

Note that for master, in addition to removing "id", you'll want to use
"if self.ksdata" instead because isKickstart does not exist.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 07-28-2010, 03:39 PM
David Cantrell
 
Default Make sure multipathd starts on systems using mpath storage (#615040)

On Wed, 28 Jul 2010, Chris Lumens wrote:


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.


You're going in the right direction. However, you won't have a ksdata
object unless you're doing a kickstart install either. I should have
explained that in the previous mail too, I suppose.

Perhaps what you should do is have a storage.services property that does
the map and set stuff, then have instdata refer to that as well...


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",


services = self.anaconda.storage.services
if self.anaconda.isKickstart:
services.extend(self.ksdata.services.enabled)

for svc in services:
...

Note that for master, in addition to removing "id", you'll want to use
"if self.ksdata" instead because isKickstart does not exist.


Third iteration:

[PATCH] 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 | 16 ++++++++++------
storage/__init__.py | 4 ++++
storage/devices.py | 33 +++++++++++++++++++++++++++++++++
storage/formats/__init__.py | 6 ++++++
4 files changed, 53 insertions(+), 6 deletions(-)

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

+ services = list(self.storage.services)
+
if self.anaconda.isKickstart:
+ services.extend(self.ksdata.services.enabled)
+
for svc in self.ksdata.services.disabled:
iutil.execWithRedirect("/sbin/chkconfig",
[svc, "off"],
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,
@@ -202,6 +200,12 @@ class InstallData:
gecos=ud.gecos):
log.error("User %s already exists, not creating." % ud.name)

+ for svc in services:
+ iutil.execWithRedirect("/sbin/chkconfig",
+ [svc, "on"],
+ stdout="/dev/tty5", stderr="/dev/tty5",
+ root=self.anaconda.rootPath)
+

def writeKS(self, filename):
f = open(filename, "w")
diff --git a/storage/__init__.py b/storage/__init__.py
index 42a9142..6ed7678 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -165,6 +165,9 @@ def storageComplete(anaconda):
if dev.format.type == "luks" and not dev.format.exists:
dev.format.passphrase = anaconda.id.storage.encryptionPassphrase

+ map(lambda d: anaconda.id.storage.services.add(d.services),
+ anaconda.id.storage.fsset)
+
if anaconda.isKickstart:
return

@@ -289,6 +292,7 @@ class Storage(object):
iscsi=self.iscsi,
dasd=self.dasd)
self.fsset = FSSet(self.devicetree, self.anaconda.rootPath)
+ self.services = set()

def doIt(self):
self.devicetree.processActions()
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@redhat.com>
Red Hat / Honolulu, HI

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 07-28-2010, 04:58 PM
Chris Lumens
 
Default Make sure multipathd starts on systems using mpath storage (#615040)

> Third iteration:
>
> [PATCH] 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.

Looks okay to me now.

- Chris

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

Thread Tools




All times are GMT. The time now is 09:46 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org