modified: ri_tk_cmd.py
add two showwarning messagebox for active devices that must be more than
two
This commit is contained in:
@@ -22,9 +22,9 @@ def mount_list_init():
|
||||
devs=ri_data.Raid.dev_in_raid()
|
||||
ri_data.MountPoint.init_from_internal()
|
||||
for m in ri_data.MountPoint.list:
|
||||
# get size from Partition info
|
||||
if m.device in devs:
|
||||
continue
|
||||
# get size from Partition info
|
||||
sz = ri_data.Partition.get_size(m.device)
|
||||
if not sz:
|
||||
sz = ri_data.Raid.get_size(m.device)
|
||||
@@ -313,11 +313,11 @@ devs - raid component devices
|
||||
'''
|
||||
# all devs shall have same size.
|
||||
unit=ri_data.Partition.unit
|
||||
sz=99999999999
|
||||
sz=999999999
|
||||
for p in ri_data.Partition.list:
|
||||
if p.device in devs:
|
||||
if float(p.size[:-len(unit)])< float(sz):
|
||||
sz = float(p.size[:-len(unit)])
|
||||
if float(p.size)< float(sz):
|
||||
sz = float(p.size)
|
||||
if level == '0':
|
||||
sz=sz*len(devs)
|
||||
return str(sz)
|
||||
@@ -330,19 +330,26 @@ devs - raid component devices
|
||||
def raid_device_add():
|
||||
''' add a new raid device '''
|
||||
if display.var_dict['raid_active_devs'].get()=='':
|
||||
ri_widget.MessageBox.dict["raid_add_active_warning"].show()
|
||||
return
|
||||
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()))
|
||||
|
||||
level = display.var_dict['raid_level'].get()
|
||||
|
||||
if not active or not level:
|
||||
ri_widget.MessageBox.dict["raid_add_warning"].show()
|
||||
return
|
||||
elif int(level) < 2 and len(active) < 2:
|
||||
ri_widget.MessageBox.dict["raid_add_active_numbers"].show()
|
||||
return
|
||||
elif str(level) == "5" and len(active)<3:
|
||||
ri_widget.MessageBox.dict["raid_add_active_2numbers"].show()
|
||||
return
|
||||
|
||||
dev = ri_data.Raid.get_next_device()
|
||||
ri_data.Raid(dev, "no", level, raid_calc_size(level, active), active, spare)
|
||||
|
||||
Reference in New Issue
Block a user