Re: [Qemu-devel] [PATCH v4 0/4] scripts: qmp-shell: add transaction support

2015-05-08 Thread Luiz Capitulino
On Wed, 29 Apr 2015 15:14:00 -0400
John Snow  wrote:

> The qmp-shell is a little rudimentary, but it can be hacked
> to give us some transactional support without too much difficulty.
> 
> (1) Prep.
> (2) Add support for serializing json arrays and
> improve the robustness of QMP parsing
> (3) Add a special transaction( ... ) syntax that lets users
> build up transactional commands using the existing qmp shell
> syntax to define each action.
> (4) Add a verbose flag to display generated QMP commands.
> 
> The parsing is not as robust as one would like, but this suffices
> without adding a proper parser.
> 
> Design considerations:
> 
> (1) Try not to disrupt the existing design of the qmp-shell. The existing
> API is not disturbed.
> (2) Pick a "magic token" such that it could not be confused for legitimate
> QMP/JSON syntax. Parentheses are used for this purpose.
> 
> For convenience, this branch is available at:
> https://github.com/jnsnow/qemu.git branch qmp-shell++
> This version is tagged qmp-shell++-v4.

Applied to the qmp branch, thanks.

> 
> ===
> v++
> ===
> 
>  - Use the AST to allow 'true', 'false' and 'null' within QMP expressions
>  - Fix a bunch of stupid junk I broke in v2, apparently.
> 
> ===
> v3:
> ===
> 
>  - Folding in hotfix from list (import ast)
> 
> ===
> v2:
> ===
> 
>  - Squash patches 2 & 3:
>  - Remove wholesale replacement of single quotes, in favor of try blocks
>that attempt to parse as pure JSON, then as Python.
>  - Factored out the value parser block to accomplish the above.
>  - Allow both true/True and false/False for values.
>  - Fix typo in patch 3 cover letter. (was patch 4.)
> 
> John Snow (4):
>   scripts: qmp-shell: refactor helpers
>   scripts: qmp-shell: Expand support for QMP expressions
>   scripts: qmp-shell: add transaction subshell
>   scripts: qmp-shell: Add verbose flag
> 
>  scripts/qmp/qmp-shell | 147 
> +++---
>  1 file changed, 116 insertions(+), 31 deletions(-)
> 




Re: [Qemu-devel] [PATCH v4 0/4] scripts: qmp-shell: add transaction support

2015-05-05 Thread Luiz Capitulino
On Tue, 05 May 2015 11:34:02 -0400
John Snow  wrote:

> 
> 
> On 05/05/2015 08:52 AM, Luiz Capitulino wrote:
> > I lost track of it. Is v4 a new posting?
> 
> Yup. Latest with fixes. Eric re-reviewed it all and Kashyap (and I) 
> tested it.

OK, I'm queuing it for my next pass over my qmp-patches mailbox.



Re: [Qemu-devel] [PATCH v4 0/4] scripts: qmp-shell: add transaction support

2015-05-05 Thread John Snow



On 05/05/2015 08:52 AM, Luiz Capitulino wrote:

I lost track of it. Is v4 a new posting?


Yup. Latest with fixes. Eric re-reviewed it all and Kashyap (and I) 
tested it.


--js



Re: [Qemu-devel] [PATCH v4 0/4] scripts: qmp-shell: add transaction support

2015-05-05 Thread Luiz Capitulino
On Mon, 04 May 2015 15:24:02 -0400
John Snow  wrote:

> Ping
> (I should've CC'd Luiz to begin with ...)
> 
> Eric's given this series the once over and Kashyap has tested it, so it 
> should in theory be good to go.

I lost track of it. Is v4 a new posting?

> 
> On 04/29/2015 03:14 PM, John Snow wrote:
> > The qmp-shell is a little rudimentary, but it can be hacked
> > to give us some transactional support without too much difficulty.
> >
> > (1) Prep.
> > (2) Add support for serializing json arrays and
> >  improve the robustness of QMP parsing
> > (3) Add a special transaction( ... ) syntax that lets users
> >  build up transactional commands using the existing qmp shell
> >  syntax to define each action.
> > (4) Add a verbose flag to display generated QMP commands.
> >
> > The parsing is not as robust as one would like, but this suffices
> > without adding a proper parser.
> >
> > Design considerations:
> >
> > (1) Try not to disrupt the existing design of the qmp-shell. The existing
> >  API is not disturbed.
> > (2) Pick a "magic token" such that it could not be confused for legitimate
> >  QMP/JSON syntax. Parentheses are used for this purpose.
> >
> > For convenience, this branch is available at:
> > https://github.com/jnsnow/qemu.git branch qmp-shell++
> > This version is tagged qmp-shell++-v4.
> >
> > ===
> > v++
> > ===
> >
> >   - Use the AST to allow 'true', 'false' and 'null' within QMP expressions
> >   - Fix a bunch of stupid junk I broke in v2, apparently.
> >
> > ===
> > v3:
> > ===
> >
> >   - Folding in hotfix from list (import ast)
> >
> > ===
> > v2:
> > ===
> >
> >   - Squash patches 2 & 3:
> >   - Remove wholesale replacement of single quotes, in favor of try blocks
> > that attempt to parse as pure JSON, then as Python.
> >   - Factored out the value parser block to accomplish the above.
> >   - Allow both true/True and false/False for values.
> >   - Fix typo in patch 3 cover letter. (was patch 4.)
> >
> > John Snow (4):
> >scripts: qmp-shell: refactor helpers
> >scripts: qmp-shell: Expand support for QMP expressions
> >scripts: qmp-shell: add transaction subshell
> >scripts: qmp-shell: Add verbose flag
> >
> >   scripts/qmp/qmp-shell | 147 
> > +++---
> >   1 file changed, 116 insertions(+), 31 deletions(-)
> >
> 




Re: [Qemu-devel] [PATCH v4 0/4] scripts: qmp-shell: add transaction support

2015-05-04 Thread John Snow

Ping
(I should've CC'd Luiz to begin with ...)

Eric's given this series the once over and Kashyap has tested it, so it 
should in theory be good to go.


On 04/29/2015 03:14 PM, John Snow wrote:

The qmp-shell is a little rudimentary, but it can be hacked
to give us some transactional support without too much difficulty.

(1) Prep.
(2) Add support for serializing json arrays and
 improve the robustness of QMP parsing
(3) Add a special transaction( ... ) syntax that lets users
 build up transactional commands using the existing qmp shell
 syntax to define each action.
(4) Add a verbose flag to display generated QMP commands.

The parsing is not as robust as one would like, but this suffices
without adding a proper parser.

Design considerations:

(1) Try not to disrupt the existing design of the qmp-shell. The existing
 API is not disturbed.
(2) Pick a "magic token" such that it could not be confused for legitimate
 QMP/JSON syntax. Parentheses are used for this purpose.

For convenience, this branch is available at:
https://github.com/jnsnow/qemu.git branch qmp-shell++
This version is tagged qmp-shell++-v4.

===
v++
===

  - Use the AST to allow 'true', 'false' and 'null' within QMP expressions
  - Fix a bunch of stupid junk I broke in v2, apparently.

===
v3:
===

  - Folding in hotfix from list (import ast)

===
v2:
===

  - Squash patches 2 & 3:
  - Remove wholesale replacement of single quotes, in favor of try blocks
that attempt to parse as pure JSON, then as Python.
  - Factored out the value parser block to accomplish the above.
  - Allow both true/True and false/False for values.
  - Fix typo in patch 3 cover letter. (was patch 4.)

John Snow (4):
   scripts: qmp-shell: refactor helpers
   scripts: qmp-shell: Expand support for QMP expressions
   scripts: qmp-shell: add transaction subshell
   scripts: qmp-shell: Add verbose flag

  scripts/qmp/qmp-shell | 147 +++---
  1 file changed, 116 insertions(+), 31 deletions(-)





Re: [Qemu-devel] [PATCH v4 0/4] scripts: qmp-shell: add transaction support

2015-04-30 Thread Kashyap Chamarthy
On Wed, Apr 29, 2015 at 03:14:00PM -0400, John Snow wrote:
> The qmp-shell is a little rudimentary, but it can be hacked
> to give us some transactional support without too much difficulty.
> 
> (1) Prep.
> (2) Add support for serializing json arrays and
> improve the robustness of QMP parsing
> (3) Add a special transaction( ... ) syntax that lets users
> build up transactional commands using the existing qmp shell
> syntax to define each action.
> (4) Add a verbose flag to display generated QMP commands.
> 
> The parsing is not as robust as one would like, but this suffices
> without adding a proper parser.
> 
> Design considerations:
> 
> (1) Try not to disrupt the existing design of the qmp-shell. The existing
> API is not disturbed.
> (2) Pick a "magic token" such that it could not be confused for legitimate
> QMP/JSON syntax. Parentheses are used for this purpose.
> 
> For convenience, this branch is available at:
> https://github.com/jnsnow/qemu.git branch qmp-shell++
> This version is tagged qmp-shell++-v4.
> 
> ===
> v++
> ===
> 
>  - Use the AST to allow 'true', 'false' and 'null' within QMP expressions
>  - Fix a bunch of stupid junk I broke in v2, apparently.
> 
> ===
> v3:
> ===
> 
>  - Folding in hotfix from list (import ast)
> 
> ===
> v2:
> ===
> 
>  - Squash patches 2 & 3:
>  - Remove wholesale replacement of single quotes, in favor of try blocks
>that attempt to parse as pure JSON, then as Python.
>  - Factored out the value parser block to accomplish the above.
>  - Allow both true/True and false/False for values.
>  - Fix typo in patch 3 cover letter. (was patch 4.)
> 
> John Snow (4):
>   scripts: qmp-shell: refactor helpers
>   scripts: qmp-shell: Expand support for QMP expressions
>   scripts: qmp-shell: add transaction subshell
>   scripts: qmp-shell: Add verbose flag
> 
>  scripts/qmp/qmp-shell | 147 
> +++---
>  1 file changed, 116 insertions(+), 31 deletions(-)


Quick test, works as advertized. This time, I ran this series on top of
your incremental backup branch:

A positive test (sorry for the un-wrapped long lines). I already had the
target image pre-created:

$ ./qmp-shell -v ./qmp-sock
Welcome to the QMP low-level shell!
Connected to QEMU 2.2.94
(QEMU)
(QEMU) transaction(
TRANS> blockdev-snapshot-internal-sync device=drive-ide0-0-0 name=snapshot5
TRANS> block-dirty-bitmap-add node=drive-ide0-0-0 name=bitmap1
TRANS> block-dirty-bitmap-clear node=drive-ide0-0-0 name=bitmap0

   
TRANS> drive-backup device=drive-ide0-0-0 bitmap=bitmap1 sync=dirty-bitmap 
target=./incremental.0.img mode=existing format=qcow2
TRANS> )
{"execute": "transaction", "arguments": {"actions": [{"data": {"device": 
"drive-ide0-0-0", "name": "snapshot5"}, "type": 
"blockdev-snapshot-internal-sync"}, {"data": {"node": "drive-ide0-0-0", "name": 
"bitmap1"}, "type": "block-dirty-bitmap-add"}, {"data": {"node": 
"drive-ide0-0-0", "name": "bitmap0"}, "type": "block-dirty-bitmap-clear"}, 
{"data": {"target": "./incremental.0.img", "format": "qcow2", "sync": 
"dirty-bitmap", "bitmap": "bitmap1", "mode": "existing", "device": 
"drive-ide0-0-0"}, "type": "drive-backup"}]}}
{"return": {}}
(QEMU)

And a quick negative test: don't pre-create the target image when
running the `drive-backup` command, appropriate error is thrown.


So, FWIW:

  Tested-by: Kashyap Chamarthy 

-- 
/kashyap



[Qemu-devel] [PATCH v4 0/4] scripts: qmp-shell: add transaction support

2015-04-29 Thread John Snow
The qmp-shell is a little rudimentary, but it can be hacked
to give us some transactional support without too much difficulty.

(1) Prep.
(2) Add support for serializing json arrays and
improve the robustness of QMP parsing
(3) Add a special transaction( ... ) syntax that lets users
build up transactional commands using the existing qmp shell
syntax to define each action.
(4) Add a verbose flag to display generated QMP commands.

The parsing is not as robust as one would like, but this suffices
without adding a proper parser.

Design considerations:

(1) Try not to disrupt the existing design of the qmp-shell. The existing
API is not disturbed.
(2) Pick a "magic token" such that it could not be confused for legitimate
QMP/JSON syntax. Parentheses are used for this purpose.

For convenience, this branch is available at:
https://github.com/jnsnow/qemu.git branch qmp-shell++
This version is tagged qmp-shell++-v4.

===
v++
===

 - Use the AST to allow 'true', 'false' and 'null' within QMP expressions
 - Fix a bunch of stupid junk I broke in v2, apparently.

===
v3:
===

 - Folding in hotfix from list (import ast)

===
v2:
===

 - Squash patches 2 & 3:
 - Remove wholesale replacement of single quotes, in favor of try blocks
   that attempt to parse as pure JSON, then as Python.
 - Factored out the value parser block to accomplish the above.
 - Allow both true/True and false/False for values.
 - Fix typo in patch 3 cover letter. (was patch 4.)

John Snow (4):
  scripts: qmp-shell: refactor helpers
  scripts: qmp-shell: Expand support for QMP expressions
  scripts: qmp-shell: add transaction subshell
  scripts: qmp-shell: Add verbose flag

 scripts/qmp/qmp-shell | 147 +++---
 1 file changed, 116 insertions(+), 31 deletions(-)

-- 
2.1.0