def test_glusterd_set_reset_reserve_limit(self):
        """
        Test set and reset of reserve limit on glusterd
        1. Create a volume and start it.
        2. Set storage.reserve limit on the created volume and verify it.
        3. Reset storage.reserve limit on the created volume and verify it.
        """
        # Setting storage.reserve to 50
        ret = set_volume_options(self.mnode, self.volname,
                                 {'storage.reserve': '50'})
        self.assertTrue(ret,
                        "Failed to set storage reserve on %s" % self.mnode)

        # Validate storage.reserve option set to 50
        self.validate_vol_option('storage.reserve', '50')

        # Reseting the storage.reserve limit
        ret, _, _ = reset_volume_option(self.mnode, self.volname,
                                        'storage.reserve')
        self.assertEqual(ret, 0, "Failed to reset the storage.reserve limit")

        # Validate that the storage.reserve option is reset
        ret = get_volume_options(self.mnode, self.volname, 'storage.reserve')
        if ret['storage.reserve'] == '1':
            self.validate_vol_option('storage.reserve', '1')
        else:
            self.validate_vol_option('storage.reserve', '1 (DEFAULT)')
    def tearDown(self):
        """
        tearDown for every test
        """

        # Reset the volume options set inside the test
        g.log.info("Reset the volume options")
        vol_options = [
            'cluster.self-heal-daemon', 'cluster.quorum-type',
            'cluster.quorum-count'
        ]
        for opt in vol_options:
            ret, _, _ = reset_volume_option(self.mnode, self.volname, opt)
            if ret != 0:
                raise ExecutionError("Failed to reset the volume option %s" %
                                     opt)
            sleep(2)
        g.log.info("Successfully reset the volume options")

        # stopping the 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')()
Exemplo n.º 3
0
    def tearDown(self):
        # Disable brick multiplexing
        g.log.info("Checking for brick multiplexing status...")
        if is_brick_mux_enabled(self.mnode):
            g.log.info("Disabling brick multiplexing...")
            if not disable_brick_mux(self.mnode):
                raise ExecutionError("Failed to disable brick multiplexing")
            g.log.info("Disabled brick multiplexing successfully")

        ret, _, _ = reset_volume_option(self.mnode, "all", "all")
        if ret:
            raise ExecutionError("Unable to reset all volume options")
        g.log.info("Successfully reset all the volume options.")

        # Calling GlusterBaseClass teardown
        self.get_super_method(self, 'tearDown')()
    def tearDown(self):
        # Reset the volume options set inside the test
        vol_options = ['performance.parallel-readdir',
                       'performance.readdir-ahead']
        for opt in vol_options:
            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')()