示例#1
0
 def ganesha_restart(self):
     log.info("restarting ganesha services")
     # self.ganesha_stop()
     # self.ganesha_start()
     log.info("restarting services using systemctl")
     cmd = "sudo systemctl restart nfs-ganesha"
     utils.exec_shell_cmd(cmd)
 def ganesha_restart(self):
     log.info('restarting ganesha services')
     # self.ganesha_stop()
     # self.ganesha_start()
     log.info('restarting services using systemctl')
     cmd = 'sudo systemctl restart nfs-ganesha'
     utils.exec_shell_cmd(cmd)
 def ganesha_start(self):
     log.info('starting nfs-ganesha services')
     # cmd = 'sudo /usr/bin/ganesha.nfsd -f /etc/ganesha/ganesha.conf'
     # utils.exec_shell_cmd(cmd)
     cmd = 'sudo systemctl enable nfs-ganesha '
     utils.exec_shell_cmd(cmd)
     cmd = 'sudo systemctl start nfs-ganesha '
     utils.exec_shell_cmd(cmd)
    def kernel_stop(self):

        log.info('stopping nfs kernel services')

        cmd = 'systemctl stop nfs-server.service'
        utils.exec_shell_cmd(cmd)

        cmd = 'systemctl disable nfs-server.service'
        utils.exec_shell_cmd(cmd)
 def backup(self, uname):
     """
     backup existing config  
     """
     original_fname = os.path.join(self.conf_path, self.fname)
     log.info('original file name: %s' % original_fname)
     backup_fname = os.path.join(str(self.conf_path), str(self.fname) + '.%s' % uname + '.bkp')
     log.info('backup file name: %s' % backup_fname)
     cmd = 'sudo mv %s %s' % (original_fname, backup_fname)
     utils.exec_shell_cmd(cmd)
 def backup(self, uname):
     """
     backup existing config
     """
     original_fname = os.path.join(self.conf_path, self.fname)
     log.info("original file name: %s" % original_fname)
     backup_fname = os.path.join(str(self.conf_path),
                                 str(self.fname) + ".%s" % uname + ".bkp")
     log.info("backup file name: %s" % backup_fname)
     cmd = "sudo mv %s %s" % (original_fname, backup_fname)
     utils.exec_shell_cmd(cmd)
    def ganesha_stop(self):
        log.info('stopping ganesha services via systemctl')
        # for now there is no way to stop ganesha services, only option is to kill the process

        # p = Process(name='ganesha')
        # p.find()
        #
        # if p.process is None:
        #     log.info('process nor running')
        # else:
        #     p.process.kill()
        #
        cmd = 'sudo systemctl stop nfs-ganesha'
        utils.exec_shell_cmd(cmd)
示例#8
0
 def set_bucket_quota(self, uid, max_objects):
     cmd = 'radosgw-admin quota set --uid=%s --quota-scope=bucket --max-objects=%s' % (
         uid, max_objects)
     status = utils.exec_shell_cmd(cmd)
     if not status[0]:
         raise AssertionError(status[1])
     log.info('quota set complete')
示例#9
0
    def enable_bucket_quota(self, uid):

        cmd = 'radosgw-admin quota enable --quota-scope=bucket --uid=%s' % uid

        status = utils.exec_shell_cmd(cmd)

        if not status[0]:
            raise AssertionError, status[1]

        log.info('quota set complete')
示例#10
0
    def backup(self, uname):

        """
        This function is to backup existing ganesha config with the user name provided

        Parameters:
            uname(char): user name provided to backup the ganesha config file.

        Returns:

        """

        original_fname = os.path.join(self.conf_path, self.fname)
        log.info("original file name: %s" % original_fname)

        backup_fname = os.path.join(
            str(self.conf_path), str(self.fname) + ".%s" % uname + ".bkp"
        )

        log.info("backup file name: %s" % backup_fname)

        cmd = "sudo mv %s %s" % (original_fname, backup_fname)

        utils.exec_shell_cmd(cmd)
示例#11
0
    def do_un_mount(self):

        log.info('un_mounting dir: %s' % self.mount_point)

        un_mount_cmd = 'sudo umount %s' % self.mount_point

        un_mounted = utils.exec_shell_cmd(un_mount_cmd)

        if un_mounted[0]:
            self.already_mounted = False

        self.update_config()

        self.read_config()

        return un_mounted
示例#12
0
    def do_mount(self):

        log.info('mounting on a dir: %s' % self.mount_point)

        self.nfs_service.ganesha_restart()

        if not os.path.exists(self.mount_point):
            os.makedirs(self.mount_point)

        mnt_cmd = 'sudo mount -v -t nfs -o nfsvers=%s,sync,rw,noauto,soft,proto=tcp %s:/  %s' % \
                  (self.nfs_version, self.rgw_hostname, self.mount_point, )

        log.info('mnt_command: %s' % mnt_cmd)

        mounted = utils.exec_shell_cmd(mnt_cmd)
        return mounted