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))
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
</serial-number>
|
||||
<partitions unit='GB' label=''>
|
||||
<partition from_os='yes' start='0.00GB' flags='no' device='sda1' file-system='ext3' type='primary' size='31.5GB'/>
|
||||
<partition from_os='yes' start='31.5GB' flags='no' device='sda2' file-system='ext3' type='primary' size='40.0GB'/>
|
||||
<partition from_os='yes' start='75.5GB' flags='no' device='sda4' file-system='' type='extended' size='425GB'/>
|
||||
<partition from_os='yes' start='75.5GB' flags='no' device='sda5' file-system='ext3' type='logical' size='300GB'/>
|
||||
<partition from_os='yes' start='31.5GB' flags='yes' device='sda2' file-system='ext3' type='primary' size='40.0GB'/>
|
||||
<partition from_os='yes' start='75.5GB' flags='yes' device='sda4' file-system='' type='extended' size='425GB'/>
|
||||
<partition from_os='yes' start='75.5GB' flags='yes' device='sda5' file-system='ext3' type='logical' size='300GB'/>
|
||||
<partition from_os='yes' start='375GB' flags='no' device='sda6' file-system='ext3' type='logical' size='7.00GB'/>
|
||||
<partition from_os='yes' start='382GB' flags='no' device='sda7' file-system='' type='logical' size='4.85GB'/>
|
||||
<partition from_os='yes' start='387GB' flags='no' device='sda8' file-system='ext3' type='logical' size='113GB'/>
|
||||
|
||||
@@ -727,6 +727,7 @@ 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'/>
|
||||
<!--
|
||||
column 0 column 1
|
||||
________________________________________________
|
||||
@@ -931,6 +932,11 @@ row 4 | |
|
||||
<Chinese>当添加raid设备时,活动设备列表不能为空,并且必须选定一个raid级别。</Chinese>
|
||||
</text>
|
||||
|
||||
<text key='#raid-add-active-warning'>
|
||||
<English>Active display frame can not be empty</English>
|
||||
<Chinese>活动框不能为空</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>
|
||||
|
||||
Reference in New Issue
Block a user