/[smeserver]/rpms/booty/sme8/booty-0.80.6-Translate-dm-0-to-devicename.patch
ViewVC logotype

Annotation of /rpms/booty/sme8/booty-0.80.6-Translate-dm-0-to-devicename.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Sat Sep 17 21:16:16 2011 UTC (12 years, 9 months ago) by slords
Branch: MAIN
CVS Tags: booty-0_80_6-10_el5_sme, booty-0_80_6-10, HEAD
Upstream import

1 slords 1.1 From 7372ff1c7e31e726b6ebf908cdf91460a44b9d0a Mon Sep 17 00:00:00 2001
2     From: Ales Kozumplik <akozumpl@redhat.com>
3     Date: Wed, 2 Mar 2011 15:14:07 +0100
4     Subject: [booty rhel5-branch 3/3] Translate dm-0 to <devicename>. (#667014)
5    
6     This is important so booty can match the boot/ device with the drivelist
7     if boot/ is on a raid.
8    
9     The fix is based on a patch by Masahiro Matsuya <mmatsuya@redhat.com>.
10     ---
11     bootyutil.py | 20 ++++++++++++++++++++
12     checkbootloader.py | 6 ++++--
13     2 files changed, 24 insertions(+), 2 deletions(-)
14    
15     diff --git a/bootyutil.py b/bootyutil.py
16     index cbfab5c..ea48c44 100644
17     --- a/bootyutil.py
18     +++ b/bootyutil.py
19     @@ -12,8 +12,11 @@
20     #
21     #
22    
23     +import os
24     import string
25    
26     +import rhpl.executil
27     +
28     # return (disk, partition number) eg ('hda', 1)
29     def getDiskPart(dev):
30     cut = len(dev)
31     @@ -46,3 +49,20 @@ def getDiskPart(dev):
32     partNum = None
33    
34     return (name, partNum)
35     +
36     +def name_from_dm_node(dm_node):
37     + """ Translate dm node to the device name.
38     +
39     + For instance "dm-0" to "mpath0".
40     + """
41     +
42     + full_path = "/sys/block/%s/dev" % dm_node
43     + if not os.path.exists(full_path):
44     + raise RuntimeError("name_from_dm_node: device does not exist: %s" %
45     + full_path)
46     + dev_file = open(full_path)
47     + (major, minor) = dev_file.readline().strip().split(":")
48     + name = rhpl.executil.execWithCapture(\
49     + "/sbin/dmsetup",["/sbin/dmsetup", "info", "--columns", "--noheadings",
50     + "-o", "name", "-j", str(major), "-m", str(minor)])
51     + return name.strip()
52     diff --git a/checkbootloader.py b/checkbootloader.py
53     index 512e880..29e6a50 100644
54     --- a/checkbootloader.py
55     +++ b/checkbootloader.py
56     @@ -23,6 +23,7 @@ liloConfigFile = "/etc/lilo.conf"
57     yabootConfigFile = "/etc/yaboot.conf"
58     siloConfigFile = "/etc/silo.conf"
59    
60     +import bootyutil
61     from bootyutil import getDiskPart
62    
63     def getRaidDisks(raidDevice, raidLevel=None, stripPart=1):
64     @@ -39,7 +40,7 @@ def getRaidDisks(raidDevice, raidLevel=None, stripPart=1):
65     f.close()
66     except:
67     return rc
68     -
69     +
70     for line in lines:
71     fields = string.split(line, ' ')
72     if fields[0] == raidDevice:
73     @@ -51,6 +52,8 @@ def getRaidDisks(raidDevice, raidLevel=None, stripPart=1):
74     dev = string.split(field, '[')[0]
75     if len(dev) == 0:
76     continue
77     + if dev.startswith("dm-"):
78     + dev = "mapper/%s" % bootyutil.name_from_dm_node(dev)
79     if stripPart:
80     disk = getDiskPart(dev)[0]
81     rc.append(disk)
82     @@ -58,7 +61,6 @@ def getRaidDisks(raidDevice, raidLevel=None, stripPart=1):
83     rc.append(dev)
84    
85     return rc
86     -
87    
88     def getBootBlock(bootDev, instRoot, seekBlocks=0):
89     """Get the boot block from bootDev. Return a 512 byte string."""
90     --
91     1.7.3.3
92    

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed