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 > Redhat > Fedora Design Team

 
 
LinkBack Thread Tools
 
Old 08-19-2010, 06:26 PM
David Cantrell
 
Default mpath: filter member partitions wiser in lvm.

Ack.

On Thu, 19 Aug 2010, Ales Kozumplik wrote:


Minutes after committing c5b49fe5c62a7f062fd4d19c157e481fc514f584 I
realized 'sda' would also filter out the partition 'sdap4' on the disk
'sdap', not desirable.

This patch essentialy reverts c5b49fe5c62a7f062fd4d19c157e481fc514f584. It
goes through all partitions of a mpath member at the moment we check it's
ignored and adds the partitions explicitly to the filter list.

Related: rhbz#624175
---
storage/devicelibs/lvm.py | 14 ++++----------
storage/devicetree.py | 18 ++++++++++++++++++
2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/storage/devicelibs/lvm.py b/storage/devicelibs/lvm.py
index 80228d7..0482cd5 100644
--- a/storage/devicelibs/lvm.py
+++ b/storage/devicelibs/lvm.py
@@ -23,9 +23,10 @@
import os
import math
import re
-import string

import iutil
+import logging
+log = logging.getLogger("storage")

from ..errors import *
from constants import *
@@ -74,15 +75,7 @@ def _composeConfig():

rejects = config_args_data["filterRejects"]
for reject in rejects:
- # If reject is "sda" we want both "sda" and "sda10" rejected but not
- # "sdab". If reject is "sda1" we want precisely "sda1" rejected and not
- # "sda10"
- if reject[-1] in string.digits:
- # ends with a digit
- filter_string += (""r|/%s$|"," % reject)
- else:
- # doesn't end with a digit so also match any number of digits
- filter_string += (""r|/%s%s$|"," % (reject, r'p?[0-9]*'))
+ filter_string += (""r|/%s$|"," % reject)

filter_string = " filter=[%s] " % filter_string.strip(",")

@@ -101,6 +94,7 @@ def _composeConfig():
def lvm_cc_addFilterRejectRegexp(regexp):
""" Add a regular expression to the --config string."""
global config_args_data
+ log.debug("lvm filter: adding %s to the reject list" % regexp)
config_args_data["filterRejects"].append(regexp)

# compoes config once more.
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 56c14f1..3cdc281 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -38,6 +38,7 @@ import devicelibs.mpath
from udev import *
from .storage_log import log_method_call
import iutil
+import parted

import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
@@ -1246,6 +1247,23 @@ class DeviceTree(object):

if self.isIgnored(info):
log.debug("ignoring %s (%s)" % (name, sysfs_path))
+ if udev_device_is_multipath_member(info):
+ # last time we are seeing this mpath member is now, so make sure
+ # LVM ignores its partitions too else a duplicate VG name could
+ # harm us later during partition creation:
+ if udev_device_is_dm(info):
+ path = "/dev/mapper/%s" % name
+ else:
+ path = "/dev/%s" % name
+ log.debug("adding partitions on %s to the lvm ignore list" % path)
+ partitions_paths = []
+ try:
+ partitions_paths = [p.path
+ for p in parted.Disk(device=parted.Device(path=path)).parti tions]
+ except (_ped.IOException, _ped.DeviceException) as e:
+ log.error("Parted error scanning partitions on %s:" % path)
+ log.error(str(e))
+ map(lvm.lvm_cc_addFilterRejectRegexp, partition_paths)
return

log.debug("scanning %s (%s)..." % (name, sysfs_path))



--
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 08-24-2010, 05:08 PM
Ales Kozumplik
 
Default mpath: filter member partitions wiser in lvm.

Minutes after committing c5b49fe5c62a7f062fd4d19c157e481fc514f584 I
realized 'sda' would also filter out the partition 'sdap4' on the disk
'sdap', not desirable.

This patch essentialy reverts c5b49fe5c62a7f062fd4d19c157e481fc514f584. It
goes through all partitions of a mpath member at the moment we check it's
ignored and adds the partitions explicitly to the filter list.

Related: rhbz#624175
---
storage/devicelibs/lvm.py | 14 ++++----------
storage/devicetree.py | 20 ++++++++++++++++++++
2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/storage/devicelibs/lvm.py b/storage/devicelibs/lvm.py
index 80228d7..0482cd5 100644
--- a/storage/devicelibs/lvm.py
+++ b/storage/devicelibs/lvm.py
@@ -23,9 +23,10 @@
import os
import math
import re
-import string

import iutil
+import logging
+log = logging.getLogger("storage")

from ..errors import *
from constants import *
@@ -74,15 +75,7 @@ def _composeConfig():

rejects = config_args_data["filterRejects"]
for reject in rejects:
- # If reject is "sda" we want both "sda" and "sda10" rejected but not
- # "sdab". If reject is "sda1" we want precisely "sda1" rejected and not
- # "sda10"
- if reject[-1] in string.digits:
- # ends with a digit
- filter_string += (""r|/%s$|"," % reject)
- else:
- # doesn't end with a digit so also match any number of digits
- filter_string += (""r|/%s%s$|"," % (reject, r'p?[0-9]*'))
+ filter_string += (""r|/%s$|"," % reject)

filter_string = " filter=[%s] " % filter_string.strip(",")

@@ -101,6 +94,7 @@ def _composeConfig():
def lvm_cc_addFilterRejectRegexp(regexp):
""" Add a regular expression to the --config string."""
global config_args_data
+ log.debug("lvm filter: adding %s to the reject list" % regexp)
config_args_data["filterRejects"].append(regexp)

# compoes config once more.
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 56c14f1..fb9e275 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -38,6 +38,7 @@ import devicelibs.mpath
from udev import *
from .storage_log import log_method_call
import iutil
+import parted

import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
@@ -1246,6 +1247,25 @@ class DeviceTree(object):

if self.isIgnored(info):
log.debug("ignoring %s (%s)" % (name, sysfs_path))
+ if udev_device_is_multipath_member(info):
+ # last time we are seeing this mpath member is now, so make sure
+ # LVM ignores its partitions too else a duplicate VG name could
+ # harm us later during partition creation:
+ if udev_device_is_dm(info):
+ path = "/dev/mapper/%s" % name
+ else:
+ path = "/dev/%s" % name
+ log.debug("adding partitions on %s to the lvm ignore list" % path)
+ partitions_paths = []
+ try:
+ partitions_paths = [p.path
+ for p in parted.Disk(device=parted.Device(path=path)).parti tions]
+ except (_ped.IOException, _ped.DeviceException) as e:
+ log.error("Parted error scanning partitions on %s:" % path)
+ log.error(str(e))
+ # slice off the "/dev/" part, lvm filter cares only about the rest
+ partitions_paths = [p[5:] for p in partitions_paths]
+ map(lvm.lvm_cc_addFilterRejectRegexp, partitions_paths)
return

log.debug("scanning %s (%s)..." % (name, sysfs_path))
--
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 08-24-2010, 05:10 PM
Ales Kozumplik
 
Default mpath: filter member partitions wiser in lvm.

On 08/19/2010 08:05 PM, Ales Kozumplik wrote:

This patch essentialy reverts c5b49fe5c62a7f062fd4d19c157e481fc514f584. It
goes through all partitions of a mpath member at the moment we check it's
ignored and adds the partitions explicitly to the filter list.


Sending an updated version, the only added part is the
# slice off the "/dev/" part, lvm filter cares only
about the rest

partitions_paths = [p[5:] for p in partitions_paths]
.

I have one log from IBM available for the original patch and it seems to
be working okay (except the '/dev/' part of course):


16:58:25,413 DEBUG : ignoring sdi
(/devices/vio/3000000b/host8/target8:0:1/8:0:1:0/block/sdi)

16:58:25,413 DEBUG : adding partitions on /dev/sdi to the lvm ignore list
16:58:25,450 DEBUG : lvm filter: adding /dev/sdi1 to the reject list
16:58:25,451 DEBUG : lvm filter: adding /dev/sdi2 to the reject list
16:58:25,451 DEBUG : lvm filter: adding /dev/sdi3 to the reject list


Then when lvm is called:
16:58:30,078 INFO : Running... ['lvm', 'lvchange', '-a', 'y',
'--config', ' devices {
filter=["r|/sda$|","r|/sdc$|","r|//dev/sdc1$|","r|//dev/sdc2$|","r|//dev/sdc3$|","r|/sdi$|","r|//dev/sdi1$|","r|//dev/sdi2$|","r|//dev/sdi3$|","r|/sdd$|","r|/sdf$|","r|/sdb$|","r|//dev/sdb1$|","r|//dev/sdb2$|","r|//dev/sdb3$|","r|/sdh$|","r|//dev/sdh1$|","r|//dev/sdh2$|","r|//dev/sdh3$|"]
} ', 'vg_jabulanlp4/lv_root']


(notice how the sdi* devices are there)

Ales

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 08-24-2010, 05:14 PM
David Cantrell
 
Default mpath: filter member partitions wiser in lvm.

On Tue, 24 Aug 2010, Ales Kozumplik wrote:


On 08/19/2010 08:05 PM, Ales Kozumplik wrote:

This patch essentialy reverts c5b49fe5c62a7f062fd4d19c157e481fc514f584. It
goes through all partitions of a mpath member at the moment we check it's
ignored and adds the partitions explicitly to the filter list.


Sending an updated version, the only added part is the
# slice off the "/dev/" part, lvm filter cares only about the
rest

partitions_paths = [p[5:] for p in partitions_paths]
.

I have one log from IBM available for the original patch and it seems to be
working okay (except the '/dev/' part of course):


16:58:25,413 DEBUG : ignoring sdi
(/devices/vio/3000000b/host8/target8:0:1/8:0:1:0/block/sdi)

16:58:25,413 DEBUG : adding partitions on /dev/sdi to the lvm ignore list
16:58:25,450 DEBUG : lvm filter: adding /dev/sdi1 to the reject list
16:58:25,451 DEBUG : lvm filter: adding /dev/sdi2 to the reject list
16:58:25,451 DEBUG : lvm filter: adding /dev/sdi3 to the reject list


Then when lvm is called:
16:58:30,078 INFO : Running... ['lvm', 'lvchange', '-a', 'y', '--config',
' devices {
filter=["r|/sda$|","r|/sdc$|","r|//dev/sdc1$|","r|//dev/sdc2$|","r|//dev/sdc3$|","r|/sdi$|","r|//dev/sdi1$|","r|//dev/sdi2$|","r|//dev/sdi3$|","r|/sdd$|","r|/sdf$|","r|/sdb$|","r|//dev/sdb1$|","r|//dev/sdb2$|","r|//dev/sdb3$|","r|/sdh$|","r|//dev/sdh1$|","r|//dev/sdh2$|","r|//dev/sdh3$|"]
} ', 'vg_jabulanlp4/lv_root']


(notice how the sdi* devices are there)



Ack. Good find, IBM will be pleased.

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

Thread Tools




All times are GMT. The time now is 03:59 PM.

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