Commit 307f458c authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Delete VM nics on update path

Delete VM nics when a message of type OP_INSTANCE_REMOVE has been received
from ganeti, and not when doing the RAPI call.
parent bab77516
......@@ -81,6 +81,7 @@ def process_op_status(vm, jobid, opcode, status, logmsg):
# Set the deleted flag explicitly, cater for admin-initiated removals
if opcode == 'OP_INSTANCE_REMOVE':
vm.deleted = True
# Special case: if OP_INSTANCE_CREATE fails --> ERROR
if status in ('canceled', 'error') and opcode == 'OP_INSTANCE_CREATE':
......@@ -93,6 +94,7 @@ def process_op_status(vm, jobid, opcode, status, logmsg):
if (status == 'error' and opcode == 'OP_INSTANCE_REMOVE' and
vm.operstate == 'ERROR'):
vm.deleted = True
# Any other notification of failure leaves the operating state unchanged
......@@ -279,7 +281,6 @@ def create_instance(vm, flavor, image, password, personality):
def delete_instance(vm):
start_action(vm, 'DESTROY')
rapi.DeleteInstance(vm.backend_id, dry_run=settings.TEST)
def reboot_instance(vm, reboot_type):
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