Commit 018ae30b authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Add opcode attribute for comments

This attribute allows programmatic submitters of jobs (e.g. iallocator)
to add a comment to each opcode, describing its purpose. Example:

$ gnt-job info 123
Job ID: 123
      Input fields:
        comment: Replaces disks on
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent 240c769f
......@@ -154,6 +154,9 @@ _SUMMARY_PREFIX = {
#: Attribute name for dependencies
DEPEND_ATTR = "depends"
#: Attribute name for comment
COMMENT_ATTR = "comment"
def _NameToId(name):
"""Convert an opcode class name to an OP_ID.
......@@ -448,6 +451,8 @@ class OpCode(BaseOpCode):
(DEPEND_ATTR, None, _BuildJobDepCheck(True),
"Job dependencies; if used through ``SubmitManyJobs`` relative (negative)"
" job IDs can be used"),
(COMMENT_ATTR, None, ht.TMaybeString,
"Comment describing the purpose of the opcode"),
def __getstate__(self):
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