qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Supriya Kannery <supriyak@in.ibm.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [Qemu-devel] [V4 Patch 3/4 - Updated]Qemu: Command "block_set" for dynamic block params change
Date: Mon, 25 Jul 2011 18:22:40 +0530	[thread overview]
Message-ID: <4E2D6718.3060300@in.ibm.com> (raw)
In-Reply-To: <20110725063015.GA12854@stefanha-thinkpad.localdomain>

On 07/25/2011 12:00 PM, Stefan Hajnoczi wrote:
> On Wed, Jul 13, 2011 at 06:37:05PM +0530, Supriya Kannery wrote:

>> +    ret = bdrv_open(bs, bs->filename, bdrv_flags, drv);
>> +    if (ret<  0) {
>> +        /* Reopen failed. Try to open with original flags */
>> +        error_report("Opening file with changed flags...");
>> +        qerror_report(QERR_REOPEN_FILE_FAILED, bs->filename);
>
> If the next open fails too then there will be two qerror_report() calls.
> This causes a warning and the new qerror is dropped.  Please consolidate
> the error reporting so there is only one error before returning from
> this function.
>

ok

>> +    if (bdrv_is_inserted(bs)) {
>> +        /* Reopen file with changed set of flags */
>> +        return bdrv_reopen(bs, bdrv_flags);
>> +    } else {
>> +        /* Save hostcache change for future use */
>> +        bs->open_flags = bdrv_flags;

>
> Can you explain the scenario where this works?
>
> Looking at do_change_block() the flags will be clobbered so saving them
> away does not help.

Intention here is to use the changed hostcache setting during device 
insertion and there after. To apply this to 'change' command (during 
insertion of a device), will need to make the following code changes
in do_change_block.

+
+    bdrv_flags = bs->open_flags;
+    bdrv_flags |= bdrv_is_read_only(bs) ? 0 : BDRV_O_RDWR;
      bdrv_flags |= bdrv_is_snapshot(bs) ? BDRV_O_SNAPSHOT : 0;
      if (bdrv_open(bs, filename, bdrv_flags, drv) < 0) {
          qerror_report(QERR_OPEN_FILE_FAILED, filename);

Need to track bs->open_flags a bit more to see what other changes
needed to ensure usage of changed hostcache setting until user
initiates next hostcache change explicitly for that drive.

Please suggest... should we be saving the hostcache change for
future use or just inhibit user from changing hostcache setting
for an empty drive?

>> +    /* If input not in "param=value" format, display error */
>> +    driver = qemu_opt_get(opts, "driver");
>> +    if (driver != NULL) {
>> +        error_report("Invalid parameter %s", driver);
>
> error_report() only works for HMP.  Please use qerror_report() so both
> HMP and QMP see the error.  Same issue further down.
>

ok..will change error_report to qerror_report.

Will make further code changes into patchset version 5

  reply	other threads:[~2011-07-25 12:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-04 10:42 [Qemu-devel] [V4 Patch 0/4]Qemu: Hostcache setting from cmdline and monitor Supriya Kannery
2011-07-04 10:42 ` [Qemu-devel] [V4 Patch 1/4]Qemu: Enhance "info block" to display host cache setting Supriya Kannery
2011-07-04 11:54   ` Stefan Hajnoczi
2011-07-05 10:49     ` [Qemu-devel] [V4 Patch 1/4 -Updated]Qemu: " Supriya Kannery
2011-07-20  7:37       ` Supriya Kannery
2011-07-04 10:43 ` [Qemu-devel] [V4 Patch 2/4]Qemu: Error classes for file reopen and data sync failure Supriya Kannery
2011-07-04 10:43 ` [Qemu-devel] [V4 Patch 3/4]Qemu: Command "block_set" for dynamic block params change Supriya Kannery
2011-07-04 12:29   ` Stefan Hajnoczi
2011-07-05 10:55     ` Supriya Kannery
2011-07-13 13:07       ` [Qemu-devel] [V4 Patch 3/4 - Updated]Qemu: " Supriya Kannery
2011-07-20  7:38         ` Supriya Kannery
2011-07-25  6:30         ` Stefan Hajnoczi
2011-07-25 12:52           ` Supriya Kannery [this message]
2011-07-25 12:50             ` Stefan Hajnoczi
2011-07-25 13:34               ` Kevin Wolf
2011-07-26  5:47                 ` Supriya Kannery
2011-07-04 12:35   ` [Qemu-devel] [V4 Patch 3/4]Qemu: " Stefan Hajnoczi
2011-07-04 10:43 ` [Qemu-devel] [V4 Patch 4/4]Qemu: Add commandline -drive option 'hostcache' Supriya Kannery
2011-07-04 12:31   ` Stefan Hajnoczi
2011-07-05 11:05     ` [Qemu-devel] [V4 Patch 4/4 - Updated]Qemu: " Supriya Kannery
2011-07-20  7:39       ` Supriya Kannery

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=4E2D6718.3060300@in.ibm.com \
    --to=supriyak@in.ibm.com \
    --cc=hch@lst.de \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.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).