qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [V4 Patch 3/4 - Updated]Qemu: Command "block_set" for d


From: Supriya Kannery
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
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2

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 via email to

[Prev in Thread] Current Thread [Next in Thread]