modified: ri_tk_cmd.py

add two showwarning messagebox for active devices that must be more than
    two
This commit is contained in:
fling
2010-10-14 15:05:40 +08:00
parent 4f81fc0f46
commit fb83d4b510
2 changed files with 30 additions and 15 deletions

View File

@@ -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)

View File

@@ -727,7 +727,8 @@ row 4 | |
<message_box name='previous' type='showinfo' title='install sequence' message='#first-step'/>
<message_box name='raid_add_warning' type='showwarning' title='raid adding' message='#raid-add-warning'/>
<message_box name='raid_delete_warning' type='showwarning' title='raid deleting' message='#raid-delete-warning'/>
<message_box name='raid_add_active_warning' type='showwarning' title='active' message='#raid-add-active-warning'/>
<message_box name='raid_add_active_numbers' type='showwarning' title='number' message='#raid-add-active-numbers'/>
<message_box name='raid_add_active_2numbers' type='showwarning' title='number' message='#raid-add-active-2numbers'/>
<!--
column 0 column 1
________________________________________________
@@ -928,16 +929,23 @@ row 4 | |
<Chinese>磐石 4.2</Chinese>
</text>
<text key='#raid-add-warning'>
<English>When adding a raid device, active list can not be null, and one raid level must be selected</English>
<Chinese>添加raid设备时活动设备列表不能为空并且必须选定一个raid级别</Chinese>
<text key='#raid-add-active-numbers'>
<English>When make a raid0 or raid1, the partitions on the active display frame, must be more than one!</English>
<Chinese>制作raid0或raid1时硬盘分区必须两个或两个以上</Chinese>
</text>
<text key='#raid-add-active-warning'>
<English>Active display frame can not be empty</English>
<Chinese>活动框不能为空</Chinese>
<text key='#raid-add-active-2numbers'>
<English>When make a raid5, the partitions on the active display frame, must be more than two!</English>
<Chinese>当制作raid5的时,硬盘分区必须三个或三个以上。</Chinese>
</text>
<text key='#raid-add-warning'>
<English>When adding a raid device, active list can not be null, and one raid level must be selected!</English>
<Chinese>当添加raid设备时使用设备列表不能为空并且必须选定一个raid级别。</Chinese>
</text>
<text key='#raid-delete-warning'>
<English>You can not delete an existing raid, which is not made by I (install program)!</English>
<Chinese>对于一个早已存在的raid设备不是由安装程序创建的你不能把它删除。</Chinese>
@@ -1039,7 +1047,7 @@ row 4 | |
<text>
<English>Active</English>
<Chinese>活动</Chinese>
<Chinese>使用</Chinese>
</text>
<text>
@@ -1229,7 +1237,7 @@ row 4 | |
<text>
<English>Spare</English>
<Chinese>空闲</Chinese>
<Chinese>备用</Chinese>
</text>
<text>