]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fail when trying to commit period if no master zone configured
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 3 Feb 2016 20:29:08 +0000 (12:29 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 21:03:32 +0000 (13:03 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_admin.cc

index ce9711c016a2077f13ba9114d457562dfa842724..97a564c66695861e6073d541680cd5dbc7d4dbed 100644 (file)
@@ -1367,8 +1367,13 @@ static int commit_period(RGWRealm& realm, RGWPeriod& period,
                          const string& remote, const string& url,
                          const string& access, const string& secret)
 {
+  const string& master_zone = period.get_master_zone();
+  if (master_zone.empty()) {
+    cerr << "cannot commit period: period does not have a master zone of a master zonegroup" << std::endl;
+    return -EINVAL;
+  }
   // are we the period's master zone?
-  if (store->get_zone_params().get_id() == period.get_master_zone()) {
+  if (store->get_zone_params().get_id() == master_zone) {
     // read the current period
     RGWPeriod current_period;
     int ret = current_period.init(g_ceph_context, store, realm.get_id());