Esempio n. 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)
Esempio n. 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)