コード例 #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
ファイル: FSUtils.py プロジェクト: kcgthb/lustre-shine
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
コード例 #3
0
ファイル: Show.py プロジェクト: kcgthb/lustre-shine
    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
コード例 #4
0
ファイル: Show.py プロジェクト: gauthierdelerce/shine
    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
コード例 #5
0
ファイル: Show.py プロジェクト: kcgthb/lustre-shine
    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)
コード例 #6
0
ファイル: Show.py プロジェクト: gauthierdelerce/shine
    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))