scripts: qmp-shell: add transaction subshell
authorJohn Snow <jsnow@redhat.com>
Wed, 29 Apr 2015 19:14:03 +0000 (15:14 -0400)
committerLuiz Capitulino <lcapitulino@redhat.com>
Mon, 11 May 2015 12:59:07 +0000 (08:59 -0400)
commit30bd6815efbaf5bae70885feac9a35e149e2f1ad
tree0bb09ee67fe09bc4d31d0032b89e1c9166e666de
parent6092c3ecc4bdafee5bf07061be78a4a2cc5a5088
scripts: qmp-shell: add transaction subshell

Add a special processing mode to craft transactions.

By entering "transaction(" the shell will enter a special
mode where each subsequent command will be saved as a transaction
instead of executed as an individual command.

The transaction can be submitted by entering ")" on a line by itself.

Examples:

Separate lines:

(QEMU) transaction(
TRANS> block-dirty-bitmap-add node=drive0 name=bitmap1
TRANS> block-dirty-bitmap-clear node=drive0 name=bitmap0
TRANS> )

With a transaction action included on the first line:

(QEMU) transaction( block-dirty-bitmap-add node=drive0 name=bitmap2
TRANS> block-dirty-bitmap-add node=drive0 name=bitmap3
TRANS> )

As a one-liner, with just one transaction action:

(QEMU) transaction( block-dirty-bitmap-add node=drive0 name=bitmap0 )

As a side-effect of this patch, blank lines are now parsed as no-ops,
regardless of which shell mode you are in.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
scripts/qmp/qmp-shell