Ejemplo n.º 1
0
    def test_allowed_gluster_replica_count(self, replica_count):
        def glusterVolumeInfo(volumeName=None, remoteServer=None):
            return {'music': {'replicaCount': replica_count}}

        storageServer.supervdsm.glusterVolumeInfo = glusterVolumeInfo

        gluster = GlusterFSConnection(spec="192.168.122.1:/music")
        gluster.validate()
Ejemplo n.º 2
0
    def test_allowed_gluster_replica_count(self, replica_count):

        def glusterVolumeInfo(volumeName=None, remoteServer=None):
            return {'music': {'replicaCount': replica_count}}

        storageServer.supervdsm.glusterVolumeInfo = glusterVolumeInfo

        gluster = GlusterFSConnection(spec="192.168.122.1:/music")
        gluster.validate()
Ejemplo n.º 3
0
    def test_allowed_gluster_replica_count(self, replica_count, supported):

        def glusterVolumeInfo(volumeName=None, remoteServer=None):
            return {'music': {'replicaCount': replica_count}}

        storageServer.supervdsm.glusterVolumeInfo = glusterVolumeInfo

        gluster = GlusterFSConnection(spec="192.168.122.1:/music")
        if supported:
            gluster.validate()
        else:
            self.assertRaises(se.UnsupportedGlusterVolumeReplicaCountError,
                              gluster.validate)
Ejemplo n.º 4
0
    def test_user_provided_gluster_mount_options(self):
        def glusterVolumeInfo(volname=None, volfileServer=None):
            return None

        user_options = "backup-volfile-servers=server1:server2"
        gluster = GlusterFSConnection(spec="192.168.122.1:/music",
                                      options=user_options)
        self.assertEquals(gluster.options, user_options)
Ejemplo n.º 5
0
    def test_gluster_replica1_mount_options(self):
        def glusterVolumeInfo(volname=None, volfileServer=None):
            self.assertEqual(volname, "music")
            self.assertEqual(volfileServer, "192.168.122.1")
            return {'music': {'brickCount': '1',
                              'bricks': ['192.168.122.1:/tmp/music']}}

        storageServer.supervdsm.glusterVolumeInfo = glusterVolumeInfo

        gluster = GlusterFSConnection(spec="192.168.122.1:/music")
        self.assertEquals(gluster.options, "")
Ejemplo n.º 6
0
    def test_gluster_and_user_provided_mount_options(self):
        def glusterVolumeInfo(volname=None, volfileServer=None):
            return {'music': {'brickCount': '3',
                              'bricks': ['192.168.122.1:/tmp/music',
                                         '192.168.122.2:/tmp/music',
                                         '192.168.122.3:/tmp/music']}}

        storageServer.supervdsm.glusterVolumeInfo = glusterVolumeInfo

        gluster = GlusterFSConnection(spec="192.168.122.1:/music",
                                      options="option1=val1")
        expected_options = \
            "option1=val1,backup-volfile-servers=192.168.122.2:192.168.122.3"
        self.assertEquals(gluster.options, expected_options)
Ejemplo n.º 7
0
    def test_server_not_in_volinfo(self):
        """
        This test simulates a use case where gluster server provided in the
        path doesn't appear in the volume info.
        """
        def glusterVolumeInfo(volname=None, volfileServer=None):
            return {'music': {'brickCount': '3',
                              'bricks': ['192.168.122.5:/tmp/music',
                                         '192.168.122.2:/tmp/music',
                                         '192.168.122.3:/tmp/music']}}

        storageServer.supervdsm.glusterVolumeInfo = glusterVolumeInfo

        gluster = GlusterFSConnection(spec="gluster-server:/music")
        expected_backup_servers = \
            "backup-volfile-servers=192.168.122.5:192.168.122.2:192.168.122.3"
        self.assertEquals(gluster.options, expected_backup_servers)
Ejemplo n.º 8
0
    def test_duplicate_servers_in_volinfo(self):
        """
        This test verifies that servers list contains no duplicates.
        """
        def glusterVolumeInfo(volname=None, volfileServer=None):
            return {'music': {'brickCount': '3',
                              'bricks': ['192.168.122.5:/tmp/music',
                                         '192.168.122.2:/tmp/music',
                                         '192.168.122.2:/tmp/music',
                                         '192.168.122.5:/tmp/music',
                                         '192.168.122.3:/tmp/music']}}

        storageServer.supervdsm.glusterVolumeInfo = glusterVolumeInfo

        gluster = GlusterFSConnection(spec="gluster-server:/music")
        expected_backup_servers = \
            "backup-volfile-servers=192.168.122.5:192.168.122.2:192.168.122.3"
        self.assertEquals(gluster.options, expected_backup_servers)
Ejemplo n.º 9
0
    def test_validate(self):
        storageServer.supervdsm.glusterVolumeInfo = self.glusterVolumeInfo

        gluster = GlusterFSConnection(spec="192.168.122.1:/music")
        gluster.validate()
Ejemplo n.º 10
0
    def test_mount_options(self, userMountOptions):
        storageServer.supervdsm.glusterVolumeInfo = self.glusterVolumeInfo

        gluster = GlusterFSConnection(spec="192.168.122.1:/music",
                                      options=userMountOptions)
        self.assertEquals(gluster.options, userMountOptions)
Ejemplo n.º 11
0
    def test_validate(self):
        storageServer.supervdsm.glusterVolumeInfo = self.glusterVolumeInfo

        gluster = GlusterFSConnection(spec="192.168.122.1:/music")
        gluster.validate()
Ejemplo n.º 12
0
 def test_glusterfs_cli_missing(self):
     gluster = GlusterFSConnection(spec="192.168.122.1:/music")
     self.assertEquals(gluster.options, "")
Ejemplo n.º 13
0
 def test_mountpoint(self):
     mount_con = GlusterFSConnection("server:/volume", mountClass=FakeMount)
     self.assertEquals(mount_con._mount.fs_spec, "server:/volume")
     self.assertEquals(mount_con._mount.fs_file,
                       "/tmp/glusterSD/server:_volume")