Add cciss hdd support.

netsetup 2.2.9
Mike Hiretsky 13 years ago
parent e7deed1d4d
commit 655ad491b0

@ -156,6 +156,8 @@ class fillVars(object, glob_attr):
cl_overriding.printERROR(_("Command not found '%s'")%"parted")
cl_overriding.exit(1)
for mapnum,device in enumerate(sorted(devices,key=self.separateDevice)):
if device.startswith('cciss'):
device = device.replace('!','/')
device_hash[device] = {}
device_hash[device]['map'] = mapnum
device_hash[device]['table'] = None
@ -184,12 +186,14 @@ class fillVars(object, glob_attr):
return device_hash
def get_os_disk_hash(self):
reSdaPart = re.compile("^/dev/sd([a-z])(\d+)$")
reSdaPart = \
re.compile("^/dev/sd([a-z])(\d+)|/dev/cciss/c\dd(\d+)p(\d+)$")
devicesHash = self.Get('os_device_hash')
devices = devicesHash.keys()
disksDevs = reduce( lambda x,y: x +
map( lambda x: ["/dev/%s"%x,y],
filter(lambda x: y in x,listDirectory('/sys/block/%s'%y))),
map( lambda x: ["/dev/%s"%x.replace('!','/'),y],
filter(lambda x: y in x.replace('!','/'),
listDirectory('/sys/block/%s'%y.replace('/','!')))),
devices, [] )
disks = map(lambda x:x[0],disksDevs)
@ -200,9 +204,14 @@ class fillVars(object, glob_attr):
disk_hash[dev] = {}
match = reSdaPart.match(dev)
if match:
disk_hash[dev]['grub'] = "%d,%d" % \
(ord(match.groups()[0])-ord('a'),
int(match.groups()[1])-1)
if match.groups()[0]:
disk_hash[dev]['grub'] = "%d,%d" % \
(ord(match.groups()[0])-ord('a'),
int(match.groups()[1])-1)
else:
disk_hash[dev]['grub'] = "%d,%d" % \
(int(match.groups()[2]),
int(match.groups()[3])-1)
curDevice = None
# getting id
@ -236,8 +245,9 @@ class fillVars(object, glob_attr):
if res is False:
cl_overriding.printERROR(_("Cann't execute '%s'")%execStr)
cl_overriding.exit(1)
partTemplate = "/dev/%sp%s" if "cciss" in device else "/dev/%s%s"
for dev,partid in filter(lambda x:x[0] in disk_hash,
map(lambda x:["/dev/%s%s"%(device,x[0]),x[1]],
map(lambda x:[partTemplate%(device,x[0]),x[1]],
map(lambda x:x.split()[0:6:5],
reduce(lambda x,y:x+[y] \
if x or y.startswith("Number") else x,
@ -270,7 +280,10 @@ class fillVars(object, glob_attr):
# if first part is number then it is partition description
if parts[0].isdigit():
# part name it is devicename + partition number
partition = curDevice + parts[0]
if "cciss" in curDevice:
partition = "%sp%s"%(curDevice,parts[0])
else:
partition = curDevice + parts[0]
# create entry if hash hasn't it
if not partition in disk_hash:
disk_hash[partition] = {}

Loading…
Cancel
Save