From 018ae30be7d2066cf12c20379104265cbbcef57b Mon Sep 17 00:00:00 2001 From: Michael Hanselmann Date: Fri, 22 Jul 2011 07:35:44 +0200 Subject: [PATCH] Add opcode attribute for comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 … Opcodes: OP_INSTANCE_REPLACE_DISKS … Input fields: comment: Replaces disks on inst1.example.com … Signed-off-by: Michael Hanselmann Reviewed-by: Iustin Pop --- lib/opcodes.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/opcodes.py b/lib/opcodes.py index e034546..8d50084 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -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): -- 1.7.10.4