forked from openstack/rally
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created new directory context/quotas/ Moved to this directory quota.py module Saperated NovaQuotas, CinderQuotas, NeutronQuotas in separated files Similar process done for tests refactoring https://trello.com/c/ycDv6GD3 Change-Id: I322313d2817a071ab02a386b0fe0d397e3e3cdf0
- Loading branch information
Swapnil Kulkarni
committed
Aug 12, 2014
1 parent
c8d1fcb
commit 39a7857
Showing
11 changed files
with
434 additions
and
328 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Oops, something went wrong.