Commit 312f51f0 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

gtools: Fix Ganeti allocation parameters

When retrying a failed job, remove 'pnode' and 'snode' fields if they
were implicitly set by Ganeti iallocator. Ganeti will fail if both
iallocator and node are specified in the job.
parent 89c6928d
......@@ -188,6 +188,11 @@ def update_db(vm, msg, event_time):
# Remove extra fields
[job_fields.pop(f) for f in ("OP_ID", "reason")]
# Remove 'pnode' and 'snode' if they were set by Ganeti iallocator.
# Ganeti will fail if both allocator and nodes are specified.
allocator = job_fields.pop("iallocator")
if allocator is not None:
[job_fields.pop(f) for f in ("pnode", "snode")]
name = job_fields.pop("name", job_fields.pop("instance_name"))
# Turn off opportunistic locking before retrying the job
job_fields["opportunistic_locking"] = False
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