Commit d7677839 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Christos Stavrakakis
Browse files

Take advantage of ganeti hotplug



No race condition. No need for ther NetworkInterface to have an
operstate. Hook runs during instance-modify and depicts the currently
existing nics. No reboot needed modification to take place.

Later in mutliple backend mac prefix handling should be done by synnefo.
Due to hotplug we can release a mac prefix just after removing a network.
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
parent 307f458c
......@@ -389,7 +389,7 @@ def delete_network(net):
def connect_to_network(vm, net):
nic = {'mode': 'bridged', 'link': net.link.name}
rapi.ModifyInstance(vm.backend_id, nics=[('add', nic)],
dry_run=settings.TEST)
hotplug=True, dry_run=settings.TEST)
def disconnect_from_network(vm, net):
......@@ -397,7 +397,8 @@ def disconnect_from_network(vm, net):
ops = [('remove', nic.index, {}) for nic in nics if nic.network == net]
if not ops: # Vm not connected to network
return
rapi.ModifyInstance(vm.backend_id, nics=ops[::-1], dry_run=settings.TEST)
rapi.ModifyInstance(vm.backend_id, nics=ops[::-1],
hotplug=True, dry_run=settings.TEST)
def set_firewall_profile(vm, profile):
......
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