conga/luci/site/luci/Extensions StorageReport. ...
CVSROOT: /cvs/cluster
Module name: conga
Changes by: kupcevic at sourceware.org 2006-10-09 17:01:20
Modified files:
luci/site/luci/Extensions: StorageReport.py
conga_storage_constants.py storage_adapters.py
Log message:
luci storage: centralize pretty names and icons
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/StorageReport.py.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_storage_constants.py.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/storage_adapters.py.diff?cvsroot=cluster&r1=1.4&r2=1.5
luci/site/luci/Extensions/StorageReport.py +23 -132
@@ -443,50 +443,12 @@ sources.append(get_bd_data_internal(session, s_xml, mapper)) type = mapper.getAttribute('mapper_type') - pretty_type = 'Mapper' + pretty_type, pretty_target_name, pretty_source_name = get_pretty_mapper_info(type) pretty_name = mapper_id.replace(type + ':', '').replace('/dev/', '') - pretty_target_name = 'target' - pretty_source_name = 'source' - icon_name = '' - color = 'black' - if type == MAPPER_SYS_TYPE: - pretty_type = 'Hard Drives' - pretty_target_name = 'Hard Drive' - elif type == MAPPER_VG_TYPE: - pretty_type = 'Volume Group' - pretty_target_name = 'Logical Volume' - pretty_source_name = 'Physical Volume' - icon_name = 'icon_mapper_VG.png' - elif type == MAPPER_PT_TYPE: - pretty_type = 'Partition Table' - pretty_target_name = 'Partition' - pretty_source_name = 'Disk' - icon_name = 'icon_mapper_PT.png' - elif type == MAPPER_MDRAID_TYPE: - pretty_type = 'Software RAID' - pretty_target_name = 'Volume' - pretty_source_name = 'Disk' - icon_name = 'icon_mapper_raid.png' - elif type == MAPPER_ATARAID_TYPE: - pretty_type = 'ATA-RAID' - pretty_target_name = 'Volume' - pretty_source_name = 'Disk' - icon_name = 'icon_mapper_raid.png' - elif type == MAPPER_MULTIPATH_TYPE: - pretty_type = 'Multipath' - pretty_target_name = 'Multipath' - pretty_source_name = 'Path' - icon_name = 'icon_mapper_multipath.png' - elif type == MAPPER_CRYPTO_TYPE: - pretty_type = 'Encryption' - pretty_target_name = 'Volume' - pretty_source_name = 'Device' - icon_name = 'icon_mapper_crypto.png' - elif type == MAPPER_iSCSI_TYPE: - pretty_type = 'iSCSI' - pretty_target_name = 'Volume' pretty_targets_name = pretty_target_name + 's' pretty_sources_name = pretty_source_name + 's' + icon_name, dummy1, dummy2 = get_mapper_icons(type) + color = 'black' mapper_ret = {} mapper_ret['pretty_type'] = pretty_type
@@ -496,7 +458,7 @@ mapper_ret['pretty_source_name'] = pretty_source_name mapper_ret['pretty_sources_name'] = pretty_sources_name mapper_ret['mapper_id'] = mapper_id - mapper_ret['mapper_type'] = mapper.getAttribute('mapper_type') + mapper_ret['mapper_type'] = type mapper_ret['props'] = props mapper_ret['targets'] = targets mapper_ret['new_targets'] = new_targets
@@ -639,50 +601,12 @@ sources.append(get_bd_data_internal(session, s_xml, mapper)) type = mapper.getAttribute('mapper_type') - pretty_type = 'Mapper' + pretty_type, pretty_target_name, pretty_source_name = get_pretty_mapper_info(type) pretty_name = mapper_id.replace(type + ':', '').replace('/dev/', '') - pretty_target_name = 'target' - pretty_source_name = 'source' - icon_name = 'none' - color = 'black' - if type == MAPPER_SYS_TYPE: - pretty_type = 'Hard Drives' - pretty_target_name = 'Hard Drive' - elif type == MAPPER_VG_TYPE: - pretty_type = 'Volume Group' - pretty_target_name = 'Logical Volume' - pretty_source_name = 'Physical Volume' - icon_name = 'icon_mapper_VG.png' - elif type == MAPPER_PT_TYPE: - pretty_type = 'Partition Table' - pretty_target_name = 'Partition' - pretty_source_name = 'Disk' - icon_name = 'icon_mapper_PT.png' - elif type == MAPPER_MDRAID_TYPE: - pretty_type = 'Software RAID' - pretty_target_name = 'Volume' - pretty_source_name = 'Disk' - icon_name = 'icon_mapper_raid.png' - elif type == MAPPER_ATARAID_TYPE: - pretty_type = 'ATA-RAID' - pretty_target_name = 'Volume' - pretty_source_name = 'Disk' - icon_name = 'icon_mapper_raid.png' - elif type == MAPPER_MULTIPATH_TYPE: - pretty_type = 'Multipath' - pretty_target_name = 'Multipath' - pretty_source_name = 'Path' - icon_name = 'icon_mapper_multipath.png' - elif type == MAPPER_CRYPTO_TYPE: - pretty_type = 'Encryption' - pretty_target_name = 'Volume' - pretty_source_name = 'Device' - icon_name = 'icon_mapper_crypto.png' - elif type == MAPPER_iSCSI_TYPE: - pretty_type = 'iSCSI' - pretty_target_name = 'Volume' pretty_targets_name = pretty_target_name + 's' pretty_sources_name = pretty_source_name + 's' + icon_name, dummy1, dummy2 = get_mapper_icons(type) + color = 'black' min_sources = '0' max_sources = '0'
@@ -704,7 +628,7 @@ mapper_ret['pretty_source_name'] = pretty_source_name mapper_ret['pretty_sources_name'] = pretty_sources_name mapper_ret['mapper_id'] = mapper_id - mapper_ret['mapper_type'] = mapper.getAttribute('mapper_type') + mapper_ret['mapper_type'] = type mapper_ret['props'] = props #mapper_ret['removable'] = removable mapper_ret['targets'] = targets
@@ -1523,42 +1447,24 @@ mapper_id = bd_xml.getAttribute('mapper_id') contents = get_content_data_internal(session, bd_xml) - type = bd_xml.getAttribute('mapper_type') + pretty_mapper_type, pretty_type, dummy2 = get_pretty_mapper_info(mapper_type) pretty_name = path.replace('/dev/','') - pretty_type = 'Block Device' + dummy1, icon_name, dummy2 = get_mapper_icons(mapper_type) + color = 'black' + size_in_units, units = bytes_to_value_units(props['size']['value']) description = str(size_in_units) + ' ' + units - icon_name = '' - color = 'black' - if type == MAPPER_SYS_TYPE: - pretty_type = 'Hard Drive' - icon_name = 'icon_bd_ide.png' + + if mapper_type == MAPPER_SYS_TYPE: if 'scsi_id' in props: description += ', SCSI ID = ' + props['scsi_id']['value'] icon_name = 'icon_bd_scsi.png' - elif type == MAPPER_VG_TYPE: + elif mapper_type == MAPPER_VG_TYPE: pretty_name = props['lvname']['value'] - pretty_type = 'Logical Volume' + color = '#0192db' if props['snapshot']['value'] == 'true': icon_name = 'icon_bd_LV_snapshot.png' - else: - icon_name = 'icon_bd_LV.png' - color = '#0192db' - elif type == MAPPER_PT_TYPE: - pretty_type = 'Partition' - icon_name = 'icon_bd_partition.png' - elif type == MAPPER_MDRAID_TYPE or type == MAPPER_ATARAID_TYPE: - pretty_type = 'Volume' - icon_name = 'icon_bd_raid.png' - elif type == MAPPER_MULTIPATH_TYPE: - pretty_type = 'Multipath' - icon_name = 'icon_bd_multipath.png' - elif type == MAPPER_CRYPTO_TYPE: - pretty_type = 'Volume' - icon_name = 'icon_bd_crypto.png' - elif type == MAPPER_iSCSI_TYPE: - pretty_type = 'Volume' - icon_name = 'icon_bd_net.png' + pretty_type = 'Snapshot' if bd_xml.nodeName == BD_TEMPLATE: path = 'unused_segment'
@@ -1575,12 +1481,9 @@ if data['new']: contents = [] path = 'new_snapshot' - pretty_type = 'New Snapshot' pretty_name = '' - else: - pretty_type = 'Snapshot' - #pretty_name = 'Unused Space' - + + data['pretty_mapper_type'] = pretty_mapper_type data['pretty_type'] = pretty_type data['pretty_name'] = pretty_name data['description'] = description
@@ -1772,24 +1675,12 @@ icon_name = '' type = d['xml'].getAttribute('type') if type == 'filesystem': - icon_name = 'icon_content_FS.png' + icon_name = get_fs_icon(d['xml'].getAttribute('fs_type')) elif type == 'mapper_source': mapper_type = d['xml'].getAttribute('mapper_type') - if mapper_type == MAPPER_SYS_TYPE: - pass - elif mapper_type == MAPPER_VG_TYPE: + dummy1, dummy2, icon_name = get_mapper_icons(mapper_type) + if mapper_type == MAPPER_VG_TYPE: color = '#a43737' - icon_name = 'icon_content_PV.png' - elif mapper_type == MAPPER_PT_TYPE: - pass - elif mapper_type == MAPPER_MDRAID_TYPE or mapper_type == MAPPER_ATARAID_TYPE: - pass - elif mapper_type == MAPPER_MULTIPATH_TYPE: - pass - elif mapper_type == MAPPER_CRYPTO_TYPE: - pass - elif mapper_type == MAPPER_iSCSI_TYPE: - pass elif type == 'none': pass elif type == 'hidden':
@@ -1820,7 +1711,7 @@ elif mapper_type == MAPPER_VG_TYPE: name = 'Physical Volume' elif mapper_type == MAPPER_PT_TYPE: - name = 'Partition Table\'s Disk' + name = 'Partition Table' elif mapper_type == MAPPER_MDRAID_TYPE: name = 'Software RAID Disk' elif mapper_type == MAPPER_ATARAID_TYPE:
luci/site/luci/Extensions/conga_storage_constants.py +130 -102
242 lines not on this page · raw message
luci/site/luci/Extensions/storage_adapters.py +6 -6
@@ -166,9 +166,7 @@ return None - buff = mapper_type - if mapper_type in PRETTY_MAPPER_NAMES: - buff = PRETTY_MAPPER_NAMES[mapper_type] + buff, dummy1, dummy2 = get_pretty_mapper_info(mapper_type) pretty_names = buff + 's' pretty_names_desc = 'Manage ' + buff + 's' pretty_name = buff
@@ -291,11 +289,13 @@ ### Hard Drives ### + hds_pretty_name, hd_pretty_name, dummy = get_pretty_mapper_info(MAPPER_SYS_TYPE) + hds_p = {} - hds_p['Title'] = 'Hard Drives' + hds_p['Title'] = hds_pretty_name hds_p['cfg_type'] = "nodes" hds_p['absolute_url'] = url + '?' + PAGETYPE + '=' + VIEW_BDS + '&' + STONAME + '=' + hostname + '&' + PT_MAPPER_TYPE + '=' + MAPPER_SYS_TYPE + '&' + PT_MAPPER_ID + '=' + SYSTEM_PREFIX - hds_p['Description'] = "Manage Hard Drives" + hds_p['Description'] = "Manage " + hds_pretty_name if (pagetype == VIEW_BDS or pagetype == VIEW_BD) and mapper_type == MAPPER_SYS_TYPE: hds_p['show_children'] = True else:
@@ -316,7 +316,7 @@ hd['Title'] = hd_path.replace('/dev/', '') hd['cfg_type'] = "nodes" hd['absolute_url'] = url + '?' + PAGETYPE + '=' + VIEW_BD + '&' + STONAME + '=' + hostname + '&' + PT_MAPPER_TYPE + '=' + MAPPER_SYS_TYPE + '&' + PT_MAPPER_ID + '=' + sys_id + '&' + PT_PATH + '=' + hd_path - hd['Description'] = 'Manage Hard Drive' + hd['Description'] = 'Manage ' + hd_pretty_name hd['show_children'] = False if pagetype == VIEW_BD and mapper_id == sys_id and path == hd_path: