def test(self): """ Tests Multipath. """ msg = "" multipath.form_conf_mpath_file() plcy = "path_selector \"%s 0\"" % self.policy multipath.form_conf_mpath_file(defaults_extra=plcy) for path_dic in self.mpath_list: self.log.debug("operating on paths: %s", path_dic["paths"]) # Path Selector policy self.log.info("changing Selector policy") for policy in self.policies: cmd = "path_selector \"%s 0\"" % policy multipath.form_conf_mpath_file(defaults_extra=cmd) if multipath.get_policy(path_dic["wwid"]) != policy: msg += "%s for %s fails\n" % (policy, path_dic["wwid"]) # mutipath -f mpathX if not multipath.flush_path(path_dic["name"]): msg += "Flush of %s fails\n" % path_dic["name"] self.mpath_svc.restart() wait.wait_for(self.mpath_svc.status, timeout=10) # Blacklisting wwid self.log.info("Black listing WWIDs") cmd = "wwid %s" % path_dic["wwid"] multipath.form_conf_mpath_file(blacklist=cmd, defaults_extra=plcy) if multipath.device_exists(path_dic["wwid"]): msg += "Blacklist of %s fails\n" % path_dic["wwid"] else: multipath.form_conf_mpath_file(defaults_extra=plcy) if not multipath.device_exists(path_dic["wwid"]): msg += "Recovery of %s fails\n" % path_dic["wwid"] # Blacklisting sdX self.log.info("Black listing individual paths") for disk in path_dic["paths"]: cmd = "devnode %s" % disk multipath.form_conf_mpath_file(blacklist=cmd, defaults_extra=plcy) if disk in multipath.get_paths(path_dic["wwid"]): msg += "Blacklist of %s fails\n" % disk multipath.form_conf_mpath_file(defaults_extra=plcy) if msg: self.fail("Some tests failed. Find details below:\n%s" % msg)
def test(self): """ Tests Multipath. """ msg = "" multipath.form_conf_mpath_file() for path_dic in self.mpath_list: # mutipath -f mpathX if not multipath.flush_path(path_dic["name"]): msg += "Flush of %s fails\n" % path_dic["name"] self.mpath_svc.restart() # Path Selector policy for policy in ["service-time", "round-robin", "queue-length"]: cmd = "path_selector \"%s 0\"" % policy multipath.form_conf_mpath_file(defaults_extra=cmd) if multipath.get_policy(path_dic["wwid"]) != policy: msg += "%s for %s fails\n" % (policy, path_dic["wwid"]) # Blacklist wwid cmd = "wwid %s" % path_dic["wwid"] multipath.form_conf_mpath_file(blacklist=cmd) if multipath.device_exists(path_dic["wwid"]): msg += "Blacklist of %s fails\n" % path_dic["wwid"] else: multipath.form_conf_mpath_file() if not multipath.device_exists(path_dic["wwid"]): msg += "Recovery of %s fails\n" % path_dic["wwid"] # Blacklist sdX for disk in path_dic["paths"]: cmd = "devnode %s" % disk multipath.form_conf_mpath_file(blacklist=cmd) if disk in multipath.get_paths(path_dic["wwid"]): msg += "Blacklist of %s fails\n" % disk # Print errors if msg: msg = "Following Tests Failed\n" + msg self.log.debug(msg) self.fail("Some tests failed")
def test(self): """ Tests Multipath. """ msg = "" multipath.form_conf_mpath_file() plcy = "path_selector \"%s 0\"" % self.policy multipath.form_conf_mpath_file(defaults_extra=plcy) for path_dic in self.mpath_list: self.log.debug("operating on paths", path_dic["paths"]) # Path Selector policy self.log.info("changing Selector policy") for policy in self.policies: cmd = "path_selector \"%s 0\"" % policy multipath.form_conf_mpath_file(defaults_extra=cmd) if multipath.get_policy(path_dic["wwid"]) != policy: msg += "%s for %s fails\n" % (policy, path_dic["wwid"]) # mutipath -f mpathX if not multipath.flush_path(path_dic["name"]): msg += "Flush of %s fails\n" % path_dic["name"] self.mpath_svc.restart() wait.wait_for(self.mpath_svc.status, timeout=10) # Blacklisting wwid self.log.info("Black listing WWIDs") cmd = "wwid %s" % path_dic["wwid"] multipath.form_conf_mpath_file(blacklist=cmd, defaults_extra=plcy) if multipath.device_exists(path_dic["wwid"]): msg += "Blacklist of %s fails\n" % path_dic["wwid"] else: multipath.form_conf_mpath_file(defaults_extra=plcy) if not multipath.device_exists(path_dic["wwid"]): msg += "Recovery of %s fails\n" % path_dic["wwid"] # Blacklisting sdX self.log.info("Black listing individual paths") for disk in path_dic["paths"]: cmd = "devnode %s" % disk multipath.form_conf_mpath_file(blacklist=cmd, defaults_extra=plcy) if disk in multipath.get_paths(path_dic["wwid"]): msg += "Blacklist of %s fails\n" % disk multipath.form_conf_mpath_file(defaults_extra=plcy) # Failing and reinstating individual paths eg: sdX self.log.info(" Failing and reinstating the individual paths") for path in path_dic["paths"]: if multipath.fail_path(path) is False: msg += "test failed while failing %s\n" % path elif multipath.reinstate_path(path) is False: msg += "test failed while reinstating %s\n" % path self.mpath_svc.restart() wait.wait_for(self.mpath_svc.status, timeout=10) # Failing n-1 paths for short time and reinstating back self.log.info("Failing and reinstating the n-1 paths") for path in path_dic['paths'][:-1]: if multipath.fail_path(path) is False: msg += "%s did not failed in n-1 path fail\n" % path time.sleep(180) for path in path_dic['paths'][:-1]: if multipath.reinstate_path(path) is False: msg += "%s failed to recover in n-1 paths fails\n" % path self.mpath_svc.restart() wait.wait_for(self.mpath_svc.status, timeout=10) # Failing all paths for short time and reinstating back self.log.info("Failing and reinstating the All paths") for path in path_dic['paths']: if multipath.fail_path(path) is False: msg += "%s did not failed in all paths fail\n" % path time.sleep(180) for path in path_dic['paths']: if multipath.reinstate_path(path) is False: msg += "%s did not recovered in all path fail\n" % path self.mpath_svc.restart() wait.wait_for(self.mpath_svc.status, timeout=10) # Print errors if msg: self.fail("Some tests failed. Find details below:\n%s" % msg)
def test(self): """ Tests Multipath. """ msg = "" multipath.form_conf_mpath_file() plcy = "path_selector \"%s 0\"" % self.policy multipath.form_conf_mpath_file(defaults_extra=plcy) for path_dic in self.mpath_list: operation = '' self.log.debug("operating on paths: %s", path_dic["paths"]) # Path Selector policy self.log.info("changing Selector policy") for policy in self.policies: cmd = "path_selector \"%s 0\"" % policy multipath.form_conf_mpath_file(defaults_extra=cmd) time.sleep(5) if multipath.get_policy(path_dic["wwid"]) != policy: msg += "%s for %s fails\n" % (policy, path_dic["wwid"]) def is_mpath_available(): if operation == 'block': if multipath.device_exists(path_dic["wwid"]) is True: self.log.info("%s=False, not blocked" % test_mpath) return False return True elif operation == 'recover': if multipath.device_exists(path_dic["wwid"]) is False: self.log.info("%s=False, not recovered" % test_mpath) return False return True # mutipath -f mpathX test_mpath = path_dic["name"] self.log.info("flushing %s" % path_dic["name"]) operation = 'block' multipath.flush_path(path_dic["name"]) if wait.wait_for(is_mpath_available, timeout=10): self.log.info("flush of %s success" % path_dic["name"]) else: msg += "Flush of %s fails\n" % path_dic["name"] self.log.info("Recovering %s after flush.." % path_dic["name"]) operation = 'recover' self.mpath_svc.restart() wait.wait_for(self.mpath_svc.status, timeout=10) if wait.wait_for(is_mpath_available, timeout=10): self.log.info("recovery of %s success after \ flush" % path_dic["name"]) else: msg += "Recovery of %s fails after flush\n" % path_dic["name"] # Blacklisting wwid test_mpath = path_dic["wwid"] self.log.info("Black listing WWIDs") cmd = "wwid %s" % path_dic["wwid"] multipath.form_conf_mpath_file(blacklist=cmd, defaults_extra=plcy) operation = 'block' if wait.wait_for(is_mpath_available, timeout=10): self.log.info("Blocklist of %s success" % path_dic["wwid"]) else: msg += "Blacklist of %s fails\n" % path_dic["wwid"] operation = 'recover' self.log.info("Recovering WWID after Black list.....") multipath.form_conf_mpath_file(defaults_extra=plcy) if wait.wait_for(is_mpath_available, timeout=10): self.log.info("recovery of %s success" % path_dic["wwid"]) else: msg += "Recovery of %s fails after blocklist\n" \ % path_dic["wwid"] def is_path_available(): if operation == 'block': if multipath.device_exists(test_path) is True: return False return True elif operation == 'recover': if multipath.device_exists(test_path) is False: self.log.info("%s=False still not recover" % test_path) return False return True # Blacklisting sdX self.log.info("Black listing individual paths") test_path = '' for disk in path_dic["paths"]: test_path = disk self.log.info("Black_listing %s" % disk) operation = 'block' cmd = "devnode %s" % disk multipath.form_conf_mpath_file(blacklist=cmd, defaults_extra=plcy) if wait.wait_for(is_path_available, timeout=10): self.log.info("block list of %s success" % disk) else: msg += "block list of %s fails\n" % disk operation = 'recover' multipath.form_conf_mpath_file(defaults_extra=plcy) if wait.wait_for(is_path_available, timeout=10): self.log.info("recovery of %s success" % disk) else: msg += "Recovery of %s fails after blacklist %s\n" \ % (disk, path_dic["wwid"]) multipath.form_conf_mpath_file(defaults_extra=plcy) if msg: self.fail("Some tests failed. Find details below:\n%s" % msg)
def test(self): """ Tests Multipath. """ msg = "" multipath.form_conf_mpath_file() plcy = "path_selector \"%s 0\"" % self.policy multipath.form_conf_mpath_file(defaults_extra=plcy) for path_dic in self.mpath_list: self.log.debug("operating on paths", path_dic["paths"]) # Path Selector policy self.log.info("changing Selector policy") for policy in self.policies: cmd = "path_selector \"%s 0\"" % policy multipath.form_conf_mpath_file(defaults_extra=cmd) if multipath.get_policy(path_dic["wwid"]) != policy: msg += "%s for %s fails\n" % (policy, path_dic["wwid"]) # mutipath -f mpathX if not multipath.flush_path(path_dic["name"]): msg += "Flush of %s fails\n" % path_dic["name"] self.mpath_svc.restart() wait.wait_for(self.mpath_svc.status, timeout=10) # Blacklisting wwid self.log.info("Black listing WWIDs") cmd = "wwid %s" % path_dic["wwid"] multipath.form_conf_mpath_file(blacklist=cmd, defaults_extra=plcy) if multipath.device_exists(path_dic["wwid"]): msg += "Blacklist of %s fails\n" % path_dic["wwid"] else: multipath.form_conf_mpath_file(defaults_extra=plcy) if not multipath.device_exists(path_dic["wwid"]): msg += "Recovery of %s fails\n" % path_dic["wwid"] # Blacklisting sdX self.log.info("Black listing individual paths") for disk in path_dic["paths"]: cmd = "devnode %s" % disk multipath.form_conf_mpath_file(blacklist=cmd, defaults_extra=plcy) if disk in multipath.get_paths(path_dic["wwid"]): msg += "Blacklist of %s fails\n" % disk multipath.form_conf_mpath_file(defaults_extra=plcy) # Failing and reinstating individual paths eg: sdX self.log.info(" Failing and reinstating the individual paths") for path in path_dic["paths"]: if multipath.fail_path(path) is False: msg += "test failed while failing %s\n" % path elif multipath.reinstate_path(path) is False: msg += "test failed while reinstating %s\n" % path self.mpath_svc.restart() wait.wait_for(self.mpath_svc.status, timeout=10) # Failing n-1 paths for short time and reinstating back self.log.info("Failing and reinstating the n-1 paths") for path in path_dic['paths'][:-1]: if multipath.fail_path(path) is False: msg += "%s did not failed in n-1 path fail\n" % path time.sleep(180) for path in path_dic['paths'][:-1]: if multipath.reinstate_path(path) is False: msg += "%s failed to recover in n-1 paths fails\n" % path self.mpath_svc.restart() wait.wait_for(self.mpath_svc.status, timeout=10) # Failing all paths for short time and reinstating back self.log.info("Failing and reinstating the All paths") for path in path_dic['paths']: if multipath.fail_path(path) is False: msg += "%s did not failed in all paths fail\n" % path time.sleep(180) for path in path_dic['paths']: if multipath.reinstate_path(path) is False: msg += "%s did not recovered in all path fail\n" % path self.mpath_svc.restart() wait.wait_for(self.mpath_svc.status, timeout=10) # Print errors if msg: self.fail("Some tests failed. Find details below:\n%s" % msg)