def show_all_res(self,no_color='no'): collecter = linstordb.CollectData() if no_color == 'no': data = s.deco_color(collecter.get_all_res)() else: data = collecter.get_all_res() header = ["resource", "mirror_way", "size", "device_name", "used"] table = s.make_table(header,data) s.prt_log(table,0)
def show_all_sp(self,no_color='no'): collector = linstordb.CollectData() if no_color == 'no': data = s.deco_color(collector.get_all_sp)() else: data = collector.get_all_sp() header = ['stp_name','node_name','res_num','driver','pool_name','free_size','total_size','snapshots','status'] table = s.make_table(header, data) s.prt_log(table,0)
def show_all_node(self, no_color='no'): collecter = linstordb.CollectData() if no_color == 'no': data = s.deco_color(collecter.get_all_node)() else: data = collecter.get_all_node() header = ["node", "node type", "res num", "stp num", "addr", "status"] table = s.make_table(header, data) s.prt_log(table,0)
def show_one_node(self, node, no_color='no'): collecter = linstordb.CollectData() node_data = collecter.get_node_info(node) if not node_data: s.prt_log('The node does not exist',1) else: info = "node:%s\nnodetype:%s\nresource num:%s\nstoragepool num:%s\naddr:%s\nstatus:%s" % node_data if no_color == 'no': data_node = s.deco_color(collecter.get_one_node)(node) data_stp = s.deco_color(collecter.get_sp_in_node)(node) else: data_node = collecter.get_one_node(node) data_stp = collecter.get_sp_in_node(node) header_node = ['res_name', 'stp_name', 'size', 'device_name', 'used', 'status'] header_stp = ['stp_name', 'node_name', 'res_num', 'driver', 'pool_name', 'free_size', 'total_size', 'snapshots', 'status'] table_node = s.make_table(header_node, data_node) table_stp = s.make_table(header_stp, data_stp) result = '\n'.join([info, str(table_node), str(table_stp)]) s.prt_log(result,0)
def show_one_res(self,res,no_color='no'): collecter = linstordb.CollectData() res_data = collecter.get_res_info(res) if not res_data: s.prt_log('The resource does not exist',1) else: info = ("resource:%s\nmirror_way:%s\nsize:%s\ndevice_name:%s\nused:%s" %res_data) if no_color == 'no': data = s.deco_color(collecter.get_one_res)(res) else: data = collecter.get_one_res(res) header = ['node_name', 'stp_name', 'drbd_role', 'status'] table = s.make_table(header,data) result = '\n'.join([info, str(table)]) s.prt_log(result,0)
def show_one_sp(self,sp,no_color='no'): collector = linstordb.CollectData() info_data = collector.get_sp_info(sp) if info_data[0] == 0: s.prt_log('The storagepool does not exist',1) else: info = 'The storagepool name for %s nodes is %s,they are %s.'%(info_data) if no_color == 'no': data = s.deco_color(collector.get_one_sp)(sp) else: data = collector.get_one_sp(sp) header = ['res_name', 'size', 'device_name', 'used', 'status'] table = s.make_table(header, data) result = '\n'.join([info, str(table)]) s.prt_log(result,0)