def _do_test_update_export_with_ganesha_conf(self): nfs_mod = Module('nfs', '', '') conf = ExportMgr(nfs_mod) r = conf.apply_export(self.cluster_id, self.export_3) assert r[0] == 0
def _do_test_update_export_with_list(self): nfs_mod = Module('nfs', '', '') conf = ExportMgr(nfs_mod) r = conf.apply_export( self.cluster_id, json.dumps([ { 'path': 'bucket', 'pseudo': '/rgw/bucket', 'cluster_id': self.cluster_id, 'access_type': 'RW', 'squash': 'root', 'security_label': False, 'protocols': [4], 'transports': ['TCP'], 'clients': [{ 'addresses': ["192.168.0.0/16"], 'access_type': None, 'squash': None }], 'fsal': { 'name': 'RGW', 'user_id': 'nfs.foo.bucket', 'access_key_id': 'the_access_key', 'secret_access_key': 'the_secret_key', } }, { 'path': 'bucket2', 'pseudo': '/rgw/bucket2', 'cluster_id': self.cluster_id, 'access_type': 'RO', 'squash': 'root', 'security_label': False, 'protocols': [4], 'transports': ['TCP'], 'clients': [{ 'addresses': ["192.168.0.0/16"], 'access_type': None, 'squash': None }], 'fsal': { 'name': 'RGW', 'user_id': 'nfs.foo.bucket2', 'access_key_id': 'the_access_key', 'secret_access_key': 'the_secret_key', } }, ])) assert r[0] == 0 export = conf._fetch_export('foo', '/rgw/bucket') assert export.export_id == 3 assert export.path == "bucket" assert export.pseudo == "/rgw/bucket" assert export.access_type == "RW" assert export.squash == "root" assert export.protocols == [4] assert export.transports == ["TCP"] assert export.fsal.name == "RGW" assert export.fsal.access_key_id == "the_access_key" assert export.fsal.secret_access_key == "the_secret_key" assert len(export.clients) == 1 assert export.clients[0].squash is None assert export.clients[0].access_type is None assert export.cluster_id == self.cluster_id export = conf._fetch_export('foo', '/rgw/bucket2') assert export.export_id == 4 assert export.path == "bucket2" assert export.pseudo == "/rgw/bucket2" assert export.access_type == "RO" assert export.squash == "root" assert export.protocols == [4] assert export.transports == ["TCP"] assert export.fsal.name == "RGW" assert export.fsal.access_key_id == "the_access_key" assert export.fsal.secret_access_key == "the_secret_key" assert len(export.clients) == 1 assert export.clients[0].squash is None assert export.clients[0].access_type is None assert export.cluster_id == self.cluster_id
def _do_test_update_export(self): nfs_mod = Module('nfs', '', '') conf = ExportMgr(nfs_mod) r = conf.apply_export( self.cluster_id, json.dumps({ 'export_id': 2, 'path': 'bucket', 'pseudo': '/rgw/bucket', 'cluster_id': self.cluster_id, 'access_type': 'RW', 'squash': 'all_squash', 'security_label': False, 'protocols': [4, 3], 'transports': ['TCP', 'UDP'], 'clients': [{ 'addresses': ["192.168.0.0/16"], 'access_type': None, 'squash': None }], 'fsal': { 'name': 'RGW', 'user_id': 'nfs.foo.bucket', 'access_key_id': 'the_access_key', 'secret_access_key': 'the_secret_key', } })) assert r[0] == 0 export = conf._fetch_export('foo', '/rgw/bucket') assert export.export_id == 2 assert export.path == "bucket" assert export.pseudo == "/rgw/bucket" assert export.access_type == "RW" assert export.squash == "all_squash" assert export.protocols == [4, 3] assert export.transports == ["TCP", "UDP"] assert export.fsal.name == "RGW" assert export.fsal.access_key_id == "the_access_key" assert export.fsal.secret_access_key == "the_secret_key" assert len(export.clients) == 1 assert export.clients[0].squash is None assert export.clients[0].access_type is None assert export.cluster_id == self.cluster_id # do it again, with changes r = conf.apply_export( self.cluster_id, json.dumps({ 'export_id': 2, 'path': 'newbucket', 'pseudo': '/rgw/bucket', 'cluster_id': self.cluster_id, 'access_type': 'RO', 'squash': 'root', 'security_label': False, 'protocols': [4], 'transports': ['TCP'], 'clients': [{ 'addresses': ["192.168.10.0/16"], 'access_type': None, 'squash': None }], 'fsal': { 'name': 'RGW', 'user_id': 'nfs.foo.newbucket', 'access_key_id': 'the_access_key', 'secret_access_key': 'the_secret_key', } })) assert r[0] == 0 export = conf._fetch_export('foo', '/rgw/bucket') assert export.export_id == 2 assert export.path == "newbucket" assert export.pseudo == "/rgw/bucket" assert export.access_type == "RO" assert export.squash == "root" assert export.protocols == [4] assert export.transports == ["TCP"] assert export.fsal.name == "RGW" assert export.fsal.access_key_id == "the_access_key" assert export.fsal.secret_access_key == "the_secret_key" assert len(export.clients) == 1 assert export.clients[0].squash is None assert export.clients[0].access_type is None assert export.cluster_id == self.cluster_id # again, but without export_id r = conf.apply_export( self.cluster_id, json.dumps({ 'path': 'newestbucket', 'pseudo': '/rgw/bucket', 'cluster_id': self.cluster_id, 'access_type': 'RW', 'squash': 'root', 'security_label': False, 'protocols': [4], 'transports': ['TCP'], 'clients': [{ 'addresses': ["192.168.10.0/16"], 'access_type': None, 'squash': None }], 'fsal': { 'name': 'RGW', 'user_id': 'nfs.foo.newestbucket', 'access_key_id': 'the_access_key', 'secret_access_key': 'the_secret_key', } })) assert r[0] == 0 export = conf._fetch_export(self.cluster_id, '/rgw/bucket') assert export.export_id == 2 assert export.path == "newestbucket" assert export.pseudo == "/rgw/bucket" assert export.access_type == "RW" assert export.squash == "root" assert export.protocols == [4] assert export.transports == ["TCP"] assert export.fsal.name == "RGW" assert export.fsal.access_key_id == "the_access_key" assert export.fsal.secret_access_key == "the_secret_key" assert len(export.clients) == 1 assert export.clients[0].squash is None assert export.clients[0].access_type is None assert export.cluster_id == self.cluster_id