Ejemplo n.º 1
0
    def restart_linstor(self):
        for ssh in self.conn.list_ssh:
            handler = action.Linstor(ssh)
            handler.restart_satellite()

        handler = action.Linstor()
        handler.restart_controller()
Ejemplo n.º 2
0
    def create_conf_file(self):
        ips = ",".join(
            [node['public_ip'] for node in self.conn.cluster['node']])
        for ssh in self.conn.list_ssh:
            linstor = action.Linstor(ssh)
            linstor.create_conf(ips)

        if self.conn.list_ssh:
            action.Linstor(self.conn.list_ssh[0]).restart_controller()
Ejemplo n.º 3
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]
Ejemplo n.º 4
0
 def create_pools(self, sp):
     # 待测试 以及确定thinlv创建时用到的lvm资源的格式。
     for ssh, node in zip(self.conn.list_ssh, self.conn.cluster['node']):
         linstor = action.Linstor(ssh)
         vol = node['lvm_device'].split("/")
         if len(vol) == 1:
             linstor.create_lvm_sp(node['hostname'], node['lvm_device'], sp)
         elif len(vol) == 2:
             linstor.create_lvmthin_sp(node['hostname'], node['lvm_device'],
                                       sp)
Ejemplo n.º 5
0
 def uninstall_linstor(self):
     for ssh in self.conn.list_ssh:
         handler = action.Linstor(ssh)
         handler.uninstall()
Ejemplo n.º 6
0
 def clear_linstor_conf(self):
     for ssh in self.conn.list_ssh:
         handler = action.Linstor(ssh)
         handler.clear()
Ejemplo n.º 7
0
 def create_nodes(self):
     for ssh, node in zip(self.conn.list_ssh, self.conn.cluster['node']):
         linstor = action.Linstor(ssh)
         linstor.create_node(node['hostname'], node['public_ip'])