From b0b2d607b4f2db8ffbb5d091c4a3cd33ea6ed672 Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Wed, 14 Jul 2010 23:34:10 -0400 Subject: Cleanups related to BasicModel (whitespace, names, etc). --- nova/compute/model.py | 3 +-- nova/compute/network.py | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/model.py b/nova/compute/model.py index 5d4b0879e..cc5f74b3d 100644 --- a/nova/compute/model.py +++ b/nova/compute/model.py @@ -225,8 +225,7 @@ class Daemon(datastore.BasicModel): def heartbeat(self): self['updated_at'] = utils.isotime() - self.save() - return True + return self.save() @classmethod def by_host(cls, hostname): diff --git a/nova/compute/network.py b/nova/compute/network.py index 15635d707..b2458828e 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -119,7 +119,7 @@ class Vlan(datastore.BasicModel): def save(self): """ Vlan saves state into a giant hash named "vlans", with keys of - proejct_id and value of valn number. Therefore, we skip the + project_id and value of vlan number. Therefore, we skip the default way of saving into "vlan:ID" and adding to a set of "vlans". """ set_name = self._redis_set_name(self.__class__.__name__) @@ -134,6 +134,7 @@ class Vlan(datastore.BasicModel): vlan = int(self.vlan_id) network = IPy.IP(FLAGS.private_range) start = (vlan-FLAGS.vlan_start) * FLAGS.network_size + # minus one for the gateway. return "%s-%s" % (network[start], network[start + FLAGS.network_size - 1]) @@ -504,6 +505,10 @@ def get_vlan_for_project(project_id): # sexier if it didn't fight against the way # BasicModel worked and used associate_with # to build connections to projects. + # NOTE(josh): This is here because we want to make sure we + # don't orphan any VLANs. It is basically + # garbage collection for after projects abandoned + # their reference. vlan.project_id = project_id vlan.save() return vlan -- cgit