diff options
-rw-r--r-- | gluster/gfapi/gfapi.py | 5 | ||||
-rw-r--r-- | test/functional/libgfapi-python-tests.py | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/gluster/gfapi/gfapi.py b/gluster/gfapi/gfapi.py index 89d8388..d48aa06 100644 --- a/gluster/gfapi/gfapi.py +++ b/gluster/gfapi/gfapi.py @@ -629,7 +629,8 @@ class Volume(object): """ Create a Volume object instance. - :param host: Host with glusterd management daemon running. + :param host: Host with glusterd management daemon running OR + : path to socket file which glusterd is listening on. :param volname: Name of GlusterFS volume to be mounted and used. :param proto: Transport protocol to be used to connect to management daemon. Permitted values are "tcp" and "rdma". @@ -658,7 +659,7 @@ class Volume(object): if None in (volname, host): # TODO: Validate host based on regex for IP/FQDN. raise LibgfapiException("Host and Volume name should not be None.") - if proto not in ('tcp', 'rdma'): + if proto not in ('tcp', 'rdma', 'unix'): raise LibgfapiException("Invalid protocol specified.") if not isinstance(port, (int, long)): raise LibgfapiException("Invalid port specified.") diff --git a/test/functional/libgfapi-python-tests.py b/test/functional/libgfapi-python-tests.py index cf269d3..c209302 100644 --- a/test/functional/libgfapi-python-tests.py +++ b/test/functional/libgfapi-python-tests.py @@ -37,6 +37,8 @@ else: HOST = 'localhost' VOLNAME = 'test' +GLUSTERD_SOCK_FILE = "/var/run/glusterd.socket" + class BinFileOpsTest(unittest.TestCase): @@ -1150,3 +1152,10 @@ class TestVolumeInit(unittest.TestCase): # Unmount the volume vol.umount() self.assertFalse(vol.mounted) + + def test_unix_socket_mount(self): + vol = Volume(GLUSTERD_SOCK_FILE, VOLNAME, proto="unix") + vol.mount() + self.assertTrue(vol.mounted) + vol.umount() + self.assertFalse(vol.mounted) |