diff --git a/interface/ri_tk_cmd.py b/interface/ri_tk_cmd.py index da5dcb8..7914c86 100644 --- a/interface/ri_tk_cmd.py +++ b/interface/ri_tk_cmd.py @@ -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)) diff --git a/xml/install.xml b/xml/install.xml index 590f697..e55fe99 100644 --- a/xml/install.xml +++ b/xml/install.xml @@ -4,9 +4,9 @@ - - - + + + diff --git a/xml/interface.xml b/xml/interface.xml index d9220f7..1ff4910 100644 --- a/xml/interface.xml +++ b/xml/interface.xml @@ -727,6 +727,7 @@ row 4 | | +