summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
Diffstat (limited to 'nova')
-rw-r--r--nova/compute/model.py3
-rw-r--r--nova/compute/network.py7
-rw-r--r--nova/datastore.py13
-rw-r--r--nova/volume/storage.py3
4 files changed, 12 insertions, 14 deletions
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
diff --git a/nova/datastore.py b/nova/datastore.py
index 405b40173..7d6e00823 100644
--- a/nova/datastore.py
+++ b/nova/datastore.py
@@ -387,13 +387,13 @@ class BasicModel(object):
@classmethod
def _redis_association_name(cls, foreign_type, foreign_id):
- return cls._redis_set_name("%s:%s:%s" %
+ return cls._redis_set_name("%s:%s:%s" %
(foreign_type, foreign_id, cls.__name__))
@property
def identifier(self):
"""You DEFINITELY want to define this in your subclass"""
- raise NotImplementedError("Your sublcass should define identifier")
+ raise NotImplementedError("Your subclass should define identifier")
@property
def __redis_key(self):
@@ -488,19 +488,14 @@ class BasicModel(object):
if self.is_new_record():
self["create_time"] = utils.isotime()
for key, val in self.state.iteritems():
- # if (not self.initial_state.has_key(key)
- # or self.initial_state[key] != val):
- Redis.instance().hset(self.__redis_key, key, val)
+ Redis.instance().hset(self.__redis_key, key, val)
self.add_to_index()
self.initial_state = self.state
return True
@absorb_connection_error
def destroy(self):
- """
- deletes all related records from datastore.
- does NOT do anything to running libvirt state.
- """
+ """deletes all related records from datastore."""
logging.info("Destroying datamodel for %s %s",
self.__class__.__name__, self.identifier)
Redis.instance().delete(self.__redis_key)
diff --git a/nova/volume/storage.py b/nova/volume/storage.py
index 4a92c3b38..491c891fd 100644
--- a/nova/volume/storage.py
+++ b/nova/volume/storage.py
@@ -41,7 +41,6 @@ from nova import exception
from nova import flags
from nova import utils
from nova import validate
-from nova.compute import model
FLAGS = flags.FLAGS
@@ -199,7 +198,7 @@ class Volume(datastore.BasicModel):
self['mountpoint'] = mountpoint
self['status'] = "in-use"
self['attach_status'] = "attaching"
- self['attach_time'] = utils.utctime()
+ self['attach_time'] = utils.isotime()
self['delete_on_termination'] = 'False'
self.save()