Skip to content

Commit

Permalink
mgr/dashboard: manage flow and pipes apis
Browse files Browse the repository at this point in the history
Fixes: https://tracker.ceph.com/issues/66238
Signed-off-by: Nizamudeen A <[email protected]>
  • Loading branch information
nizamial09 committed May 28, 2024
1 parent 73a7602 commit 73db54b
Show file tree
Hide file tree
Showing 3 changed files with 594 additions and 22 deletions.
63 changes: 55 additions & 8 deletions src/pybind/mgr/dashboard/controllers/rgw.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
from ..security import Permission, Scope
from ..services.auth import AuthManager, JwtManager
from ..services.ceph_service import CephService
from ..services.rgw_client import NoRgwDaemonsException, RgwClient, RgwMultisite, \
SyncStatus
from ..services.rgw_client import NoRgwDaemonsException, RgwClient, RgwMultisite
from ..tools import json_str_to_object, str_to_bool
from . import APIDoc, APIRouter, BaseController, CreatePermission, \
CRUDCollectionMethod, CRUDEndpoint, Endpoint, EndpointDoc, ReadPermission, \
RESTController, UIRouter, UpdatePermission, allow_empty_body, DeletePermission
CRUDCollectionMethod, CRUDEndpoint, DeletePermission, Endpoint, \
EndpointDoc, ReadPermission, RESTController, UIRouter, UpdatePermission, \
allow_empty_body
from ._crud import CRUDMeta, Form, FormField, FormTaskInfo, Icon, MethodType, \
TableAction, Validator, VerticalContainer
from ._version import APIVersion
Expand Down Expand Up @@ -118,6 +118,7 @@ def migrate(self, daemon_name=None, realm_name=None, zonegroup_name=None, zone_n
class RgwMultisiteController(RESTController):
@Endpoint(path='/sync_status')
@EndpointDoc("Get the sync status")
@ReadPermission
@allow_empty_body
# pylint: disable=W0102,W0613
def get_sync_status(self):
Expand All @@ -128,9 +129,9 @@ def get_sync_status(self):
@Endpoint(path='/sync-policy')
@EndpointDoc("Get the sync policy")
@ReadPermission
def get_sync_policy(self, bucket_name = ''):
def get_sync_policy(self, bucket_name='', zonegroup_name=''):
multisite_instance = RgwMultisite()
return multisite_instance.get_sync_policy(bucket_name)
return multisite_instance.get_sync_policy(bucket_name, zonegroup_name)

@Endpoint(path='/sync-policy-group')
@EndpointDoc("Get the sync policy group")
Expand All @@ -142,14 +143,14 @@ def get_sync_policy_group(self, group_id: str, bucket_name=''):
@Endpoint(method='POST', path='/sync-policy-group')
@EndpointDoc("Create the sync policy group")
@CreatePermission
def create_sync_policy_group(self, group_id: str, status: SyncStatus, bucket_name=''):
def create_sync_policy_group(self, group_id: str, status: str, bucket_name=''):
multisite_instance = RgwMultisite()
return multisite_instance.create_sync_policy_group(group_id, status, bucket_name)

@Endpoint(method='PUT', path='/sync-policy-group')
@EndpointDoc("Update the sync policy group")
@UpdatePermission
def update_sync_policy_group(self, group_id: str, status: SyncStatus, bucket_name=''):
def update_sync_policy_group(self, group_id: str, status: str, bucket_name=''):
multisite_instance = RgwMultisite()
return multisite_instance.update_sync_policy_group(group_id, status, bucket_name)

Expand All @@ -160,6 +161,52 @@ def remove_sync_policy_group(self, group_id: str, bucket_name=''):
multisite_instance = RgwMultisite()
return multisite_instance.remove_sync_policy_group(group_id, bucket_name)

@Endpoint(method='PUT', path='/sync-flow')
@EndpointDoc("Create or update the sync flow")
@CreatePermission
def create_sync_flow(self, flow_id: str, flow_type: str, group_id: str,
source_zone='', destination_zone='', zones: Optional[List[str]] = None,
bucket_name=''):
multisite_instance = RgwMultisite()
return multisite_instance.create_sync_flow(group_id, flow_id, flow_type, zones,
bucket_name, source_zone, destination_zone)

@Endpoint(method='DELETE', path='/sync-flow')
@EndpointDoc("Remove the sync flow")
@DeletePermission
def remove_sync_flow(self, flow_id: str, flow_type: str, group_id: str,
source_zone='', destination_zone='', zones: Optional[List[str]] = None,
bucket_name=''):
multisite_instance = RgwMultisite()
return multisite_instance.remove_sync_flow(group_id, flow_id, flow_type, source_zone,
destination_zone, zones, bucket_name)

@Endpoint(method='PUT', path='/sync-pipe')
@EndpointDoc("Create or update the sync pipe")
@CreatePermission
def create_sync_pipe(self, group_id: str, pipe_id: str,
source_zones: Optional[List[str]] = None,
destination_zones: Optional[List[str]] = None,
destination_buckets: Optional[List[str]] = None,
bucket_name: str = ''):
multisite_instance = RgwMultisite()
return multisite_instance.create_sync_pipe(group_id, pipe_id, source_zones,
destination_zones, destination_buckets,
bucket_name)

@Endpoint(method='DELETE', path='/sync-pipe')
@EndpointDoc("Remove the sync pipe")
@DeletePermission
def remove_sync_pipe(self, group_id: str, pipe_id: str,
source_zones: Optional[List[str]] = None,
destination_zones: Optional[List[str]] = None,
destination_buckets: Optional[List[str]] = None,
bucket_name: str = ''):
multisite_instance = RgwMultisite()
return multisite_instance.remove_sync_pipe(group_id, pipe_id, source_zones,
destination_zones, destination_buckets,
bucket_name)


@APIRouter('/rgw/daemon', Scope.RGW)
@APIDoc("RGW Daemon Management API", "RgwDaemon")
Expand Down
Loading

0 comments on commit 73db54b

Please sign in to comment.