diff mbox

[v3,12/13] fdc-test: Avoid deprecated 'change' command

Message ID 20170405194741.18956-13-eblake@redhat.com
State New
Headers show

Commit Message

Eric Blake April 5, 2017, 7:47 p.m. UTC
Use the preferred blockdev-change-medium command instead.

Admittedly, use of 'device' is also deprecated over the newer use
of 'id', but the test is exploiting that the name 'floppy0' is
auto-created by the board, and I could not figure out where the
command line lives that would need to be tweaked to provide a
non-random 'id' to this device.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>

---
v3: update commit message to point out that we are still using
deprecated 'device'
---
 tests/fdc-test.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

John Snow April 5, 2017, 8:52 p.m. UTC | #1
On 04/05/2017 03:47 PM, Eric Blake wrote:
> Use the preferred blockdev-change-medium command instead.
> 
> Admittedly, use of 'device' is also deprecated over the newer use
> of 'id', but the test is exploiting that the name 'floppy0' is
> auto-created by the board, and I could not figure out where the
> command line lives that would need to be tweaked to provide a
> non-random 'id' to this device.
> 

qtest_start
  qtest_init
    qtest_init_without_qmp_handshake

You can give *extra* args to qtest_start, but depending on the board
-nodefaults isn't going to get rid of that embedded FDC nor its default
floppy0 drive, I think.

You could perhaps add a second floppy drive explicitly with
-device floppy,id=snafu,bus=floppy-bus.0,unit=1

and then interact with this non-default drive, or you could use Q35 and
-nodefaults to fully clear the isa-fdc, then re-add with

-device isa-fdc,id=foobar
-device floppy,bus=foobar.0,unit=1

Or you could do nothing, and I won't tell anyone.

--js

> Signed-off-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: John Snow <jsnow@redhat.com>
> 
> ---
> v3: update commit message to point out that we are still using
> deprecated 'device'
> ---
>  tests/fdc-test.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/fdc-test.c b/tests/fdc-test.c
> index 738c6b4..f5ff68d 100644
> --- a/tests/fdc-test.c
> +++ b/tests/fdc-test.c
> @@ -298,8 +298,9 @@ static void test_media_insert(void)
> 
>      /* Insert media in drive. DSKCHK should not be reset until a step pulse
>       * is sent. */
> -    qmp_discard_response("{'execute':'change', 'arguments':{"
> -                         " 'device':'floppy0', 'target': %s, 'arg': 'raw' }}",
> +    qmp_discard_response("{'execute':'blockdev-change-medium', 'arguments':{"
> +                         " 'device':'floppy0', 'filename': %s, "
> +                         "'format': 'raw' }}",
>                           test_image);
> 
>      dir = inb(FLOPPY_BASE + reg_dir);
>
Kevin Wolf April 6, 2017, 8:56 a.m. UTC | #2
Am 05.04.2017 um 22:52 hat John Snow geschrieben:
> On 04/05/2017 03:47 PM, Eric Blake wrote:
> > Use the preferred blockdev-change-medium command instead.
> > 
> > Admittedly, use of 'device' is also deprecated over the newer use
> > of 'id', but the test is exploiting that the name 'floppy0' is
> > auto-created by the board, and I could not figure out where the
> > command line lives that would need to be tweaked to provide a
> > non-random 'id' to this device.
> > 
> 
> qtest_start
>   qtest_init
>     qtest_init_without_qmp_handshake
> 
> You can give *extra* args to qtest_start, but depending on the board
> -nodefaults isn't going to get rid of that embedded FDC nor its default
> floppy0 drive, I think.

It does get rid of the default drive.

> You could perhaps add a second floppy drive explicitly with
> -device floppy,id=snafu,bus=floppy-bus.0,unit=1

As soon as you use -device floppy, the default drive goes away, too, so
you don't have to use a secondary floppy drive. It's like the default
CD-ROM that goes away if you use -device ide-cd.

So if you want to give it an ID, the solution is as simple as:

    -device floppy,id=foo

Kevin
diff mbox

Patch

diff --git a/tests/fdc-test.c b/tests/fdc-test.c
index 738c6b4..f5ff68d 100644
--- a/tests/fdc-test.c
+++ b/tests/fdc-test.c
@@ -298,8 +298,9 @@  static void test_media_insert(void)

     /* Insert media in drive. DSKCHK should not be reset until a step pulse
      * is sent. */
-    qmp_discard_response("{'execute':'change', 'arguments':{"
-                         " 'device':'floppy0', 'target': %s, 'arg': 'raw' }}",
+    qmp_discard_response("{'execute':'blockdev-change-medium', 'arguments':{"
+                         " 'device':'floppy0', 'filename': %s, "
+                         "'format': 'raw' }}",
                          test_image);

     dir = inb(FLOPPY_BASE + reg_dir);