Exemple #1
0
 def makeTempTuningModel(self, text):
     """
     Create a temporary file instance and returns a TuningModel with it.
     """
     self.f = makeTempFile(text)
     model = TuningModel(filename=self.f.name)
     return model
Exemple #2
0
 def setUp(self):
     CommonTestCase.setUp(self)
     self.srv = Server(Utils.HOSTNAME, ["%s@tcp" % Utils.HOSTNAME],
                       hdlr=self.eh)
     self.disk = Utils.make_disk()
     self.tgt = self.fs.new_target(self.srv, 'mgt', 0, self.disk.name)
     self.model = TuningModel()
     self.model.create_parameter('/dev/null', 1, node_type_list=['mgs'])
Exemple #3
0
    def __init__(self, filename):

        self.backend = None
        self.xmf_path = None
        self.model = Model()

        try:
            self.model.load(filename)
        except IOError:
            raise ModelFileIOError("Could not read %s" % filename)

        # Set nodes to nids mapping using the NidMap helper class
        self.nid_map = NidMap.fromlist(self.get('nid_map'))

        # Initialize the tuning model to None if no special tuning configuration
        # is provided
        self.tuning_model = TuningModel()
Exemple #4
0
    def __init__(self, filename):

        self.backend = None
        self.xmf_path = None
        self.model = Model()

        try:
            self.model.load(filename)
        except IOError:
            raise ModelFileIOError("Could not read %s" % filename)

        # Model expands nid_map automatically, just iterate other them
        self.nid_map = {}
        for elem in self.get('nid_map'):
            self.nid_map.setdefault(elem['nodes'], []).append(elem['nids'])

        # Initialize the tuning model to None if no special tuning configuration
        # is provided
        self.tuning_model = TuningModel()
Exemple #5
0
    def get_tuning(cls, fs_conf, comps):
        """
        Tune class method: get TuningModel for a fs configuration.
        """
        # XXX: If no tuning.conf is defined in configuration
        # we still create a tuning model which will be used for quota.
        # Be carefull that this could be very confusing for users, who
        # can think tuning will be applied but is not.
        tuning = TuningModel()

        # Is the tuning configuration file name specified?
        if Globals().get_tuning_file():
            # Load the tuning configuration file
            tuning.parse(filename=Globals().get_tuning_file())

        # Add the quota tuning parameters to the tuning model.
        if Globals().lustre_version_is_smaller('2.4'):
            cls._add_quota_tuning(tuning, fs_conf)

        cls._add_active_tuning(tuning, comps)

        return tuning
Exemple #6
0
 def testExampleFile(self):
     """test example tuning"""
     m = TuningModel(filename="../conf/tuning.conf.example")
     m.parse()