]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Add "--bucket-new-name" option to radosgw-admin.
authorMarcus Watts <mwatts@redhat.com>
Sat, 4 Aug 2018 04:42:38 +0000 (00:42 -0400)
committerShilpa Jagannath <smanjara@redhat.com>
Tue, 30 Jul 2019 08:30:45 +0000 (14:00 +0530)
This just adds the command line option and related bits.

Underlying functionality will be a later commit.

Fixes: http://tracker.ceph.com/issues/35885
Signed-off-by: Marcus Watts <mwatts@redhat.com>
doc/man/8/radosgw-admin.rst
src/rgw/rgw_admin.cc
src/rgw/rgw_bucket.h
src/test/cli/radosgw-admin/help.t

index 136c8a96b355730bbde2203ee2c2aeb43c8023c8..a9a1e2f7ebcbebda7baf2a938dd139f04a11bf12 100644 (file)
@@ -546,6 +546,12 @@ Options
 
    Specify the bucket id.
 
+.. option:: --bucket-new-name=[tenant-id/]<bucket>
+
+   Optional for `bucket link`; use to rename a bucket.
+        When using implicit tenants, prefix the name
+        with the desired tenant-id.
+
 .. option:: --shard-id=<shard-id>
 
        Optional for mdlog list, data sync status. Required for ``mdlog trim``.
index fd38b4af4e90b95a2d0cd55cc9434bc84508326d..384b3549e9f540f1e0deec97f48f37ae32e37ecf 100644 (file)
@@ -265,6 +265,8 @@ void usage()
   cout << "   --start-date=<date>       start date in the format yyyy-mm-dd\n";
   cout << "   --end-date=<date>         end date in the format yyyy-mm-dd\n";
   cout << "   --bucket-id=<bucket-id>   bucket id\n";
+  cout << "   --bucket-new-name=<bucket>\n";
+  cout << "                             for bucket link: optional new name\n";
   cout << "   --shard-id=<shard-id>     optional for: \n";
   cout << "                               mdlog list\n";
   cout << "                               data sync status\n";
@@ -2784,6 +2786,7 @@ int main(int argc, const char **argv)
   bool set_temp_url_key = false;
   map<int, string> temp_url_keys;
   string bucket_id;
+  string new_bucket_name;
   Formatter *formatter = NULL;
   int purge_data = false;
   int pretty_format = false;
@@ -3044,6 +3047,8 @@ int main(int argc, const char **argv)
         cerr << "bad bucket-id" << std::endl;
         exit(1);
       }
+    } else if (ceph_argparse_witharg(args, i, &val, "--bucket-new-name", (char*)NULL)) {
+      new_bucket_name = val;
     } else if (ceph_argparse_witharg(args, i, &val, "--format", (char*)NULL)) {
       format = val;
     } else if (ceph_argparse_witharg(args, i, &val, "--categories", (char*)NULL)) {
@@ -5529,6 +5534,7 @@ int main(int argc, const char **argv)
 
   if (opt_cmd == OPT_BUCKET_LINK) {
     bucket_op.set_bucket_id(bucket_id);
+    bucket_op.set_new_bucket_name(new_bucket_name);
     string err;
     int r = RGWBucketAdminOp::link(store, bucket_op, &err);
     if (r < 0) {
index 9e7dce4e595b86d1e446c657ed25d722e42978c6..3892a76e70ff3a22fa1edd8a063dd0943bf4020e 100644 (file)
@@ -227,6 +227,7 @@ struct RGWBucketAdminOpState {
   std::string bucket_name;
   std::string bucket_id;
   std::string object_name;
+  std::string new_bucket_name;
 
   bool list_buckets;
   bool stat_buckets;
@@ -257,6 +258,9 @@ struct RGWBucketAdminOpState {
   void set_object(std::string& object_str) {
     object_name = object_str;
   }
+  void set_new_bucket_name(std::string& new_bucket_str) {
+    new_bucket_name = new_bucket_str;
+  }
   void set_quota(RGWQuotaInfo& value) {
     quota = value;
   }
index b1fddccc865ad6480b80b57f18e856be88f0dc0e..cb8f46ca468438908b0bc0003f6073544d1b6ce5 100644 (file)
      --start-date=<date>       start date in the format yyyy-mm-dd
      --end-date=<date>         end date in the format yyyy-mm-dd
      --bucket-id=<bucket-id>   bucket id
+     --bucket-new-name=<bucket>
+                               for bucket link: optional new name
      --shard-id=<shard-id>     optional for: 
                                  mdlog list
                                  data sync status