def show_status(self, args):
        controller = control.VersaSDSSoftConsole()

        iter_service_status = controller.get_all_service_status()
        table_status = utils.Table()
        table_status.header = [
            'node', 'pacemaker', 'corosync', 'linstor-satellite', 'drbd',
            'linstor-controller'
        ]
        for i in iter_service_status:
            if args.node:
                if args.node == i[0]:
                    table_status.add_data(i)
                    break
            else:
                table_status.add_data(i)

        iter_version = controller.get_version('sysos', 'syskernel', 'drbd',
                                              'linstor', 'targetcli',
                                              'pacemaker')
        table_version = utils.Table()
        table_version.header = [
            'node', 'os_system', 'kernel', 'drbd_kernel_version', 'linstor',
            'targetcli', 'pacemaker'
        ]
        for i in iter_version:
            if args.node:
                if args.node == i[0]:
                    table_version.add_data(i)
                    break
            else:
                table_version.add_data(i)

        table_status.print_table()
        table_version.print_table()
 def install_linbit(self, args):
     sc = control.VersaSDSSoftConsole()
     print('添加linbit-drbd库,并更新')
     result = sc.install_spc()
     if not all(result):
         print("添加linbit-drbd库失败,退出")
         sys.exit(1)
     sc.apt_update()
     print('开始安装drbd相关软件')
     sc.install_drbd()
     print('开始linstor安装')
     sc.install_linstor()
Exemple #3
0
    def check_version(self, args):
        controller = control.VersaSDSSoftConsole()
        iter_version = controller.get_version('drbd', 'linstor', 'targetcli',
                                              'pacemaker', 'corosync')

        dict_all = {
            'node': [],
            'drbd': [],
            'linstor': [],
            'targetcli': [],
            'pacemaker': [],
            'corosync': []
        }
        for i in iter_version:
            dict_all['node'].append(i[0])
            dict_all['drbd'].append(i[1])
            dict_all['linstor'].append(i[2])
            dict_all['targetcli'].append(i[3])
            dict_all['pacemaker'].append(i[4])
            dict_all['corosync'].append(i[5])

        flag = []
        diff_version = []
        for k, v in dict_all.items():
            if len(set(v)) == 1 and v[0] is not None:
                flag.append([k, True])
            else:
                flag.append([k, False])
                diff_version.append([k, v])

        flag.pop(0)

        table_soft_check = utils.Table()
        table_soft_check.header = ['software', 'result']
        for i in flag:
            table_soft_check.add_data(i)

        table_soft_check.print_table()

        if len(diff_version) > 1:
            table_version = utils.Table()
            table_version.header = []
            for i in diff_version:
                table_version.header.append(i[0])
                table_version.add_column(i[0], i[1])
            table_version.print_table()
 def install_targetcli(self, args):
     sc = control.VersaSDSSoftConsole()
     print('开始targetcli安装')
     sc.install_targetcli()
 def install_pacemaker(self, args):
     sc = control.VersaSDSSoftConsole()
     print('开始pacemaker相关软件安装')
     sc.install_pacemaker()
 def install_lvm2(self, args):
     sc = control.VersaSDSSoftConsole()
     print('开始lvm安装')
     sc.install_lvm2()
 def uninstall_targetcli(self,args):
     sc = control.VersaSDSSoftConsole()
     print('卸载targetcli')
     sc.uninstall_targetcli()
 def uninstall_pacemaker(self,args):
     sc = control.VersaSDSSoftConsole()
     print('卸载pacemaker相关软件')
     sc.uninstall_pacemaker()
 def uninstall_lvm2(self,args):
     sc = control.VersaSDSSoftConsole()
     print('卸载lvm')
     sc.uninstall_lvm2()
 def uninstall_linbit(self,args):
     sc = control.VersaSDSSoftConsole()
     print('卸载drbd相关软件')
     sc.uninstall_drbd()
     print('卸载linstor')
     sc.uninstall_linstor()