Commit 4bba41b1 authored by Vangelis Koukis's avatar Vangelis Koukis
Browse files

Ignore uknown Ganeti opcodes in dispatcher

Have the backend notification handler ignore unknown Ganeti opcodes,
such as OP_INSTANCE_QUERY_DATA and OP_INSTANCE_SET_PARAMS.
parent c24971e4
......@@ -188,7 +188,12 @@ class VirtualMachine(models.Model):
('OP_INSTANCE_REMOVE', 'Remove Instance'),
('OP_INSTANCE_STARTUP', 'Startup Instance'),
('OP_INSTANCE_SHUTDOWN', 'Shutdown Instance'),
('OP_INSTANCE_REBOOT', 'Reboot Instance')
('OP_INSTANCE_REBOOT', 'Reboot Instance'),
# These are listed here for completeness,
# and are ignored for the time being
('OP_INSTANCE_SET_PARAMS', 'Set Instance Parameters'),
('OP_INSTANCE_QUERY_DATA', 'Query Instance Data'),
)
# A backend job may be in one of the following possible states
BACKEND_STATUSES = (
......@@ -208,7 +213,9 @@ class VirtualMachine(models.Model):
'OP_INSTANCE_REMOVE': 'DESTROYED',
'OP_INSTANCE_STARTUP': 'STARTED',
'OP_INSTANCE_SHUTDOWN': 'STOPPED',
'OP_INSTANCE_REBOOT': 'STARTED'
'OP_INSTANCE_REBOOT': 'STARTED',
'OP_INSTANCE_SET_PARAMS': None,
'OP_INSTANCE_QUERY_DATA': None
}
# This dictionary contains the correspondence between
......
......@@ -31,7 +31,7 @@ def process_op_status(vm, jobid, opcode, status, logmsg):
vm.backendlogmsg = logmsg
# Notifications of success change the operating state
if status == 'success':
if status == 'success' and VirtualMachine.OPER_STATE_FROM_OPCODE is not None:
utils.update_state(vm, VirtualMachine.OPER_STATE_FROM_OPCODE[opcode])
# Set the deleted flag explicitly, to cater for admin-initiated removals
if opcode == 'OP_INSTANCE_REMOVE':
......
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