Merge commit 'origin/fling3'
This commit is contained in:
@@ -18,10 +18,16 @@ def serial_no_quit():
|
||||
|
||||
def mount_list_init():
|
||||
''' initialize mount list '''
|
||||
ri_data.MountPoint.init_from_internal()
|
||||
dev_in_raid = set()
|
||||
l = []
|
||||
for r in ri_data.Raid.list:
|
||||
dev_in_raid.update(r.active_components)
|
||||
dev_in_raid.update(r.spare_components)
|
||||
ri_data.MountPoint.init_from_internal()
|
||||
for m in ri_data.MountPoint.list:
|
||||
# get size from Partition info
|
||||
if m.device in dev_in_raid:
|
||||
continue
|
||||
sz = ri_data.Partition.get_size(m.device)
|
||||
if not sz:
|
||||
sz = ri_data.Raid.get_size(m.device)
|
||||
@@ -313,21 +319,32 @@ level - raid level (0/1/5)
|
||||
devs - raid component devices
|
||||
'''
|
||||
# all devs shall have same size.
|
||||
unit=ri_data.Partition.unit
|
||||
sz=99999999999
|
||||
for p in ri_data.Partition.list:
|
||||
if p.device == devs[0]:
|
||||
sz = p.size
|
||||
break
|
||||
if p.device in devs:
|
||||
if float(p.size[:-len(unit)])< float(sz):
|
||||
sz = float(p.size[:-len(unit)])
|
||||
if level == '0':
|
||||
return len(devs)*sz
|
||||
sz=sz*len(devs)
|
||||
return "%d%s"%(sz,unit)
|
||||
elif level == '1':
|
||||
return sz
|
||||
return "%d%s"%(sz,unit)
|
||||
elif level == '5':
|
||||
return sz*(len(devs)-1)
|
||||
sz=sz*(len(devs)-1)
|
||||
return "%d%s"%(sz,unit)
|
||||
|
||||
def raid_device_add():
|
||||
''' add a new raid device '''
|
||||
active = eval(display.var_dict['raid_active_devs'].get())
|
||||
spare = eval(display.var_dict['raid_spare_devs'].get())
|
||||
if display.var_dict['raid_active_devs'].get()=='':
|
||||
ri_widget.MessageBox.dict["raid_add_active_warning"].show()
|
||||
return
|
||||
else:
|
||||
active = list(eval(display.var_dict['raid_active_devs'].get()))
|
||||
if display.var_dict['raid_spare_devs'].get()=='':
|
||||
spare=[]
|
||||
else:
|
||||
spare = list(eval(display.var_dict['raid_spare_devs'].get()))
|
||||
level = display.var_dict['raid_level'].get()
|
||||
|
||||
if not active or not level:
|
||||
@@ -335,7 +352,7 @@ def raid_device_add():
|
||||
return
|
||||
|
||||
dev = ri_data.Raid.get_next_device()
|
||||
ri_data.Raid(dev, False, level, raid_calc_size(level, active), active, spare)
|
||||
ri_data.Raid(dev, "no", level, raid_calc_size(level, active), active, spare)
|
||||
raid_device_init()
|
||||
display.var_dict['raid_active_devs'].set(value='')
|
||||
display.var_dict['raid_spare_devs'].set(value='')
|
||||
@@ -350,12 +367,19 @@ def raid_device_delete():
|
||||
if len(idxs) == 1:
|
||||
idx = int(idxs[0])
|
||||
r = ri_data.Raid.list[idx]
|
||||
if r.from_os:
|
||||
if r.from_os == 'yes':
|
||||
ri_widget.MessageBox.dict["raid_delete_warning"].show()
|
||||
return
|
||||
active = list(eval(display.var_dict['raid_active_devs'].get()))
|
||||
if display.var_dict['raid_active_devs'].get() == '':
|
||||
active=[]
|
||||
else:
|
||||
active = list(eval(display.var_dict['raid_active_devs'].get()))
|
||||
if display.var_dict['raid_spare_devs'].get()=='':
|
||||
spare=[]
|
||||
else:
|
||||
spare = list(eval(display.var_dict['raid_spare_devs'].get()))
|
||||
|
||||
active.extend(r.active_components)
|
||||
spare = list(eval(display.var_dict['raid_spare_devs'].get()))
|
||||
spare.extend(r.spare_components)
|
||||
# do not touch level
|
||||
display.var_dict['raid_active_devs'].set(value=tuple(active))
|
||||
|
||||
Reference in New Issue
Block a user