hi,cepher

is it possible to set zonegroup and zone through admin rest api?
i can get and set the zonegroup and zone through radosgw-admin command like
the following :


[root@ceph04 src]# ./radosgw-admin zone get  --rgw-zone=us-east-2
#dump those to an file and inject after modify
2016-08-17 13:40:10.382984 7fad488bc9c0 -1 WARNING: the following dangerous
and experimental features are enabled: *
2016-08-17 13:40:10.384066 7fad488bc9c0 -1 WARNING: the following dangerous
and experimental features are enabled: *
2016-08-17 13:40:10.409597 7fad488bc9c0 -1 WARNING: the following dangerous
and experimental features are enabled: *
{
    "id": "c825c777-8e75-41a7-8e10-36fdc68d6d02",
    "name": "us-east-2",
    "domain_root": "us-east-2.rgw.data.root",
    "control_pool": "us-east-2.rgw.control",
    "gc_pool": "us-east-2.rgw.gc",
    "log_pool": "us-east-2.rgw.log",
    "intent_log_pool": "us-east-2.rgw.intent-log",
    "usage_log_pool": "us-east-2.rgw.usage",
    "user_keys_pool": "us-east-2.rgw.users.keys",
    "user_email_pool": "us-east-2.rgw.users.email",
    "user_swift_pool": "us-east-2.rgw.users.swift",
    "user_uid_pool": "us-east-2.rgw.users.uid",
    "system_key": {
        "access_key": "admin",
        "secret_key": "admin"
    },
    "placement_pools": [
        {
            "key": "beijing-placement",
            "val": {
                "index_pool": "us-east-2.rgw.buckets.index",
                "data_pool": "us-east-2.beijing",
                "data_extra_pool": "us-east-2.rgw.buckets.non-ec",
                "index_type": 0
            }
        },
        {
            "key": "default-placement",
            "val": {
                "index_pool": "us-east-2.rgw.buckets.index",
                "data_pool": "us-east-2.rgw.buckets.data",
                "data_extra_pool": "us-east-2.rgw.buckets.non-ec",
                "index_type": 0
            }
        },
        {
            "key": "shanghai-placement",
            "val": {
                "index_pool": "us-east-2.rgw.buckets.index",
                "data_pool": "us-east-2.shanghai",
                "data_extra_pool": "us-east-2.rgw.buckets.non-ec",
                "index_type": 0
            }
        },
        {
            "key": "suzhou-placement",
            "val": {
                "index_pool": "us-east-2.rgw.buckets.index",
                "data_pool": "us-east-2.suzhou",
                "data_extra_pool": "us-east-2.rgw.buckets.non-ec",
                "index_type": 0
            }
        }
    ],
    "metadata_heap": "us-east-2.rgw.meta",
    "realm_id": "d3ef8d11-5621-4e7a-b563-1348efe41a3c"
}


and

[root@ceph04 src]# ./radosgw-admin zonegroup get  --rgw-zonegroup=us     #dump
those to an file and inject after modify
2016-08-17 13:40:07.059401 7fb8ed67d9c0 -1 WARNING: the following dangerous
and experimental features are enabled: *
2016-08-17 13:40:07.060382 7fb8ed67d9c0 -1 WARNING: the following dangerous
and experimental features are enabled: *
2016-08-17 13:40:07.085429 7fb8ed67d9c0 -1 WARNING: the following dangerous
and experimental features are enabled: *
{
    "id": "0e78f19b-b64f-48c9-ac60-5a055f648264",
    "name": "us",
    "api_name": "us",
    "is_master": "true",
    "endpoints": [
        "http:\/\/10.254.3.81:8000"
    ],
    "hostnames": [],
    "hostnames_s3website": [],
    "master_zone": "c825c777-8e75-41a7-8e10-36fdc68d6d02",
    "zones": [
        {
            "id": "c825c777-8e75-41a7-8e10-36fdc68d6d02",
            "name": "us-east-2",
            "endpoints": [
                "http:\/\/10.254.3.81:8000"
            ],
            "log_meta": "true",
            "log_data": "false",
            "bucket_index_max_shards": 0,
            "read_only": "false"
        }
    ],
    "placement_targets": [
        {
            "name": "beijing-placement",
            "tags": []
        },
        {
            "name": "default-placement",
            "tags": []
        },
        {
            "name": "shanghai-placement",
            "tags": []
        },
        {
            "name": "suzhou-placement",
            "tags": []
        }
    ],
    "default_placement": "default-placement",
    "realm_id": "d3ef8d11-5621-4e7a-b563-1348efe41a3c"
}



is it possible to get and set those information though admin rest api?
i have a user have the zone caps *,so i can get the realm like Get some
usefull message though the following python code:

import requests
import logging
from requests_toolbelt.utils import dump
from aws_requests_auth.aws_auth import AWSRequestsAuth
from awsauth import S3Auth
logging.basicConfig(level=logging.DEBUG)
host = '10.254.3.81:8000'
access_key = 'admin'
secret_key = 'admin'
cmd = '/admin/config'
cmd = '/admin/realm/period'
url = 'http://%s%s' % (host,cmd)
# url = 'http://%s' % host
response = requests.get(url, auth=S3Auth(access_key,
secret_key,service_url=host))
data = dump.dump_all(response)
print(data.decode('utf-8'))


the out put of /admin/config

{"regions":[{"key":"0e78f19b-b64f-48c9-ac60-5a055f648264","val":{"id":"0e78f19b-b64f-48c9-ac60-5a055f648264","name":"us","api_name":"us","is_master":"true","endpoints":["http:\/\/10.254.3.81:8000"],"hostnames":[],"hostnames_s3website":[],"master_zone":"c825c777-8e75-41a7-8e10-36fdc68d6d02","zones":[{"id":"c825c777-8e75-41a7-8e10-36fdc68d6d02","name":"us-east-2","endpoints":["http:\/\/10.254.3.81:8000"],"log_meta":"true","log_data":"false","bucket_index_max_shards":0,"read_only":"false"}],"placement_targets":[{"name":"beijing-placement","tags":[]},{"name":"default-placement","tags":[]},{"name":"shanghai-placement","tags":[]},{"name":"suzhou-placement","tags":[]}],"default_placement":"default-placement","realm_id":"d3ef8d11-5621-4e7a-b563-1348efe41a3c"}}],"master_region":"0e78f19b-b64f-48c9-ac60-5a055f648264","bucket_quota":{"enabled":false,"max_size_kb":-1,"max_objects":-1},"user_quota":{"enabled":false,"max_size_kb":-1,"max_objects":-1}}

the out put of /admin/realm/period

{"id":"04b18559-323a-48f0-9ebc-c2a7dda0fabf","epoch":2,"predecessor_uuid":"c912f303-5e89-412a-a007-8ce0d9648f2e","sync_status":["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"period_map":{"id":"04b18559-323a-48f0-9ebc-c2a7dda0fabf","zonegroups":[{"id":"0e78f19b-b64f-48c9-ac60-5a055f648264","name":"us","api_name":"us","is_master":"true","endpoints":["http:\/\/10.254.3.81:8000"],"hostnames":[],"hostnames_s3website":[],"master_zone":"c825c777-8e75-41a7-8e10-36fdc68d6d02","zones":[{"id":"c825c777-8e75-41a7-8e10-36fdc68d6d02","name":"us-east-2","endpoints":["http:\/\/10.254.3.81:8000"],"log_meta":"true","log_data":"false","bucket_index_max_shards":0,"read_only":"false"}],"placement_targets":[{"name":"beijing-placement","tags":[]},{"name":"default-placement","tags":[]},{"name":"shanghai-placement","tags":[]},{"name":"suzhou-placement","tags":[]}],"default_placement":"default-placement","realm_id":"d3ef8d11-5621-4e7a-b563-1348efe41a3c"}],"short_zone_ids":[{"key":"c825c777-8e75-41a7-8e10-36fdc68d6d02","val":3879447014}]},"master_zonegroup":"0e78f19b-b64f-48c9-ac60-5a055f648264","master_zone":"c825c777-8e75-41a7-8e10-36fdc68d6d02","period_config":{"bucket_quota":{"enabled":false,"max_size_kb":-1,"max_objects":-1},"user_quota":{"enabled":false,"max_size_kb":-1,"max_objects":-1}},"realm_id":"d3ef8d11-5621-4e7a-b563-1348efe41a3c","realm_name":"gold","realm_epoch":2}


but how to get the zonegroup and zone ?what is the exactly http request url?
_______________________________________________
ceph-users mailing list
ceph-users@lists.ceph.com
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

Reply via email to