diff options
| author | Todd Willey <todd@rubidine.com> | 2010-06-29 01:20:43 -0400 |
|---|---|---|
| committer | Todd Willey <todd@rubidine.com> | 2010-06-29 01:20:43 -0400 |
| commit | c7f7e1bc4185be38ff792bfd82a74e35ecbeda12 (patch) | |
| tree | d9ee0685ee3dab90452823345edc96636f52cd50 | |
| parent | 3972cf90c2982ea906fe91c6ae461d3fab7c8958 (diff) | |
| download | nova-c7f7e1bc4185be38ff792bfd82a74e35ecbeda12.tar.gz nova-c7f7e1bc4185be38ff792bfd82a74e35ecbeda12.tar.xz nova-c7f7e1bc4185be38ff792bfd82a74e35ecbeda12.zip | |
We need to be able to look up Instance by Node (live migration).
| -rw-r--r-- | nova/compute/model.py | 5 |
1 files changed, 4 insertions, 1 deletions
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): |
