python-gnocchiclient 2.1.0 release

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJWXcIoAAoJEBiStC/OquvIHIAP/jYUSVfm3Ta+C+adnKeTanDp
 Lac/wloBN2q3JvUfmrYZ54gNi7F/9y5Mm9VThqY7GHPQ50VbMrOmkBs7kpCn1z8J
 oPq5DPTmoKxtWl+S9PlVgnindM8Ilcmq9AjjYeb6ulOqxv8eVlDztf8tc+5L9WIJ
 Gh4fPgO/XYQq6MrgKZJI0ysEWPPaEMQR9bR5tq/tx2YnPIpPr3Euzn+Ek033nEa+
 Y54yntMjzna5rPrpq8+Se0JcZppniMQxUBAM32LAH3pWJipBUEf5QoG+tflIbIMK
 m3OP8LPiPicVgvEg0QQ788SEs71UcseyHN19Szr1VNaNqDyJ0vCE2z39uL+ngKSQ
 BjkaQn/OBewVXSf+yq+NTu6GvOSz43jovLzoQrZqxPi0v5LlDnY+gHz3RCg4Ms2N
 qcE6JmPpw9114oRbxnedi+AUwbhsvsnerHNc/rmqOVxG7RvWSITopmDKRh6kJCxA
 hmaOA+bhdQryg65rf85aiEgOEggd0ACAMun7bQ60xFUmm/arQ+yVPvsMH4uI1XMi
 FLAVscgQQwcAMBnCLNpnG0kzDRqYcZJ9EIuAP/VPQhrbBZyQH5qXT5GSjVvBqjqO
 6qXBVXAiq1VfzsRG72Ges8jatXECBU26d/6N2Tx55sYcVf3mYHLImqsW7UgM0GpV
 X+lwEBJ1OCi8VuAadIIG
 =JeCv
 -----END PGP SIGNATURE-----

Merge tag '2.1.0' into debian/mitaka

python-gnocchiclient 2.1.0 release
This commit is contained in:
Thomas Goirand 2016-01-21 16:42:21 +00:00
commit 01d082edb2
6 changed files with 18 additions and 10 deletions

View File

@ -66,12 +66,12 @@ Examples
Create a resource::
gnocchi resource create instance --attribute id:5a301761-f78b-46e2-8900-8b4f6fe6675a --attribute project_id:eba5c38f-c3dd-4d9c-9235-32d430471f94 --metric temperature:high
gnocchi resource create --attribute id:5a301761-f78b-46e2-8900-8b4f6fe6675a --attribute project_id:eba5c38f-c3dd-4d9c-9235-32d430471f94 -n temperature:high instance
List resources::
gnocchi resource list instance
gnocchi resource list --type instance
Search of resources::
gnocchi resource search -q "project_id=5a301761-f78b-46e2-8900-8b4f6fe6675a and not (name like '%foobar%' or name='my_resource')"
gnocchi resource search --query "project_id=5a301761-f78b-46e2-8900-8b4f6fe6675a and type=instance"

View File

@ -211,6 +211,7 @@ class MetricClientTest(base.ClientTestBase):
result = self.gnocchi(
'measures', params=("--debug aggregation "
"--query \"id='metric-res'\" "
"--resource-type \"generic\" "
"-m metric-name "
"--aggregation mean "
"--needed-overlap 0 "

View File

@ -158,7 +158,7 @@ class MetricManager(base.Manager):
def aggregation(self, metrics, query=None,
start=None, stop=None, aggregation=None,
needed_overlap=None):
needed_overlap=None, resource_type="generic"):
"""Get measurements of a aggregated metrics
:param metrics: IDs of metric or metric name
@ -171,6 +171,8 @@ class MetricManager(base.Manager):
:type stop: timestamp
:param aggregation: aggregation to retrieve
:type aggregation: str
:param resource_type: type of resource for the query
:type resource_type: str
See Gnocchi REST API documentation for the format
of *query dictionary*
@ -192,7 +194,8 @@ class MetricManager(base.Manager):
params=params).json()
else:
return self._post(
"v1/aggregation/resource/generic/metric/%s?%s" % (
metrics, utils.dict_to_querystring(params)),
"v1/aggregation/resource/%s/metric/%s?%s" % (
resource_type, metrics,
utils.dict_to_querystring(params)),
headers={'Content-Type': "application/json"},
data=jsonutils.dumps(query)).json()

View File

@ -183,6 +183,8 @@ class CliMeasuresAggregation(lister.Lister):
help=("percent of datapoints in each "
"metrics required"))
parser.add_argument("--query", help="Query"),
parser.add_argument("--resource-type", default="generic",
help="Resource type to query"),
return parser
def take_action(self, parsed_args):
@ -200,5 +202,6 @@ class CliMeasuresAggregation(lister.Lister):
start=parsed_args.start,
stop=parsed_args.stop,
needed_overlap=parsed_args.needed_overlap,
resource_type=parsed_args.resource_type,
)
return self.COLS, measures

View File

@ -31,7 +31,7 @@ def _get_pagination_options(details=False, history=False,
for sort in sorts or []:
options.append("sort=%s" % urllib_parse.quote(sort))
if options:
return "?%s" % "&".join(options)
return "%s" % "&".join(options)
else:
return ""
@ -58,7 +58,8 @@ class ResourceManager(base.Manager):
:type sorts: list of str
"""
qs = _get_pagination_options(details, history, limit, marker, sorts)
return self._get(self.url + resource_type + qs).json()
url = "%s%s?%s" % (self.url, resource_type, qs)
return self._get(url).json()
def get(self, resource_type, resource_id, history=False):
"""Get a resource
@ -159,7 +160,7 @@ class ResourceManager(base.Manager):
"""
query = query or {}
qs = _get_pagination_options(details, False, limit, marker, sorts)
qs = _get_pagination_options(details, history, limit, marker, sorts)
url = "v1/search/resource/%s?%s" % (resource_type, qs)
return self._post(
url, headers={'Content-Type': "application/json"},

View File

@ -49,7 +49,7 @@ pipeline = gnocchi
[app:gnocchi]
paste.app_factory = gnocchi.rest.app:app_factory
EOF
gnocchi-dbsync --config-file ${GNOCCHI_DATA}/gnocchi.conf
gnocchi-upgrade --config-file ${GNOCCHI_DATA}/gnocchi.conf
gnocchi-metricd --config-file ${GNOCCHI_DATA}/gnocchi.conf &>/dev/null &
gnocchi-api --config-file ${GNOCCHI_DATA}/gnocchi.conf &> ${GNOCCHI_DATA}/out &
# Wait for Gnocchi to start