]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rgw: add zone create command (based on rgwam)
authorYehuda Sadeh <yehuda@redhat.com>
Mon, 24 May 2021 23:58:29 +0000 (16:58 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 24 Nov 2021 20:54:29 +0000 (12:54 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/pybind/mgr/rgw/module.py

index 003dd8b7c88d5253cfe74f1925ff0c5f6246b34c..8563a474419dd50e760e2201b2ea5bc63fc3e229 100644 (file)
@@ -94,6 +94,24 @@ class Module(MgrModule):
 
         return HandleCommandResult(retval=retval, stdout=out, stderr=err)
 
+    @CLICommand('rgw zone create', perm='rw')
+    def _cmd_rgw_zone_create(self,
+                             realm_token : Optional[str] = None,
+                             zonegroup_name: Optional[str] = None,
+                             zone_name: Optional[str] = None,
+                             endpoints: Optional[str] = None,
+                             start_radosgw: Optional[bool] = False):
+        """Bootstrap new rgw zone that syncs with existing zone"""
+
+        try:
+            retval, out, err = RGWAM(self.ceph_common_args).zone_create(realm_token, zonegroup_name,
+                    zone_name, endpoints, start_radosgw)
+        except RGWAMException as e:
+            self.log.error('cmd run exception: (%d) %s' % (e.retcode, e.message))
+            return (e.retcode, e.message, e.stderr)
+
+        return HandleCommandResult(retval=retval, stdout=out, stderr=err)
+
     def shutdown(self) -> None:
         """
         This method is called by the mgr when the module needs to shut