Exemple #1
0
    def execute_fs(self, fs, fs_conf, eh, vlevel):

        # Warn if trying to act on wrong nodes
        comps = fs.components.managed(supports='mount')
        if not self.check_valid_list(fs.fs_name, comps.servers(), "mount"):
            return RC_FAILURE

        # Will call the handle_pre() method defined by the event handler.
        if hasattr(eh, 'pre'):
            eh.pre(fs)

        self.copy_tuning(fs, comps=comps)

        status = fs.mount(addopts=self.options.additional,
                          fanout=self.options.fanout,
                          dryrun=self.options.dryrun,
                          tunings=Tune.get_tuning(fs_conf, fs.components))

        rc = self.fs_status_to_rc(status)

        if not self.options.remote:
            if rc == RC_OK:
                if vlevel > 0:
                    key = lambda c: c.state == MOUNTED
                    print "%s was successfully mounted on %s" % \
                        (fs.fs_name, comps.filter(key=key).servers())
            elif rc == RC_RUNTIME_ERROR:
                self.display_proxy_errors(fs)

        if hasattr(eh, 'post'):
            eh.post(fs)

        return rc
Exemple #2
0
    def execute_fs(self, fs, fs_conf, eh, vlevel):

        # Warn if trying to act on wrong nodes
        comps = fs.components.managed(supports="mount")
        if not self.check_valid_list(fs.fs_name, comps.servers(), "mount"):
            return RC_FAILURE

        # Will call the handle_pre() method defined by the event handler.
        if hasattr(eh, "pre"):
            eh.pre(fs)

        self.copy_tuning(fs, comps=comps)

        status = fs.mount(
            addopts=self.options.additional,
            fanout=self.options.fanout,
            dryrun=self.options.dryrun,
            tunings=Tune.get_tuning(fs_conf, fs.components),
        )

        rc = self.fs_status_to_rc(status)

        if not self.options.remote:
            if rc == RC_OK:
                if vlevel > 0:
                    key = lambda c: c.state == MOUNTED
                    print "%s was successfully mounted on %s" % (fs.fs_name, comps.filter(key=key).servers())
            elif rc == RC_RUNTIME_ERROR:
                self.display_proxy_errors(fs)

        if hasattr(eh, "post"):
            eh.post(fs)

        return rc
Exemple #3
0
    def execute_fs(self, fs, fs_conf, eh, vlevel):

        # Warn if trying to act on wrong nodes
        comps = fs.components.managed(supports='mount')
        if not self.check_valid_list(fs.fs_name, comps.servers(), "mount"):
            return RC_FAILURE

        # Will call the handle_pre() method defined by the event handler.
        if hasattr(eh, 'pre'):
            eh.pre(fs)

        self.copy_tuning(fs, comps=comps)

        status = fs.mount(addopts=self.options.additional)

        rc = self.fs_status_to_rc(status)

        if not self.options.remote:
            if rc == RC_OK:
                if vlevel > 0:
                    key = lambda c: c.state == MOUNTED
                    print "%s was successfully mounted on %s" % \
                        (fs.fs_name, comps.filter(key=key).servers())

                # Apply tuning after successful mount(s)
                tuning = Tune.get_tuning(fs_conf)
                status = fs.tune(tuning, comps=comps)
                if status == MOUNTED:
                    if vlevel > 1:
                        print "Filesystem tuning applied on %s" % \
                                                        comps.servers()
                elif status == TARGET_ERROR:
                    print "ERROR: Filesystem tuning failed"
                    rc = RC_RUNTIME_ERROR
                else:
                    rc = RC_RUNTIME_ERROR

            else:
                # Display a failure message in case of previous failed
                # mounts. For now, if one mount fail, the tuning is
                # skipped. Use `shine tune' to manually tune the FS.
                # Trac ticket #46 aims to improve this.
                if vlevel > 0:
                    print "Tuning skipped!"

            if rc == RC_RUNTIME_ERROR:
                self.display_proxy_errors(fs)

        if hasattr(eh, 'post'):
            eh.post(fs)

        return rc
Exemple #4
0
    def execute_fs(self, fs, fs_conf, eh, vlevel):

        # Prepare options...
        mount_options = {}
        mount_paths = {}
        for tgt_type in [ 'mgt', 'mdt', 'ost' ]:
            mount_options[tgt_type] = fs_conf.get_target_mount_options(tgt_type)
            mount_paths[tgt_type] = fs_conf.get_target_mount_path(tgt_type)

        # Warn if trying to act on wrong nodes
        comps = fs.components.managed(supports='start')
        if not self.check_valid_list(fs.fs_name, comps.servers(), 'start'):
            return RC_FAILURE

        # Will call the handle_pre() method defined by the event handler.
        if hasattr(eh, 'pre'):
            eh.pre(fs)

        self.copy_tuning(fs, comps=comps)

        status = fs.start(mount_options=mount_options,
                          mount_paths=mount_paths,
                          addopts=self.options.additional,
                          failover=self.options.failover,
                          mountdata=self.options.mountdata)

        rc = self.fs_status_to_rc(status)

        if rc == RC_OK:
            if vlevel > 0:
                print "Start successful."
            tuning = Tune.get_tuning(fs_conf)
            status = fs.tune(tuning, comps=comps)
            if status == MOUNTED:
                if vlevel > 1:
                    print "Filesystem tuning applied on %s" % comps.servers()
            elif status == TARGET_ERROR:
                print "ERROR: Filesystem tuning failed"
                rc = RC_RUNTIME_ERROR
            elif status == RUNTIME_ERROR:
                rc = RC_RUNTIME_ERROR
            # XXX improve tuning on start error handling
        elif vlevel > 0:
            print "Tuning skipped."

        if rc == RC_RUNTIME_ERROR:
            self.display_proxy_errors(fs)

        if hasattr(eh, 'post'):
            eh.post(fs)

        return rc
Exemple #5
0
    def execute_fs(self, fs, fs_conf, eh, vlevel):

        # Prepare options...
        mount_options = {}
        mount_paths = {}
        for tgt_type in ["mgt", "mdt", "ost"]:
            mount_options[tgt_type] = fs_conf.get_target_mount_options(tgt_type)
            mount_paths[tgt_type] = fs_conf.get_target_mount_path(tgt_type)

        # Warn if trying to act on wrong nodes
        comps = fs.components.managed(supports="start")
        if not self.check_valid_list(fs.fs_name, comps.servers(), "start"):
            return RC_FAILURE

        # Will call the handle_pre() method defined by the event handler.
        if hasattr(eh, "pre"):
            eh.pre(fs)

        self.copy_tuning(fs, comps=comps)

        status = fs.start(
            mount_options=mount_options,
            mount_paths=mount_paths,
            addopts=self.options.additional,
            failover=self.options.failover,
            fanout=self.options.fanout,
            dryrun=self.options.dryrun,
            mountdata=self.options.mountdata,
            tunings=Tune.get_tuning(fs_conf, fs.components),
        )

        rc = self.fs_status_to_rc(status)

        if rc == RC_OK:
            if vlevel > 0:
                print "Start successful."
        elif rc == RC_RUNTIME_ERROR:
            self.display_proxy_errors(fs)

        if hasattr(eh, "post"):
            eh.post(fs)

        return rc
Exemple #6
0
    def execute_fs(self, fs, fs_conf, eh, vlevel):

        # Prepare options...
        mount_options = {}
        mount_paths = {}
        for tgt_type in ['mgt', 'mdt', 'ost']:
            mount_options[tgt_type] = fs_conf.get_target_mount_options(
                tgt_type)
            mount_paths[tgt_type] = fs_conf.get_target_mount_path(tgt_type)

        # Warn if trying to act on wrong nodes
        comps = fs.components.managed(supports='start')
        if not self.check_valid_list(fs.fs_name, comps.servers(), 'start'):
            return RC_FAILURE

        # Will call the handle_pre() method defined by the event handler.
        if hasattr(eh, 'pre'):
            eh.pre(fs)

        self.copy_tuning(fs, comps=comps)

        status = fs.start(mount_options=mount_options,
                          mount_paths=mount_paths,
                          addopts=self.options.additional,
                          failover=self.options.failover,
                          fanout=self.options.fanout,
                          dryrun=self.options.dryrun,
                          mountdata=self.options.mountdata,
                          tunings=Tune.get_tuning(fs_conf, fs.components))

        rc = self.fs_status_to_rc(status)

        if rc == RC_OK:
            if vlevel > 0:
                print "Start successful."
        elif rc == RC_RUNTIME_ERROR:
            self.display_proxy_errors(fs)

        if hasattr(eh, 'post'):
            eh.post(fs)

        return rc