def tearDown(self):
        """
        Disbale ACL if enabled
        Unexport volume
        Unmount and cleanup volume
        """
        if self.acl_check_flag:
            ret = set_acl(self.mnode, self.volname, False)
            if not ret:
                raise ExecutionError("Failed to disable acl on %s" %
                                     self.volname)
            self.acl_check_flag = False

        # Unexport volume
        unexport_nfs_ganesha_volume(self.mnode, self.volname)
        ret = wait_for_nfs_ganesha_volume_to_get_unexported(
            self.mnode, self.volname)
        if not ret:
            raise ExecutionError("Volume %s is not unexported." % self.volname)

        # Unmount volume
        ret = self.unmount_volume(self.mounts)
        if ret:
            g.log.info("Successfully unmounted the volume")
        else:
            g.log.error("Failed to unmount volume")

        # Cleanup volume
        ret = self.cleanup_volume()
        if not ret:
            raise ExecutionError("Failed to cleanup volume")
        g.log.info("Cleanup volume %s completed successfully", self.volname)
    def tearDown(self):

        # Disable root-squash
        ret = set_root_squash(self.mnode,
                              self.volname,
                              squash=False,
                              do_refresh_config=True)
        if not ret:
            raise ExecutionError("Failed to disable root-squash on nfs "
                                 "ganesha cluster")
        g.log.info("root-squash is disabled on volume")

        # Unexport volume
        unexport_nfs_ganesha_volume(self.mnode, self.volname)
        ret = wait_for_nfs_ganesha_volume_to_get_unexported(
            self.mnode, self.volname)
        if not ret:
            raise ExecutionError("Volume %s is not unexported." % self.volname)
        g.log.info("Unexporting of volume is successful")

        # Unmount and cleanup Volume
        ret = self.unmount_volume_and_cleanup_volume(self.mounts)
        if ret:
            g.log.info("Successfull unmount and cleanup of volume")
        else:
            raise ExecutionError("Failed to unmount and cleanup volume")
Пример #3
0
    def tearDown(self):

        # Unexport volume
        unexport_nfs_ganesha_volume(self.mnode, self.volname)
        ret = wait_for_nfs_ganesha_volume_to_get_unexported(
            self.mnode, self.volname)
        if not ret:
            raise ExecutionError("Failed:Volume %s is not unexported." %
                                 self.volname)
        g.log.info("Unexporting of volume is successful")

        # Unmount and cleanup Volume
        ret = self.unmount_volume_and_cleanup_volume(self.mounts)
        if ret:
            g.log.info("Successful unmount and cleanup of volume")
        else:
            raise ExecutionError("Failed to unmount and cleanup volume")
Пример #4
0
    def tearDownClass(cls,
                      umount_vol=True,
                      cleanup_vol=True,
                      teardown_nfs_ganesha_cluster=True):
        """Teardown the export, mounts and volume.
        """

        # Unmount volume
        if umount_vol:
            _rc = True
            for mount_obj in cls.mounts:
                ret = mount_obj.unmount()
                if not ret:
                    g.log.error("Unable to unmount volume '%s:%s' on '%s:%s'",
                                mount_obj.server_system, mount_obj.volname,
                                mount_obj.client_system, mount_obj.mountpoint)
                    _rc = False
            if not _rc:
                raise ExecutionError("Unmount of all mounts are not "
                                     "successful")

        # Cleanup volume
        if cleanup_vol:

            volinfo = get_volume_info(cls.mnode, cls.volname)
            if volinfo is None or cls.volname not in volinfo:
                g.log.info("Volume %s does not exist in %s" %
                           (cls.volname, cls.mnode))
            else:
                # Unexport volume, if it is not unexported already
                vol_option = get_volume_options(cls.mnode,
                                                cls.volname,
                                                option='ganesha.enable')
                if vol_option is None:
                    raise ExecutionError("Failed to get ganesha.enable volume "
                                         " option for %s " % cls.volume)
                if vol_option['ganesha.enable'] != 'off':
                    if is_volume_exported(cls.mnode, cls.volname, "nfs"):
                        ret, out, err = unexport_nfs_ganesha_volume(
                            mnode=cls.mnode, volname=cls.volname)
                        if ret != 0:
                            raise ExecutionError(
                                "Failed to unexport volume %s" % cls.volname)
                        time.sleep(5)
                else:
                    g.log.info("Volume %s is unexported already" % cls.volname)

                _, _, _ = g.run(cls.mnode, "showmount -e")

            ret = cleanup_volume(mnode=cls.mnode, volname=cls.volname)
            if not ret:
                raise ExecutionError("cleanup volume %s failed", cls.volname)

        # All Volume Info
        volume_info(cls.mnode)

        (NfsGaneshaClusterSetupClass.tearDownClass.im_func(
            cls, delete_nfs_ganesha_cluster=teardown_nfs_ganesha_cluster))
    def tearDown(self):
        """
        Unexport volumes
        Unmount and cleanup volumes
        """
        # Cleanup volumes created in test case
        for i in range(5):
            vol = "nfsvol" + str(i)
            # Unexport and cleanup volume if exists
            if volume_exists(self.mnode, vol):
                unexport_nfs_ganesha_volume(self.mnode, vol)
                ret = wait_for_nfs_ganesha_volume_to_get_unexported(
                    self.mnode, vol)
                if not ret:
                    raise ExecutionError("Volume %s is not unexported." % vol)

                ret = cleanup_volume(mnode=self.mnode, volname=vol)
                if not ret:
                    raise ExecutionError("Cleanup volume %s failed" % vol)

        # Unexport pre existing volume
        unexport_nfs_ganesha_volume(self.mnode, self.volname)
        ret = wait_for_nfs_ganesha_volume_to_get_unexported(
            self.mnode, self.volname)
        if not ret:
            raise ExecutionError("Volume %s is not unexported." % self.volname)

        # Unmount pre existing volume
        ret = self.unmount_volume(self.mounts)
        if ret:
            g.log.info("Successfully unmounted the volume")
        else:
            g.log.error("Failed to unmount volume")

        # Cleanup pre existing volume
        ret = self.cleanup_volume()
        if not ret:
            raise ExecutionError("Failed to cleanup volume")
        g.log.info("Cleanup volume %s completed successfully", self.volname)
    def tearDown(self):
        """
        Unexport volume
        Unmount and cleanup volume
        """
        # Unexport volume
        unexport_nfs_ganesha_volume(self.mnode, self.volname)
        ret = wait_for_nfs_ganesha_volume_to_get_unexported(
            self.mnode, self.volname)
        if not ret:
            raise ExecutionError("Volume %s is not unexported" % self.volname)

        # Unmount volume
        ret = self.unmount_volume(self.mounts)
        if ret:
            g.log.info("Successfully unmounted the volume")
        else:
            g.log.error("Failed to unmount volume")

        # Cleanup volume
        ret = self.cleanup_volume()
        if not ret:
            raise ExecutionError("Failed to cleanup volume")
        g.log.info("Cleanup volume %s completed successfully", self.volname)
    def tearDown(self):
        """
        Unexport volume
        Unmount and cleanup volume
        """
        # Unexport volume
        ret, _, _ = unexport_nfs_ganesha_volume(self.mnode, self.volname)
        if ret != 0:
            raise ExecutionError("Failed to unexport volume %s" % self.volname)

        # Unmount volume
        ret = self.unmount_volume(self.sub_dir_mounts)
        if ret:
            g.log.info("Successfully unmounted the volume")
        else:
            g.log.error("Failed to unmount volume")

        # Cleanup volume
        ret = self.cleanup_volume()
        if not ret:
            raise ExecutionError("Failed to cleanup volume")
        g.log.info("Cleanup volume %s completed successfully", self.volname)
    def tearDown(self):

        # Clean up the volumes created specific for this tests.
        for i in range(5):
            volname = "nfsvol" + str(i)
            volinfo = get_volume_info(self.mnode, volname)
            if volinfo is None or volname not in volinfo:
                g.log.info("Volume %s does not exist in %s", volname,
                           self.mnode)
                continue

            # Unexport volume, if it is not unexported already
            vol_option = get_volume_options(self.mnode,
                                            volname,
                                            option='ganesha.enable')
            if vol_option is None:
                raise ExecutionError("Failed to get ganesha.enable volume "
                                     " option for %s " % volname)
            if vol_option['ganesha.enable'] != 'off':
                if is_volume_exported(self.mnode, volname, "nfs"):
                    ret, _, _ = unexport_nfs_ganesha_volume(mnode=self.mnode,
                                                            volname=volname)
                    if ret != 0:
                        raise ExecutionError("Failed to unexport volume %s " %
                                             volname)
                    time.sleep(5)
            else:
                g.log.info("Volume %s is unexported already", volname)

            _, _, _ = g.run(self.mnode, "showmount -e")

            ret = cleanup_volume(mnode=self.mnode, volname=volname)
            if not ret:
                raise ExecutionError("cleanup volume %s failed" % volname)

        NfsGaneshaIOBaseClass.tearDown.im_func(self)