Example #1
0
    def get_version(self, *args):
        """
        参数输入要获取版本信息的软件,支持sysos,syskernel,drbd,linstor,targetcli,pacemaker,corosync
        返回数据的顺序与参数顺序一致
        :param args:
        :return:
        """
        result = []
        for ssh in self.conn.list_ssh:
            host = action.Host(ssh)
            result.append(host.get_hostname())
            for soft in args:
                if soft == 'sysos':
                    result.append(host.get_sys_version())
                elif soft == 'syskernel':
                    result.append(host.get_kernel_version())
                elif soft == 'drbd':
                    drbd = action.DRBD(ssh)
                    result.append(drbd.get_version())
                elif soft == 'linstor':
                    linstor = action.Linstor(ssh)
                    result.append(linstor.get_version())
                elif soft == 'targetcli':
                    targetcli = action.TargetCLI(ssh)
                    result.append(targetcli.get_version())
                elif soft == 'pacemaker':
                    pacemaker = action.Pacemaker(ssh)
                    result.append(pacemaker.get_version())
                elif soft == 'corosync':
                    corosync = action.Corosync(ssh)
                    result.append(corosync.get_version())

        for i in range(0, len(result), len(args) + 1):
            yield result[i:i + len(args) + 1]
Example #2
0
    def check_targetcli(self):
        lst = []
        for ssh in self.list_ssh:
            targetcli = action.TargetCLI(ssh)
            lst.append(gevent.spawn(targetcli.check_targetcli_conf))

        gevent.joinall(lst)
        result = [job.value for job in lst]
        return result
Example #3
0
    def targetcli_conf_change(self):
        lst = []
        for ssh in self.list_ssh:
            targetcli = action.TargetCLI(ssh)
            lst.append(gevent.spawn(targetcli.set_auto_add_default_portal))
            lst.append(gevent.spawn(targetcli.set_auto_add_mapped_luns))
            lst.append(gevent.spawn(targetcli.set_auto_enable_tpgt))

        gevent.joinall(lst)
Example #4
0
 def uninstall_targetcli(self):
     for ssh in self.conn.list_ssh:
         handler = action.TargetCLI(ssh)
         handler.uninstall()
Example #5
0
 def check_targetcli(self):
     result_lst = []
     for ssh in self.conn.list_ssh:
         targetcli = action.TargetCLI(ssh)
         result_lst.append(targetcli.check_targetcli_conf())
     return result_lst
Example #6
0
 def targetcli_conf_change(self):
     for ssh in self.conn.list_ssh:
         targetcli = action.TargetCLI(ssh)
         targetcli.set_auto_add_default_portal()
         targetcli.set_auto_add_mapped_luns()
         targetcli.set_auto_enable_tpgt()