diff --git a/interface/ri_data.py b/interface/ri_data.py index 3ce1626..ae946df 100644 --- a/interface/ri_data.py +++ b/interface/ri_data.py @@ -4,6 +4,7 @@ import re import commands from xml.dom import minidom from xml.dom.ext import PrettyPrint +from ri_tk_cmd import raid_calc_size # xml file names install_xml = '../xml/install.xml' @@ -114,14 +115,16 @@ class Partition: flg_i= s.find('Flags') if tp_i < 0: tp_i=fs_i located = True + continue if located: Partition(d+s[nm_i:st_i].strip(), # device name - s[st_i:end_i].strip(), # start + s[st_i:end_i].strip().rstrip(Partition.unit), # start s[sz_i:tp_i].strip().rstrip(Partition.unit), # size s[tp_i:fs_i].strip(), # type re.search('swap', s[fs_i:flg_i]) and 'swap' or s[fs_i:flg_i].strip(), # file system - s[flg_i:].strip() # flags + re.search('raid',s[flg_i:]) and 'yes' or 'no' # flags + "yes" #from os ) @staticmethod @@ -148,7 +151,7 @@ p_node - xml node (parent node)''' unit_attr = doc.createAttribute('unit') unit_attr.value = Partition.unit pts.setAttributeNode(unit_attr) - for p in Partition.list: + for p in Partition.dict.values(): pt = doc.createElement('partition') dev_attr = doc.createAttribute('device') start_attr = doc.createAttribute('start') @@ -252,7 +255,7 @@ l - list doc - xml document instance p_node - xml node (parent node) ''' raids = doc.createElement('raids') - for r in Raid.list: + for r in Raid.dict.values(): rd = doc.createElement('raid') rd_dev_attr = doc.createAttribute('device') @@ -289,8 +292,9 @@ p_node - xml node (parent node) ''' #ri_tk_cmd.py use @staticmethod def get_size(dev): - # need fill - pass + active=Raid.dict[dev].active + level=Raid.dict[dev].level + return raid_calc_size(level,active) @staticmethod def get_next_device(): @@ -366,7 +370,7 @@ class MountPoint: doc - xml document instance p_node - xml node (parent node)''' mps = doc.createElement('mount-points') - for m in MountPoint.list: + for m in MountPoint.dict.values(): mp = doc.createElement('mount-point') dev_attr = doc.createAttribute('device') dir_attr = doc.createAttribute('directory')