Commit 1bce4de3 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Delete stale NICs before migration

Extend migration file to delete NICs that belong to VMs that have
already been deleted. Such NICs may exist due to a bug in previous versions
of Synnefo, and are totally useless. Also, they must be removed because
they will appear as stale ports in the new network API.
parent 87987d11
......@@ -9,6 +9,8 @@ class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# Note: Remember to use orm['appname.ModelName'] rather than "from appname.models..."
# Delete stale NICs
orm.NetworkInterface.objects.filter(machine__deleted=True).delete()
for nic in orm.NetworkInterface.objects.all():
userid = nic.machine.userid
nic.userid = userid
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment