コード例 #1
0
    def tearDown(self):
        """
        tearDown for every test
        Clean up and unmount the volume
        """
        # calling GlusterBaseClass tearDown
        self.get_super_method(self, 'tearDown')()

        # Delete the glusterfind sessions
        ret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
        if ret:
            raise ExecutionError("Failed to delete session %s" % self.session)
        g.log.info("Successfully deleted session %s", self.session)

        # Remove the outfile created during 'glusterfind pre and query'
        ret = remove_file(self.mnode, self.outfile, force=True)
        if not ret:
            raise ExecutionError("Failed to remove the outfile")
        g.log.info("Successfully removed the outfile")

        # Cleanup the volume
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to Cleanup Volume")
        g.log.info("Successful in Cleanup Volume")
コード例 #2
0
    def tearDown(self):
        """
        tearDown for every test
        Clean up and unmount the volume
        """
        # calling GlusterBaseClass tearDown
        self.get_super_method(self, 'tearDown')()

        # Delete the glusterfind sessions
        ret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
        if ret:
            raise ExecutionError("Failed to delete session %s" % self.session)
        g.log.info("Successfully deleted session %s", self.session)

        # Remove the outfiles created during 'glusterfind pre'
        for out in self.outfiles:
            ret = remove_file(self.mnode, out, force=True)
            if not ret:
                raise ExecutionError("Failed to remove the outfile %s" % out)
        g.log.info("Successfully removed the outfiles")

        # Wait for the peers to be connected.
        ret = wait_for_peers_to_connect(self.mnode, self.servers, 100)
        if not ret:
            raise ExecutionError("Peers are not in connected state.")

        # Cleanup the volume
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to Cleanup Volume")
        g.log.info("Successful in Cleanup Volume")
コード例 #3
0
    def tearDown(self):
        """
        tearDown for every test
        Clean up and unmount the volume
        """

        ret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
        if ret != 0:
            raise ExecutionError("Failed to delete session %s" % self.session)
        g.log.info("Successfully deleted session %s", self.session)

        g.log.info("Removing the outfiles created during 'glusterfind pre'")
        for out in self.outfiles:
            ret = remove_file(self.mnode, out, force=True)
            if not ret:
                raise ExecutionError("Failed to remove the outfile %s" % out)
        g.log.info("Successfully removed the outfiles")

        # Reset the volume
        g.log.info("Reset the volume")
        ret, _, _ = volume_reset(self.mnode, self.volname)
        if ret != 0:
            raise ExecutionError("Failed to reset the volume %s" %
                                 self.volname)
        g.log.info("Successfully reset the volume %s", self.volname)

        # Cleanup the volume
        g.log.info("Starting to Cleanup Volume")
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to Cleanup Volume")
        g.log.info("Successful in Cleanup Volume")

        # calling GlusterBaseClass tearDown
        self.get_super_method(self, 'tearDown')()
コード例 #4
0
    def tearDown(self):
        """
        Clean up the volume
        """

        # Check if glusterfind list contains any sessions
        # If session exists, then delete it
        g.log.info("Performing glusterfind list to check if the session "
                   "exists")
        ret, _, _ = gfind_list(self.mnode,
                               volname=self.volname,
                               sessname=self.session)
        if ret == 0:
            g.log.error("Unexpected: Glusterfind list shows existing session")
            delret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
            if delret != 0:
                raise ExecutionError("Failed to delete the session")
            g.log.info("Successfully deleted the session")
        g.log.info("Successful: No session is listed")

        # stopping the volume
        g.log.info("Starting to Cleanup Volume")
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to Cleanup Volume")
        g.log.info("Successful in Cleanup Volume")

        # calling GlusterBaseClass tearDown
        self.get_super_method(self, 'tearDown')()
コード例 #5
0
    def tearDown(self):

        # Cleanup glusterfind session and volume
        ret, _, _ = gfind_delete(self.mnode, self.volname, self.session)
        if ret:
            raise ExecutionError("Failed to delete session '%s'" %
                                 self.session)

        if not self.cleanup_volume():
            raise ExecutionError("Failed to Cleanup Volume")

        # Calling GlusterBaseClass tearDown
        self.get_super_method(self, 'tearDown')()
コード例 #6
0
    def tearDown(self):
        """
        tearDown for every test
        Clean up the volume
        """

        # Deleting the sessions created
        sessionlist = ['validsession', 'validoptsession']
        for sess in sessionlist:
            ret, _, _ = gfind_delete(self.mnode, self.volname, sess)
            if ret != 0:
                raise ExecutionError("Failed to delete session '%s'" % sess)
            g.log.info("Successfully deleted session '%s'", sess)

        # stopping the volume
        g.log.info("Starting to Cleanup Volume")
        ret = self.cleanup_volume()
        if not ret:
            raise ExecutionError("Failed to Cleanup Volume")
        g.log.info("Successful in Cleanup Volume")

        # Calling GlusterBaseClass tearDown
        self.get_super_method(self, 'tearDown')()
コード例 #7
0
    def test_gfind_delete_cli(self):
        """
        Verifying the glusterfind delete command functionality with valid
        and invalid values for the required and optional parameters.

        * Create a volume
        * Create a session on the volume
        * Perform glusterfind list to check if session is created
        * Delete the glusterfind session with the following combinations:
            - Valid values for required parameters
            - Invalid values for required parameters
            - Valid values for optional parameters
            - Invalid values for optional parameters
        * Perform glusterfind list to check if session is deleted

            Required parameters: volname and sessname
            Optional parameters: debug
        """

        # pylint: disable=too-many-statements
        # Creating a session for the volume
        g.log.info("Creating a session for the volume %s", self.volname)
        ret, _, _ = gfind_create(self.mnode, self.volname, self.session)
        self.assertEqual(ret, 0, ("Unexpected: Creation of a session for the "
                                  "volume %s failed" % self.volname))
        g.log.info("Successfully created a session for the volume %s",
                   self.volname)

        # Perform glusterfind list to check if session exists
        g.log.info("Performing glusterfind list to check if the session is "
                   "created")
        ret, _, _ = gfind_list(self.mnode,
                               volname=self.volname,
                               sessname=self.session)
        self.assertEqual(ret, 0, "Failed to list the glusterfind session")
        g.log.info("Successfully listed the glusterfind session")

        # Delete the glusterfind session using the invalid values for optional
        # parameters
        g.log.info("Deleting the session with invalid values for the optional "
                   "parameters")
        ret, _, _ = g.run(self.mnode, ("glusterfind delete %s %s --dbug" %
                                       (self.volname, self.session)))
        self.assertNotEqual(
            ret, 0, "Unexpected: glusterfind session deleted "
            "even with invalid value for optional parameters")
        g.log.info("Successful: glusterfind delete failed with invalid value "
                   "for optional parameters")

        # Delete the glusterfind session using the valid values for required
        # and optional parameters
        g.log.info("Deleting the session with valid values for the required "
                   "and optional parameters")
        ret, _, _ = gfind_delete(self.mnode,
                                 self.volname,
                                 self.session,
                                 debug=True)
        self.assertEqual(
            ret, 0, "Unexpected: Failed to delete the session "
            "using the valid values for the required and "
            "optional parameters")
        g.log.info("Successfully deleted the session using valid values for "
                   "required and optional parameters")

        # Perform glusterfind list to check if the session exists
        g.log.info("Performing glusterfind list to validate that the session "
                   "is deleted")
        ret, _, _ = gfind_list(self.mnode,
                               volname=self.volname,
                               sessname=self.session)
        self.assertNotEqual(
            ret, 0, "Unexpected: glusterfind sessions is being"
            " listed even after being deleted")
        g.log.info("Successful: No glusterfind session is listed")