def tearDown(self):
        """
        Cleanup and umount volume
        """
        # Calling GlusterBaseClass teardown
        self.get_super_method(self, 'tearDown')()

        for node in self.nodes:
            del_user(node, self.user)

        # Cleanup and umount volume
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to umount the vol & cleanup Volume")
        g.log.info("Successful in umounting the volume and Cleanup")
コード例 #2
0
    def _dac_helper(self, host, option):
        '''Helper for creating, deleting users and groups'''

        # Permission/Ownership changes required only for `test_metadata..`
        # tests, using random group and usernames
        if 'metadata' not in self.test_dir:
            return

        if option == 'create':
            # Groups
            for group in ('qa_func', 'qa_system'):
                if not group_add(host, group):
                    raise ExecutionError('Unable to {} group {} on '
                                         '{}'.format(option, group, host))

            # User
            if not add_user(host, 'qa_all', group='qa_func'):
                raise ExecutionError('Unable to {} user {} under {} on '
                                     '{}'.format(option, 'qa_all', 'qa_func',
                                                 host))
        elif option == 'delete':
            # Groups
            for group in ('qa_func', 'qa_system'):
                if not group_del(host, group):
                    raise ExecutionError('Unable to {} group {} on '
                                         '{}'.format(option, group, host))

            # User
            if not del_user(host, 'qa_all'):
                raise ExecutionError('Unable to {} user on {}'.format(
                    option, host))
コード例 #3
0
    def tearDown(self):
        """
        If test method failed before validating IO, tearDown waits for the
        IO's to complete and checks for the IO exit status.
        Cleanup and umount volume
        """
        if not self.io_validation_complete:
            ret = wait_for_io_to_complete(self.all_mounts_procs, self.mounts)
            if not ret:
                raise ExecutionError("IO failed on some of the clients")
            g.log.info("IO is successful on all mounts")

            # List all files and dirs created
            if not list_all_files_and_dirs_mounts(self.mounts):
                raise ExecutionError("Failed to list all files and dirs")
            g.log.info("Listing all files and directories is successful")

        # Delete user
        for mount_object in self.mounts:
            for user in self.users:
                if not del_user(mount_object.client_system, user):
                    raise ExecutionError("Failed to delete user: {}"
                                         .format(user))
        g.log.info("Successfully deleted all users")

        # Cleanup and umount volume
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to umount the vol & cleanup Volume")
        g.log.info("Successful in umounting the volume and Cleanup")

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

        # Delete non-root users
        for user in self.users:
            del_user(self.first_client, user)
            ret, _, _ = g.run(self.first_client,
                              "rm -rf /home/{}".format(user))
            if ret:
                raise ExecutionError("Failed to remove home dir of "
                                     "non-root user")
        g.log.info("Successfully deleted all users")

        if not self.unmount_volume_and_cleanup_volume([self.mounts[0]]):
            raise ExecutionError("Failed to cleanup Volume")

        # Calling GlusterBaseClass tearDown
        self.get_super_method(self, 'tearDown')()
    def tearDown(self):

        # Delete non-root users and group if created
        if self.user_group_created:

            # Delete non-root users
            for user in self.users:
                del_user(self.first_client, user)
            g.log.info("Successfully deleted all users")

            # Delete non-root group
            group_del(self.first_client, 'qa_all')

        if not self.unmount_volume_and_cleanup_volume([self.mounts[0]]):
            raise ExecutionError("Failed to cleanup Volume")

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

        # Remove non-root user created for test
        if not del_user(self.first_client, 'joker'):
            raise ExecutionError("Failed to remove user joker")

        if not self.unmount_volume_and_cleanup_volume([self.mounts[0]]):
            raise ExecutionError("Failed to Cleanup Volume")

        # Calling GlusterBaseClass tearDown
        self.get_super_method(self, 'tearDown')()
コード例 #7
0
    def tearDown(self):
        ret = del_user(self.client, self.user)
        if not ret:
            raise ExecutionError("Failed to delete user")
        # Unmount Volume and cleanup.
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to Unmount Volume and "
                                 "Cleanup Volume")
        g.log.info("Successful in Unmount Volume and cleanup.")

        self.get_super_method(self, 'tearDown')()
コード例 #8
0
    def tearDown(self):
        brick_list = get_all_bricks(self.mnode, self.volname)
        for brick in brick_list:
            brick_node, _ = brick.split(":")
            del_user(brick_node, "test_user1")
            del_user(brick_node, "test_user2")

        for mount_obj in self.mounts:
            del_user(mount_obj.client_system, "test_user1")
            del_user(mount_obj.client_system, "test_user2")

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

        # Calling GlusterBaseClass tearDown
        self.get_super_method(self, 'tearDown')()
コード例 #9
0
    def tearDown(self):
        # Delete the added user
        ret = del_user(self.clients[0], "test_user1")
        if ret is not True:
            raise ExecutionError("Failed to delete user")

        # Reset the volume options set inside the test
        for opt in ('performance.parallel-readdir',
                    'performance.readdir-ahead'):
            ret, _, _ = reset_volume_option(self.mnode, self.volname, opt)
            if ret:
                raise ExecutionError("Failed to reset the volume option %s" %
                                     opt)
            g.log.info("Successfully reset the volume options")

        # Unmount and cleanup original volume
        ret = self.unmount_volume_and_cleanup_volume(mounts=[self.mounts[0]])
        if not ret:
            raise ExecutionError("Failed to umount the vol & cleanup Volume")
        g.log.info("Successful in umounting the volume and Cleanup")

        # Calling GlusterBaseClass tearDown
        self.get_super_method(self, 'tearDown')()