def setup(self):
        """
            Function to setup ganesha and create volume for testing.
        """
        ret = setup_nfs_ganesha(self.no_of_ganesha_nodes)
        if ret:
            tc.logger.info("setup of ganesha for %s node is successfull"
                           % self.no_of_ganesha_nodes)
        else:
            tc.logger.error("setup of ganesha for %s node is unsuccessfull"
                            % self.no_of_ganesha_nodes)
            return False
        ret = GlusterBaseClass.setup(self)
        if not ret:
            return False
        time.sleep(10)
        ret = get_volume_status(self.volname)
        if ret is None:
            return False
        ret = get_volume_info(self.volname)
        if ret is None:
            return False
        ret, out, err = tc.run(self.mnode, "showmount -e localhost")
        if ret != 0:
            return False
        ret, out, err = mount_volume(self.volname, self.mount_proto,
                                     self.mountpoint, self.vips[0],
                                     self.clients[0], self.options)
        if ret != 0:
            tc.logger.error("Mounting Volume %s failed on %s:%s" %
                            (self.volname, self.clients[0], self.mountpoint))
            return False

        return True
Exemple #2
0
def is_scrub_process_running(volname, mnode=None):
    """Checks if scrub process is running on the given node

    Args:
        volname (str): volume name

    Kwargs:
        mnode (str): Node on which cmd has to be executed.
            If None, defaults to servers[0].

    Returns:
        True on success, False otherwise

    Example:
        is_scrub_process_running("testvol")
    """
    if mnode is None:
        mnode = tc.servers[0]

    vol_status = get_volume_status(volname=volname, mnode=mnode)
    if vol_status is None:
        tc.logger.error("Failed to get volume status in " "isScrubProcessRunning()")
        return False

    if "Scrubber Daemon" not in vol_status[volname]["localhost"]:
        tc.logger.error("Bitrot is not enabled in volume %s" % volname)
        return False

    bitd_status = vol_status[volname]["localhost"]["Scrubber Daemon"]["status"]
    if bitd_status != "1":
        tc.logger.error("Scrubber Daemon is not running in node %s" % mnode)
        return False
    return True
Exemple #3
0
def is_scrub_process_running(volname, mnode=None):
    """Checks if scrub process is running on the given node

    Args:
        volname (str): volume name

    Kwargs:
        mnode (str): Node on which cmd has to be executed.
            If None, defaults to servers[0].

    Returns:
        True on success, False otherwise

    Example:
        is_scrub_process_running("testvol")
    """
    if mnode is None:
        mnode = tc.servers[0]

    vol_status = get_volume_status(volname=volname, mnode=mnode)
    if vol_status is None:
        tc.logger.error("Failed to get volume status in "
                        "isScrubProcessRunning()")
        return False

    if 'Scrubber Daemon' not in vol_status[volname]['localhost']:
        tc.logger.error("Bitrot is not enabled in volume %s" % volname)
        return False

    bitd_status = vol_status[volname]['localhost']['Scrubber Daemon']['status']
    if bitd_status != '1':
        tc.logger.error("Scrubber Daemon is not running in node %s" % mnode)
        return False
    return True