示例#1
0
文件: FSUtils.py 项目: thiell/shine
def open_lustrefs(fs_name,
                  target_types=None,
                  nodes=None,
                  excluded=None,
                  failover=None,
                  indexes=None,
                  labels=None,
                  groups=None,
                  event_handler=None,
                  extended=False):
    """
    Helper function used to build an instantiated Lustre.FileSystem
    from installed shine configuration.
    """
    # Create file system configuration
    fs_conf = Configuration.load_from_cache(fs_name)

    fs = instantiate_lustrefs(fs_conf,
                              target_types,
                              nodes,
                              excluded,
                              failover,
                              indexes,
                              labels,
                              groups,
                              event_handler,
                              extended=extended)

    return fs_conf, fs
示例#2
0
 def make_config(self, text):
     """
     Create a temporary file instance and returns a Configuration with it.
     """
     self._testfile = makeTempFile(text)
     conf = Configuration.create_from_model(self._testfile.name)
     return conf
 def make_config(self, text):
     """
     Create a temporary file instance and returns a Configuration with it.
     """
     self._testfile = makeTempFile(text)
     conf = Configuration.create_from_model(self._testfile.name)
     return conf
示例#4
0
 def test_accessors(self):
     """Configuration get_* accessors."""
     self._conf = Configuration.create_from_model(
         "../conf/models/example.lmf")
     self.assertEqual(self._conf.get_stripecount(), 1)
     self.assertEqual(self._conf.get_stripesize(), 1048576)
     self.assertTrue(self._conf.get_cfg_filename())
示例#5
0
def create_lustrefs(fs_model_file, event_handler=None, nodes=None, 
                    excluded=None, update_mode=False):
    """Create a FileSystem instance from configuration file and save in on
    disk."""
    fs_conf = Configuration.create_from_model(fs_model_file, update_mode)
    
    fs = instantiate_lustrefs(fs_conf, event_handler=event_handler, \
                              nodes=nodes, excluded=excluded)

    return fs_conf, fs
示例#6
0
文件: FSUtils.py 项目: thiell/shine
def create_lustrefs(fs_model_file,
                    event_handler=None,
                    nodes=None,
                    excluded=None,
                    update_mode=False):
    """Create a FileSystem instance from configuration file and save in on
    disk."""
    fs_conf = Configuration.create_from_model(fs_model_file, update_mode)

    fs = instantiate_lustrefs(fs_conf, event_handler=event_handler, \
                              nodes=nodes, excluded=excluded)

    return fs_conf, fs
示例#7
0
def open_lustrefs(fs_name, target_types=None, nodes=None, excluded=None,
          failover=None, indexes=None, labels=None, groups=None,
          event_handler=None):
    """
    Helper function used to build an instantiated Lustre.FileSystem
    from installed shine configuration.
    """
    # Create file system configuration
    fs_conf = Configuration.load_from_cache(fs_name)

    fs = instantiate_lustrefs(fs_conf, target_types, nodes, excluded,
                              failover, indexes, labels, groups,
                              event_handler)

    return fs_conf, fs
示例#8
0
    def cmd_show_fs(self):
        """Show filesystems"""
        # XXX: Use a constant here
        verb = self.options.verbose >= 2

        tbl = setup_table(self.options, "%fsname %description")

        for fsname in self.iter_fsname():
            try:
                fs_conf = Configuration.load_from_cache(fsname)
            except:
                print "Error with FS ``%s'' configuration files." % fsname
                raise
            if not verb:
                print fs_conf.get_fs_name()
            else:
                tbl.append({'fsname': fs_conf.get_fs_name(),
                            'description': fs_conf.get_description()})
        if verb:
            print str(tbl)

        return 0
示例#9
0
    def cmd_show_fs(self):
        """Show filesystems"""
        # XXX: Use a constant here
        verb = self.options.verbose >= 2

        tbl = setup_table(self.options, "%fsname %description")

        for fsname in self.iter_fsname():
            try:
                fs_conf = Configuration.load_from_cache(fsname)
            except:
                print("Error with FS ``%s'' configuration files." % fsname)
                raise
            if not verb:
                print(fs_conf.get_fs_name())
            else:
                tbl.append({
                    'fsname': fs_conf.get_fs_name(),
                    'description': fs_conf.get_description()
                })
        if verb:
            print(str(tbl))

        return 0
示例#10
0
 def make_temp_fs(self, txt):
     self._fsfile = makeTempFile(txt)
     self._conf = Configuration.create_from_model(self._fsfile.name)
     self._model = self._conf._fs.model
示例#11
0
    def cmd_show_info(self):
        """Show filesystem info"""
        # Walk through the list of file system managed 
        # by the current node and specified by the user.
        for fsname in self.iter_fsname():

            try:
                # Get the file system configuration structure
                fs_conf = Configuration.load_from_cache(fsname)
            except:
                # We fail to get current file system configuration information.
                # Display an error message.
                print "Error with FS ``%s'' configuration files." % fsname
                raise
                
            # Retrieve quota configuration information
            if Globals().lustre_version_is_smaller('2.4'):
                quota_info = ''
                if fs_conf.has_quota():
                    quota_info += 'type=%s ' % fs_conf.get_quota_type()

                    qiunit = fs_conf.get_quota_iunit() or '[lustre_default]'
                    quota_info += 'iunit=%s ' % qiunit

                    qbunit = fs_conf.get_quota_bunit() or '[lustre_default]'
                    quota_info += 'bunit=%s ' % qbunit

                    qitune = fs_conf.get_quota_itune() or '[lustre_default]'
                    quota_info += 'itune=%s ' % qitune

                    qbtune = fs_conf.get_quota_btune() or '[lustre_default]'
                    quota_info += 'btune=%s ' % qbtune
                else:
                    quota_info = 'not activated'

            # Get file system stripping configuration information
            stripping = 'stripe_size=%s ' % fs_conf.get_stripesize()
            stripping += 'stripe_count=%s' % fs_conf.get_stripecount()

            # Get the device path used to mount the file system on client node
            mgsnodes = [fs_conf.get_target_mgt().get_nodename()]
            mgsnodes += fs_conf.get_target_mgt().ha_nodes()
            mgsnids = [ ','.join(fs_conf.get_nid(node)) for node in mgsnodes ]
            device_path = "%s:/%s" % (':'.join(mgsnids), fs_conf.get_fs_name())

            tbl = setup_table(self.options, "%name %value")

            # Add configuration parameter to the list of element displayed in
            # the summary tab.
            tbl.append({'name': 'name', 'value': fs_conf.get_fs_name()})
            tbl.append({'name': 'default mount path',
                        'value': fs_conf.get_mount_path()})
            tbl.append({'name': 'device path', 'value': device_path})
            tbl.append({'name': 'mount options',
                        'value': fs_conf.get_default_mount_options()})
            if Globals().lustre_version_is_smaller('2.4'):
                tbl.append({'name': 'quotas', 'value': quota_info})
            tbl.append({'name': 'stripping', 'value': stripping})
            tbl.append({'name': 'tuning',
                        'value': Globals().get_tuning_file()})
            tbl.append({'name': 'description',
                        'value': fs_conf.get_description()})

            # Display the list of collected configuration information
            print str(tbl)
示例#12
0
    def cmd_show_info(self):
        """Show filesystem info"""
        # Walk through the list of file system managed
        # by the current node and specified by the user.
        for fsname in self.iter_fsname():

            try:
                # Get the file system configuration structure
                fs_conf = Configuration.load_from_cache(fsname)
            except:
                # We fail to get current file system configuration information.
                # Display an error message.
                msg = "Error with FS ``%s'' configuration files." % fsname
                print(msg, file=sys.stderr)
                raise

            # Retrieve quota configuration information
            if Globals().lustre_version_is_smaller('2.4'):
                quota_info = ''
                if fs_conf.has_quota():
                    quota_info += 'type=%s ' % fs_conf.get_quota_type()

                    qiunit = fs_conf.get_quota_iunit() or '[lustre_default]'
                    quota_info += 'iunit=%s ' % qiunit

                    qbunit = fs_conf.get_quota_bunit() or '[lustre_default]'
                    quota_info += 'bunit=%s ' % qbunit

                    qitune = fs_conf.get_quota_itune() or '[lustre_default]'
                    quota_info += 'itune=%s ' % qitune

                    qbtune = fs_conf.get_quota_btune() or '[lustre_default]'
                    quota_info += 'btune=%s ' % qbtune
                else:
                    quota_info = 'not activated'

            # Get file system stripping configuration information
            stripping = 'stripe_size=%s ' % fs_conf.get_stripesize()
            stripping += 'stripe_count=%s' % fs_conf.get_stripecount()

            # Get the device path used to mount the file system on client node
            mgsnodes = [fs_conf.get_target_mgt().get_nodename()]
            mgsnodes += fs_conf.get_target_mgt().ha_nodes()
            mgsnids = [','.join(fs_conf.get_nid(node)) for node in mgsnodes]
            device_path = "%s:/%s" % (':'.join(mgsnids), fs_conf.get_fs_name())

            tbl = setup_table(self.options, "%name %value")

            # Add configuration parameter to the list of element displayed in
            # the summary tab.
            tbl.append({'name': 'name', 'value': fs_conf.get_fs_name()})
            tbl.append({
                'name': 'default mount path',
                'value': fs_conf.get_mount_path()
            })
            tbl.append({'name': 'device path', 'value': device_path})
            tbl.append({
                'name': 'mount options',
                'value': fs_conf.get_default_mount_options()
            })
            if Globals().lustre_version_is_smaller('2.4'):
                tbl.append({'name': 'quotas', 'value': quota_info})
            tbl.append({'name': 'stripping', 'value': stripping})
            tbl.append({
                'name': 'tuning',
                'value': Globals().get_tuning_file()
            })
            tbl.append({
                'name': 'description',
                'value': fs_conf.get_description()
            })

            # Display the list of collected configuration information
            print(str(tbl))
示例#13
0
文件: FSUtils.py 项目: thiell/shine
def open_model(fs_model_file):
    """Only load a model file"""
    return Configuration.load_from_model(fs_model_file)
示例#14
0
def open_model(fs_model_file):
    """Only load a model file"""
    return Configuration.load_from_model(fs_model_file)
示例#15
0
 def test_accessors(self):
     """Configuration get_* accessors."""
     self._conf = Configuration.create_from_model("../conf/models/example.lmf")
     self.assertEqual(self._conf.get_stripecount(), 1)
     self.assertEqual(self._conf.get_stripesize(), 1048576)
     self.assertTrue(self._conf.get_cfg_filename())
示例#16
0
 def make_temp_fs(self, txt):
     self._fsfile = makeTempFile(txt)
     self._conf = Configuration.create_from_model(self._fsfile.name)
     self._model = self._conf._fs.model