Skip to content

Commit

Permalink
Merge "Refactor benchmark/context/quota.py"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Aug 13, 2014
2 parents 17a0e11 + 39a7857 commit 619e77f
Show file tree
Hide file tree
Showing 11 changed files with 434 additions and 328 deletions.
230 changes: 0 additions & 230 deletions rally/benchmark/context/quotas.py

This file was deleted.

Empty file.
50 changes: 50 additions & 0 deletions rally/benchmark/context/quotas/cinder_quotas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

from rally.openstack.common import log as logging


LOG = logging.getLogger(__name__)


class CinderQuotas(object):
"""Management of Cinder quotas."""

QUOTAS_SCHEMA = {
"type": "object",
"additionalProperties": False,
"properties": {
"gigabytes": {
"type": "integer",
"minimum": -1
},
"snapshots": {
"type": "integer",
"minimum": -1
},
"volumes": {
"type": "integer",
"minimum": -1
}
}
}

def __init__(self, clients):
self.clients = clients

def update(self, tenant_id, **kwargs):
self.clients.cinder().quotas.update(tenant_id, **kwargs)

def delete(self, tenant_id):
self.clients.cinder().quotas.delete(tenant_id)
68 changes: 68 additions & 0 deletions rally/benchmark/context/quotas/neutron_quotas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

from rally.openstack.common import log as logging


LOG = logging.getLogger(__name__)


class NeutronQuotas(object):
"""Management of Neutron quotas."""

QUOTAS_SCHEMA = {
"type": "object",
"additionalProperties": False,
"properties": {
"network": {
"type": "integer",
"minimum": -1
},
"subnet": {
"type": "integer",
"minimum": -1
},
"port": {
"type": "integer",
"minimum": -1
},
"router": {
"type": "integer",
"minimum": -1
},
"floatingip": {
"type": "integer",
"minimum": -1
},
"security_group": {
"type": "integer",
"minimum": -1
},
"security_group_rule": {
"type": "integer",
"minimum": -1
}
}
}

def __init__(self, clients):
self.clients = clients

def update(self, tenant_id, **kwargs):
body = {"quota": kwargs}
self.clients.neutron().update_quota(tenant_id, body=body)

def delete(self, tenant_id):
# Reset quotas to defaults and tag database objects as deleted
self.clients.neutron().delete_quota(tenant_id)
Loading

0 comments on commit 619e77f

Please sign in to comment.