コード例 #1
0
    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)
コード例 #2
0
 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)
コード例 #3
0
ファイル: cephfs_native.py プロジェクト: ponychou/manila
 def _share_path(self, share):
     """Get VolumePath from Share."""
     return ceph_volume_client.VolumePath(
         share['consistency_group_id'], share['id'])
コード例 #4
0
ファイル: driver.py プロジェクト: vast-data/manila
def cephfs_share_path(share):
    """Get VolumePath from Share."""
    return ceph_volume_client.VolumePath(share['share_group_id'], share['id'])
コード例 #5
0
 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)
コード例 #6
0
 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)