예제 #1
0
 def test_fail_reinstate_individual_paths(self):
     '''
     Failing and reinstating individual paths eg: sdX
     '''
     err_paths = []
     self.log.info(" Failing and reinstating the individual paths")
     for dic_path in self.mpath_list:
         for path in dic_path['paths']:
             if multipath.fail_path(path) is False:
                 self.log.info("could not fail %s in indvdl path:", path)
                 err_paths.append(path)
             elif multipath.reinstate_path(path) is False:
                 self.log.info("couldn't reinstat %s in indvdl path", path)
                 err_paths.append(path)
     self.mpath_svc.restart()
     wait.wait_for(self.mpath_svc.status, timeout=10)
     if err_paths:
         self.fail("failing for following paths : %s" % err_paths)
예제 #2
0
    def test_failing_reinstate_all_paths(self):
        '''
        Failing all paths for short time and reinstating back
        '''
        err_paths = []
        self.log.info("Failing and reinstating the n-1 paths")
        for dic_path in self.mpath_list:
            for path in dic_path["paths"]:
                if multipath.fail_path(path) is False:
                    self.log.info("could not fail under all path %s", path)
                    err_paths.append(path)

            time.sleep(self.op_long_sleep_time)
            for path in dic_path["paths"]:
                if multipath.reinstate_path(path) is False:
                    self.log.info("couldn't reinstate in all path %s", path)
                    err_paths.append(path)
        self.mpath_svc.restart()
        wait.wait_for(self.mpath_svc.status, timeout=10)
        if err_paths:
            self.fail("following paths fails in all paths : %s" % err_paths)
예제 #3
0
    def test_io_run_on_single_path(self):
        '''
        check IO run on single path under each mpath by failing n-1 paths
        of it for short time and reinstating back
        '''
        err_paths = []
        self.log.info("Failing and reinstating the n-1 paths")
        for dic_path in self.mpath_list:
            for path in dic_path['paths'][:-1]:
                if multipath.fail_path(path) is False:
                    self.log.info("could not fail %s under n-1 path", path)
                    err_paths.append(path)

            time.sleep(self.op_long_sleep_time)
            for path in dic_path['paths'][:-1]:
                if multipath.reinstate_path(path) is False:
                    self.log.info("couldn't reinstate in n-1 path: %s", path)
                    err_paths.append(path)
        self.mpath_svc.restart()
        wait.wait_for(self.mpath_svc.status, timeout=10)
        if err_paths:
            self.fail("following paths fails in n-1 paths : %s" % err_paths)
    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:
            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)