summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-11-29 16:28:35 +0000
committerGerrit Code Review <review@openstack.org>2012-11-29 16:28:35 +0000
commitbdca36efe00df2da9441d037cb970ded118b9225 (patch)
treefeac683288c334dacbf34349eaec93c48085af9c /nova/compute
parent4b24907b679f26d976435e2dfb307db8fcfadc29 (diff)
parent4e6bae7a00a1a5768a20f54f484299d7396123d5 (diff)
downloadnova-bdca36efe00df2da9441d037cb970ded118b9225.tar.gz
nova-bdca36efe00df2da9441d037cb970ded118b9225.tar.xz
nova-bdca36efe00df2da9441d037cb970ded118b9225.zip
Merge "Access DB values as dict not as attributes"
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 79db499bd..e377b0e32 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -2152,7 +2152,7 @@ class AggregateAPI(base.Base):
def create_aggregate(self, context, aggregate_name, availability_zone):
"""Creates the model for the aggregate."""
- zones = [s.availability_zone for s in
+ zones = [s['availability_zone'] for s in
self.db.service_get_all_by_topic(context,
CONF.compute_topic)]
if availability_zone in zones:
@@ -2214,7 +2214,7 @@ class AggregateAPI(base.Base):
# validates the host; ComputeHostNotFound is raised if invalid
service = self.db.service_get_all_compute_by_host(context, host)[0]
aggregate = self.db.aggregate_get(context, aggregate_id)
- if service.availability_zone != aggregate.availability_zone:
+ if service['availability_zone'] != aggregate['availability_zone']:
raise exception.InvalidAggregateAction(
action='add host',
aggregate_id=aggregate_id,
@@ -2237,8 +2237,8 @@ class AggregateAPI(base.Base):
def _get_aggregate_info(self, context, aggregate):
"""Builds a dictionary with aggregate props, metadata and hosts."""
- metadata = self.db.aggregate_metadata_get(context, aggregate.id)
- hosts = self.db.aggregate_host_get_all(context, aggregate.id)
+ metadata = self.db.aggregate_metadata_get(context, aggregate['id'])
+ hosts = self.db.aggregate_host_get_all(context, aggregate['id'])
result = dict(aggregate.iteritems())
# metadetails was not originally included here. We need to pull it
# back out to maintain API stability.
@@ -2473,7 +2473,7 @@ class SecurityGroupAPI(base.Base):
return groups
def destroy(self, context, security_group):
- if self.db.security_group_in_use(context, security_group.id):
+ if self.db.security_group_in_use(context, security_group['id']):
msg = _("Security group is still in use")
self.raise_invalid_group(msg)
@@ -2485,12 +2485,12 @@ class SecurityGroupAPI(base.Base):
LOG.exception(_("Failed to update usages deallocating "
"security group"))
- LOG.audit(_("Delete security group %s"), security_group.name,
+ LOG.audit(_("Delete security group %s"), security_group['name'],
context=context)
- self.db.security_group_destroy(context, security_group.id)
+ self.db.security_group_destroy(context, security_group['id'])
self.sgh.trigger_security_group_destroy_refresh(context,
- security_group.id)
+ security_group['id'])
# Commit the reservations
if reservations:
@@ -2726,7 +2726,7 @@ class SecurityGroupAPI(base.Base):
"""Indicates whether the specified rule values are already
defined in the given security group.
"""
- for rule in security_group.rules:
+ for rule in security_group['rules']:
is_duplicate = True
keys = ('group_id', 'cidr', 'from_port', 'to_port', 'protocol')
for key in keys: