qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, rjones@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/3] qcow2.py: Subcommand for changing header fields
Date: Mon, 13 May 2013 16:59:51 +0200	[thread overview]
Message-ID: <20130513145951.GB27673@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1368452576-32262-3-git-send-email-kwolf@redhat.com>

On Mon, May 13, 2013 at 03:42:55PM +0200, Kevin Wolf wrote:
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  tests/qemu-iotests/qcow2.py | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
> index fecf5b9..b6abd16 100755
> --- a/tests/qemu-iotests/qcow2.py
> +++ b/tests/qemu-iotests/qcow2.py
> @@ -149,6 +149,17 @@ def cmd_dump_header(fd):
>      h.dump()
>      h.dump_extensions()
>  
> +def cmd_set_header(fd, name, value):
> +    try:
> +        value = int(value, 0)
> +    except:
> +        print "'%s' is not a valid number" % value
> +        sys.exit(1)
> +
> +    h = QcowHeader(fd)
> +    h.__dict__[name] = value
> +    h.update(fd)

No error checking on 'name'.  Since end-users are unlikely to try
qcow2.py we can get away with this, but it might save some poor person
time in the future if we check "name in QcowHeader.fields" and print an
error.

  reply	other threads:[~2013-05-13 15:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13 13:42 [Qemu-devel] [PATCH for-1.5 0/3] qcow2: Catch some L1 table index overflows Kevin Wolf
2013-05-13 13:42 ` [Qemu-devel] [PATCH for-1.5 1/3] " Kevin Wolf
2013-05-13 13:42 ` [Qemu-devel] [PATCH 2/3] qcow2.py: Subcommand for changing header fields Kevin Wolf
2013-05-13 14:59   ` Stefan Hajnoczi [this message]
2013-05-13 13:42 ` [Qemu-devel] [PATCH 3/3] qemu-iotests: Try creating huge qcow2 image Kevin Wolf
2013-05-13 14:39 ` [Qemu-devel] [PATCH for-1.5 0/3] qcow2: Catch some L1 table index overflows Richard W.M. Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130513145951.GB27673@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).