def create_share(self, path, user_id, size=None): """Create a CephFS volume. """ volume_path = ceph_volume_client.VolumePath(self.volume_group, path) # Create the CephFS volume volume = self.volume_client.create_volume(volume_path, size=size) # To mount this you need to know the mon IPs and the path to the volume mon_addrs = self.volume_client.get_mon_addrs() export_location = "{addrs}:{path}".format( addrs=",".join(mon_addrs), path=volume['mount_path']) """TODO restrict to user_id """ auth_result = self._authorize_ceph(volume_path, user_id, False) ret = { 'path': export_location, 'user': auth_result['entity'], 'auth': auth_result['key'] } return json.dumps(ret)
def delete_share(self, path, user_id): volume_path = ceph_volume_client.VolumePath(VOlUME_GROUP, path) self.volume_client._deauthorize(volume_path, user_id) # Remove the user if it's a dynamic created user if user_id.startswith('kubernetes-dynamic-user-'): self._remove_ceph_user(user_id) self.volume_client.delete_volume(volume_path) self.volume_client.purge_volume(volume_path)
def _share_path(self, share): """Get VolumePath from Share.""" return ceph_volume_client.VolumePath( share['consistency_group_id'], share['id'])
def cephfs_share_path(share): """Get VolumePath from Share.""" return ceph_volume_client.VolumePath(share['share_group_id'], share['id'])
def delete_share(self, path, user_id): volume_path = ceph_volume_client.VolumePath(self.volume_group, path) self._deauthorize(volume_path, user_id) self.volume_client.delete_volume(volume_path) self.volume_client.purge_volume(volume_path)
def delete_share(self, path, user_id): volume_path = ceph_volume_client.VolumePath(VOlUME_GROUP, path) self.volume_client._deauthorize(volume_path, user_id) self.volume_client.delete_volume(volume_path) self.volume_client.purge_volume(volume_path)