Commit cd43c8bd by Guba Sándor

instance/node: fixed monitoring for missin vms

parent e056cb01
...@@ -286,8 +286,13 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel): ...@@ -286,8 +286,13 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
def vm_state_changed(self, new_state): def vm_state_changed(self, new_state):
try: try:
act = InstanceActivity.create(code_suffix='vm_state_changed', act = InstanceActivity.create(
instance=self) code_suffix='monitor_event_%s' % new_state,
if new_state == "STOPPED":
self.vnc_port = None
self.node = None
except ActivityInProgressError: except ActivityInProgressError:
pass # discard state change if another activity is in progress. pass # discard state change if another activity is in progress.
else: else:
...@@ -194,6 +194,8 @@ class Node(TimeStampedModel): ...@@ -194,6 +194,8 @@ class Node(TimeStampedModel):
except KeyError: except KeyError:'Node %s update: instance %s missing from ''Node %s update: instance %s missing from '
'libvirt', self, i['id']) 'libvirt', self, i['id'])
# Set state to STOPPED when instance is missing
else: else:
if d != i['state']: if d != i['state']:'Node %s update: instance %s state changed ''Node %s update: instance %s state changed '
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 sign in to comment