def check_ha_controller(self, timeout=30): ha = action.HALinstorController() node_list = [node['hostname'] for node in self.conn.cluster['node']] t_beginning = time.time() while True: if ha.check_linstor_controller(node_list): break seconds_passed = time.time() - t_beginning if timeout and seconds_passed > timeout: print("Linstor controller status error") return False time.sleep(1) for ssh in self.conn.list_ssh: ha = action.HALinstorController(ssh) service = action.ServiceSet(ssh) if service.check_linstor_satellite() != 'enable': print('LINSTOR Satellite Service is not "enable".') return False if not ha.check_satellite_settings(): print("File linstor-satellite.service modification failed") return False return True
def service_set(self): for ssh in self.conn.list_ssh: executor = action.ServiceSet(ssh) executor.set_disable_drbd() executor.set_disable_linstor_controller() executor.set_disable_targetctl() executor.set_enable_linstor_satellite() executor.set_enable_pacemaker() executor.set_enable_corosync()
def service_set(self): lst = [] for ssh in self.list_ssh: executor = action.ServiceSet(ssh) lst.append(gevent.spawn(executor.set_disable_drbd)) lst.append(gevent.spawn(executor.set_disable_linstor_controller)) lst.append(gevent.spawn(executor.set_disable_targetctl)) lst.append(gevent.spawn(executor.set_enable_linstor_satellite)) lst.append(gevent.spawn(executor.set_enable_pacemaker)) lst.append(gevent.spawn(executor.set_enable_corosync)) gevent.joinall(lst)
def get_all_service_status(self): result = [] for ssh in self.conn.list_ssh: service = action.ServiceSet(ssh) host = action.Host(ssh) result.append(host.get_hostname()) result.append(service.check_pacemaker()) result.append(service.check_corosync()) result.append(service.check_linstor_satellite()) result.append(service.check_drbd()) result.append(service.check_linstor_controller()) for i in range(0, len(result), 6): yield result[i:i + 6]
def check_service(self): lst = [] for ssh in self.conn.list_ssh: check_result = [] executor = action.ServiceSet(ssh) check_result.append(executor.check_drbd()) check_result.append(executor.check_linstor_controller()) check_result.append(executor.check_linstor_satellite()) check_result.append(executor.check_pacemaker()) check_result.append(executor.check_corosync()) if check_result == [ 'disable', 'disable', 'enable', 'enable', 'enable' ]: lst.append(True) else: lst.append(False) return lst
def check_service(self): lst = [] for ssh in self.list_ssh: check_result = [] executor = action.ServiceSet(ssh) check_result.append(gevent.spawn(executor.check_drbd)) check_result.append(gevent.spawn( executor.check_linstor_controller)) check_result.append(gevent.spawn(executor.check_linstor_satellite)) check_result.append(gevent.spawn(executor.check_linstor_pacemaker)) check_result.append(gevent.spawn(executor.check_corosync)) gevent.joinall(check_result) check_result = [job.value for job in check_result] if all(check_result): lst.append(True) else: lst.append(False) return lst