Update the nics.hostname field to keep it in sync with machine.name
authorEvan Broder <broder@mit.edu>
Tue, 13 Jan 2009 20:54:46 +0000 (15:54 -0500)
committerEvan Broder <broder@mit.edu>
Tue, 13 Jan 2009 20:54:46 +0000 (15:54 -0500)
when VMs are renamed.

svn path=/trunk/packages/invirt-web/; revision=1977

code/main.py

index 908d7cd..d9cc14c 100755 (executable)
@@ -379,6 +379,9 @@ def modifyDict(username, state, fields):
             update_acl = True
         if hasattr(validate, 'name'):
             machine.name = validate.name
+            for n in machine.nics:
+                if n.hostname == oldname:
+                    n.hostname = validate.name
         if hasattr(validate, 'description'):
             machine.description = validate.description
         if hasattr(validate, 'admin') and validate.admin != machine.administrator: