Exemple #1
0
    def initialise(self):
        """ call the node, volume 'generator' to create the child objects
            (bricks are created within the volume logic) """

        self.has_volumes = True if glob(
            '/var/lib/glusterd/vols/*/trusted-*-fuse.vol') else False

        set_active_peer(
        )  # setup GlusterCommand class to have a valid node for commands

        # if has_volumes is populated we have vol files, then it's ok to
        # run the queries to define the node and volume objects
        if self.has_volumes:

            self.define_nodes()

            self.define_volumes()

            # if this cluster supports snapshots, take a look to see if
            # there are any

            self.snapshot_capable = version_ok(self.glfs_version,
                                               cfg.snapshot_support)

            if self.snapshot_capable:
                self.define_snapshots()

                self.snapshot_count = Snapshot.snap_count()

        else:
            # no volumes in this cluster, print a message and abort
            print("This cluster doesn't have any volumes/daemons running.")
            print(
                "The output below shows the current nodes attached to this host.\n"
            )

            cmd = GlusterCommand('gluster pool list', timeout=cfg.CMD_TIMEOUT)
            cmd.run()
            for line in cmd.stdout:
                print(line)
            print()
            exit(12)
Exemple #2
0
    def initialise(self):
        """ call the node, volume 'generator' to create the child objects
            (bricks are created within the volume logic) """

        self.has_volumes = True if glob('/var/lib/glusterd/vols/*/trusted-*-fuse.vol') else False

        set_active_peer()  # setup GlusterCommand class to have a valid node for commands

        # if has_volumes is populated we have vol files, then it's ok to
        # run the queries to define the node and volume objects
        if self.has_volumes:

            self.define_nodes()

            self.define_volumes()

            # if this cluster supports snapshots, take a look to see if
            # there are any

            self.snapshot_capable = version_ok(self.glfs_version, cfg.snapshot_support)

            if self.snapshot_capable:
                self.define_snapshots()

                self.snapshot_count = Snapshot.snap_count()

        else:
            # no volumes in this cluster, print a message and abort
            print "This cluster doesn't have any volumes/daemons running."
            print "The output below shows the current nodes attached to this host.\n"

            cmd = GlusterCommand('gluster pool list')
            cmd.run()
            for line in cmd.stdout:
                print line
            print
            exit(12)
Exemple #3
0
    volume_list = []  # empty list of vols = show them all

    # default behaviours
    if volume_request and args:
        volume_list = args

    if state_request:
        self_heal_backlog = False

    if options.everything:
        state_request = True
        volume_request = True

    if options.output_mode != 'console':
        self_heal_backlog = False

    # Create a cluster object. This simply creates the structure of 
    # the object and populates the glusterfs version 
    cluster = Cluster()

    cluster.output_mode = options.output_mode

    if version_ok(cluster.glfs_version, cfg.min_version):

        main()

    else:

        print "gstatus is not compatible with this version of glusterfs %s" % cluster.glfs_version
        exit(16)
Exemple #4
0
    # default behaviours
    if volume_request and args:
        volume_list = args

    if state_request:
        self_heal_backlog = False

    if options.everything:
        state_request = True
        volume_request = True

    if options.output_mode != 'console':
        self_heal_backlog = False

    # Create a cluster object. This simply creates the structure of
    # the object and populates the glusterfs version
    cluster = Cluster()

    cluster.output_mode = options.output_mode

    if version_ok(cluster.glfs_version, cfg.min_version):

        main()

    else:

        print("gstatus is not compatible with this version of glusterfs %s" %
              cluster.glfs_version)
        exit(16)