|
- char token_id,tenant_id;
- web_add_header("Accept","application/json");
- web_add_header("Content-Type","application/json");
- web_add_header("User-Agent","python-novaclient");
- web_reg_save_param("token_id",
- "LB=\"id\": \"",
- "RB=\", \"tenant\"",
- LAST);
- web_reg_save_param("tenant_id",
- "LB=\"id\": \"",
- "RB=\"",
- "Ord=2",
- LAST);
- web_custom_request("get_token_id",
- "URL=http://25.0.0.2:5000/v2.0/tokens",
- "Method=POST",
- "Resource=0",
- "Referer=",
- "Mode=HTTP",
- "Body={\"auth\": {\"tenantName\":\"luolijun\",\"passwordCredentials\":{\"username\":\"luolijun\",\"password\":\"test1234\"}}}",
- LAST);
- web_add_header("User-Agent","ceilometerclient.openstack.common.apiclient");
- web_add_header("X-Auth-Token","{token_id}");
- web_custom_request("select_cpu_id",
- "URL=http://25.0.0.2:8777/v2/meters/cpu_util?q.field=project_id&q.op=eq&q.type=&q.value={tenant_id}&limit=1",
- "Method=GET",
- "Resource=0",
- "Referer=",
- "Mode=HTTP",
复制代码
|
|