From c7f7e1bc4185be38ff792bfd82a74e35ecbeda12 Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Tue, 29 Jun 2010 01:20:43 -0400 Subject: We need to be able to look up Instance by Node (live migration). --- nova/compute/model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nova/compute/model.py b/nova/compute/model.py index 4cd851088..ad1f97a0a 100644 --- a/nova/compute/model.py +++ b/nova/compute/model.py @@ -349,12 +349,15 @@ class Instance(BasicModel): def save(self): """Call into superclass to save object, then save associations""" - # NOTE(todd): doesn't track migration between projects, + # NOTE(todd): doesn't track migration between projects/nodes, # it just adds the first one should_update_project = self.is_new_record() + should_update_node = self.is_new_record() success = super(Instance, self).save() if success and should_update_project: self.associate_with("project", self.project) + if success and should_update_node: + self.associate_with("node", self['node_name']) return True def destroy(self): -- cgit