def is_path_online(): path_stat = [] process.system("multipathd -k'show paths'", ignore_status=True) path_stat = multipath.get_path_status(self.path) self.log.info("operation:%s path=%s path_stat=%s \ " % (operation, self.path, path_stat)) if operation in ('map', 'add'): if path_stat[0] != "active" or path_stat[2] != "ready": self.log.info("operation:%s path=%s stat=%s return=False \ " % (operation, self.path, path_stat)) return False else: self.log.info("operation:%s path=%s stat=%s return=True \ " % (operation, self.path, path_stat)) return True elif operation in ('unmap', 'remove'): if path_stat[0] != "failed" or path_stat[2] != "faulty": self.log.info("operation:%s path=%s stat=%s return=False \ " % (operation, self.path, path_stat)) return False else: self.log.info("operation:%s path=%s stat=%s return=True \ " % (operation, self.path, path_stat)) return True else: self.log.info("Operation unknown, provide correct opertion")
def is_path_online(): path_stat = multipath.get_path_status(self.path) if operation == "map": if path_stat[0] != "active" or path_stat[2] != "ready": return False return True elif operation == "unmap": if path_stat[0] != "failed" or path_stat[2] != "faulty": return False return True
def mpath_verification(self, operation, paths, drc): ''' verify the paths status on add or remove operations of vfc ''' err_paths = [] curr_paths = self.get_paths(drc) if operation == "add": for path in paths: path_stat = multipath.get_path_status(path) if path_stat[0] != "active" or path_stat[2] != "ready": err_paths.append(path) elif curr_paths: for path in paths: path_stat = multipath.get_path_status(path) if path_stat[0] != "failed" or path_stat[2] != "faulty": err_paths.append(path) if err_paths: self.fail("path verfction failed for drc %s:%s" % (drc, err_paths)) else: self.log.info("path verfction success for drc :%s" % drc)
def mpath_state_check(self, ports, state1, state2): ''' checking mpath disk status after disabling the switch port ''' for port in ports: pci_id = self.dic[port] paths = pci.get_disks_in_pci_address(pci_id) err_paths = [] self.log.info("verify %s path status for port %s in %s", state1, port, ports) for path in paths: path_stat = multipath.get_path_status(path.split("/")[-1]) if path_stat[0] != state1 or path_stat[2] != state2: err_paths.append(path) if err_paths: self.error("following paths not %s: %s" % (state1, err_paths)) else: self.log.info("%s of path verification is success", state1)
def is_path_online(): path_stat = list(multipath.get_path_status(curr_path)) if path_stat[0] != 'active' or path_stat[2] != 'ready': return False return True
def is_path_online(): path_stat = multipath.get_path_status(curr_path) if path_stat[0] != state1 or path_stat[2] != state2: return False return True