Correct the funciton to calculate raid size

Correct the funciton to del raid

       modified:   interface/ri_data.py
       modified:   new_partition/interface_partition.py
       modified:   text/ri_main.py
       modified:   text/ri_newt.py
This commit is contained in:
Peng Zhihui
2014-02-13 13:14:24 +08:00
parent 2002522ad5
commit 99c32ef85c
4 changed files with 21 additions and 5 deletions

View File

@@ -330,11 +330,15 @@ p_node - xml node (parent node) '''
def get_size(dev):
''' calculate raid device size '''
rd = Raid.dict[dev]
sz = min([ float(interface_partition.get_num(p_d.Partition.dict[p_d.Partition.get_disk_from_partition('/dev/'+d)]\
Min = min([ float(interface_partition.get_num(p_d.Partition.dict[p_d.Partition.get_disk_from_partition('/dev/'+d)]\
['partition']['/dev/'+d]['size'])) for d in rd.active_components])
if rd.level == '0': return str(interface_partition.pretty_unit(sz*len(rd.active_components)))
elif rd.level == '1': return str(interface_partition.pretty_unit(sz*len(rd.active_components)/2))
elif rd.level == '5': return str(interface_partition.pretty_unit(sz*(len(rd.active_components)-1)))
Sum = sum([ float(interface_partition.get_num(p_d.Partition.dict[p_d.Partition.get_disk_from_partition('/dev/'+d)]\
['partition']['/dev/'+d]['size'])) for d in rd.active_components])
#if rd.level == '0': return str(interface_partition.pretty_unit(Min*len(rd.active_components)))
#elif rd.level == '1': return str(interface_partition.pretty_unit(Min*len(rd.active_components)/2))
if rd.level == '0': return str(interface_partition.pretty_unit(Sum))
elif rd.level == '1': return str(interface_partition.pretty_unit(Min))
elif rd.level == '5': return str(interface_partition.pretty_unit(Min*(len(rd.active_components)-1)))
@staticmethod
def get_next_device():