2019-03-07 22:58:38 +08:00
|
|
|
#!/usr/bin/env bash
|
2016-10-28 04:29:14 +08:00
|
|
|
#
|
|
|
|
# Test floppy configuration
|
|
|
|
#
|
|
|
|
# Copyright (C) 2016 Red Hat, Inc.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
|
|
|
|
# creator
|
|
|
|
owner=kwolf@redhat.com
|
|
|
|
|
|
|
|
seq=`basename $0`
|
|
|
|
echo "QA output created by $seq"
|
|
|
|
|
|
|
|
status=1 # failure is the default!
|
|
|
|
|
|
|
|
_cleanup()
|
|
|
|
{
|
2019-11-08 00:37:01 +08:00
|
|
|
_cleanup_test_img
|
|
|
|
_rm_test_img "$TEST_IMG.2"
|
|
|
|
_rm_test_img "$TEST_IMG.3"
|
2016-10-28 04:29:14 +08:00
|
|
|
}
|
|
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
|
|
|
|
# get standard environment, filters and checks
|
|
|
|
. ./common.rc
|
|
|
|
. ./common.filter
|
|
|
|
|
|
|
|
_supported_fmt qcow2
|
|
|
|
_supported_proto file
|
|
|
|
_supported_os Linux
|
|
|
|
|
|
|
|
if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
|
|
|
|
_notrun "Requires a PC machine"
|
|
|
|
fi
|
|
|
|
|
2018-11-17 05:50:02 +08:00
|
|
|
do_run_qemu()
|
2016-10-28 04:29:14 +08:00
|
|
|
{
|
|
|
|
(
|
|
|
|
if ! test -t 0; then
|
|
|
|
while read cmd; do
|
|
|
|
echo $cmd
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
echo quit
|
2019-09-04 13:27:39 +08:00
|
|
|
) | $QEMU -accel qtest -nographic -monitor stdio -serial none "$@"
|
2016-10-28 04:29:14 +08:00
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
2018-11-17 05:50:02 +08:00
|
|
|
check_floppy_qtree()
|
2016-10-28 04:29:14 +08:00
|
|
|
{
|
|
|
|
echo
|
|
|
|
echo Testing: "$@" | _filter_testdir
|
|
|
|
|
|
|
|
# QEMU_OPTIONS contains -nodefaults, we don't want that here because the
|
|
|
|
# defaults are part of what should be checked here.
|
|
|
|
#
|
|
|
|
# Apply the sed filter to stdout only, but keep the stderr output and
|
|
|
|
# filter the qemu program name in it.
|
2020-06-22 17:42:12 +08:00
|
|
|
printf "info qtree\ninfo block\n" |
|
2016-10-28 04:29:14 +08:00
|
|
|
(QEMU_OPTIONS="" do_run_qemu "$@" |
|
2020-06-22 17:42:12 +08:00
|
|
|
_filter_testdir |_filter_generated_node_ids | _filter_hmp |
|
|
|
|
sed -ne '/^ dev: isa-fdc/,/^ dev:/{x;p};/^[a-z][^ ]* (NODE_NAME):* /,/^(qemu)$/{p}') 2>&1 |
|
2016-10-28 04:29:14 +08:00
|
|
|
_filter_win32 | _filter_qemu
|
|
|
|
}
|
|
|
|
|
2018-11-17 05:50:02 +08:00
|
|
|
check_cache_mode()
|
2016-10-28 04:29:14 +08:00
|
|
|
{
|
|
|
|
echo "info block none0" |
|
|
|
|
QEMU_OPTIONS="" do_run_qemu -drive if=none,file="$TEST_IMG" "$@" |
|
|
|
|
_filter_win32 | _filter_qemu | grep "Cache mode"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
size=720k
|
|
|
|
|
|
|
|
_make_test_img $size
|
|
|
|
|
2017-05-03 00:35:48 +08:00
|
|
|
TEST_IMG="$TEST_IMG.2" _make_test_img $size
|
|
|
|
TEST_IMG="$TEST_IMG.3" _make_test_img $size
|
|
|
|
|
2016-10-28 04:29:14 +08:00
|
|
|
# Default drive semantics:
|
|
|
|
#
|
|
|
|
# By default you get a single empty floppy drive. You can override it with
|
|
|
|
# -drive and using the same index, but if you use -drive to add a floppy to a
|
|
|
|
# different index, you get both of them. However, as soon as you use any
|
|
|
|
# '-device floppy', even to a different slot, the default drive is disabled.
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Default ===
|
|
|
|
|
|
|
|
check_floppy_qtree
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Using -fda/-fdb options ===
|
|
|
|
|
|
|
|
check_floppy_qtree -fda "$TEST_IMG"
|
|
|
|
check_floppy_qtree -fdb "$TEST_IMG"
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -fda "$TEST_IMG" -fdb "$TEST_IMG.2"
|
2020-06-22 17:42:13 +08:00
|
|
|
check_floppy_qtree -fdb ""
|
2016-10-28 04:29:14 +08:00
|
|
|
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Using -drive options ===
|
|
|
|
|
|
|
|
check_floppy_qtree -drive if=floppy,file="$TEST_IMG"
|
|
|
|
check_floppy_qtree -drive if=floppy,file="$TEST_IMG",index=1
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -drive if=floppy,file="$TEST_IMG" -drive if=floppy,file="$TEST_IMG.2",index=1
|
2016-10-28 04:29:14 +08:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Using -drive if=none and -global ===
|
|
|
|
|
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -global isa-fdc.driveA=none0
|
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -global isa-fdc.driveB=none0
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
|
2016-10-28 04:29:14 +08:00
|
|
|
-global isa-fdc.driveA=none0 -global isa-fdc.driveB=none1
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Using -drive if=none and -device ===
|
|
|
|
|
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0
|
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,unit=1
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
|
2016-10-28 04:29:14 +08:00
|
|
|
-device floppy,drive=none0 -device floppy,drive=none1,unit=1
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Mixing -fdX and -global ===
|
|
|
|
|
|
|
|
# Working
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global isa-fdc.driveB=none0
|
|
|
|
check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global isa-fdc.driveA=none0
|
2016-10-28 04:29:14 +08:00
|
|
|
|
fdc: Reject clash between -drive if=floppy and -global isa-fdc
The floppy controller devices desugar their drive properties into
floppy devices (since commit a92bd191a4 "fdc: Move qdev properties to
FloppyDrive", v2.8.0). This involves some bad magic in
fdctrl_connect_drives(), and exists for backward compatibility.
The functions for boards to create floppy controller devices
fdctrl_init_isa(), fdctrl_init_sysbus(), and sun4m_fdctrl_init()
desugar -drive if=floppy to these floppy controller drive properties.
If you use both -drive if=floppy (or its -fda / -fdb sugar) and
-global isa-fdc for the same floppy device, -global silently loses the
conflict, and both backends involved end up with the floppy device
frontend attached, as demonstrated by iotest 172 (see commit before
previous). This is wrong.
Desugar -drive if=floppy straight to floppy devices instead, with
helper fdctrl_init_drives(). The conflict now gets rejected cleanly:
first, fdctrl_connect_drives() creates the floppy for the controller's
property, then fdctrl_init_drives() attempts to create the floppy for
-drive if=floppy, but fails because the unit is already in use.
Output of iotest 172 changes in three ways:
1. The clash gets rejected.
2. In one test case, "info qtree" has the floppy devices swapped, and
"info block" has their QOM paths swapped. This is because the
floppy device for -fda now gets created after the one for -global
isa-fdc.driveB.
3. The error message for -global floppy.drive=floppy0 changes. Before
the patch, we set isa-fdc.driveA to -fda's block backend, then
create the floppy device for it, then move the backend from
isa-fdc.driveA to floppy.drive. Floppy creation fails when
applying -global floppy.drive=floppy0, because floppy0 is still
attached to isa-fdc. After the patch, we create the floppy for
-fda, then set its drive property to floppy0. Now floppy creation
succeeds, but setting the drive property fails, because -global
already set it. Yes, this is exasperatingly complicated.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200622094227.1271650-5-armbru@redhat.com>
2020-06-22 17:42:15 +08:00
|
|
|
# Conflicting
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global isa-fdc.driveA=none0
|
|
|
|
check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global isa-fdc.driveB=none0
|
fdc: Reject clash between -drive if=floppy and -global isa-fdc
The floppy controller devices desugar their drive properties into
floppy devices (since commit a92bd191a4 "fdc: Move qdev properties to
FloppyDrive", v2.8.0). This involves some bad magic in
fdctrl_connect_drives(), and exists for backward compatibility.
The functions for boards to create floppy controller devices
fdctrl_init_isa(), fdctrl_init_sysbus(), and sun4m_fdctrl_init()
desugar -drive if=floppy to these floppy controller drive properties.
If you use both -drive if=floppy (or its -fda / -fdb sugar) and
-global isa-fdc for the same floppy device, -global silently loses the
conflict, and both backends involved end up with the floppy device
frontend attached, as demonstrated by iotest 172 (see commit before
previous). This is wrong.
Desugar -drive if=floppy straight to floppy devices instead, with
helper fdctrl_init_drives(). The conflict now gets rejected cleanly:
first, fdctrl_connect_drives() creates the floppy for the controller's
property, then fdctrl_init_drives() attempts to create the floppy for
-drive if=floppy, but fails because the unit is already in use.
Output of iotest 172 changes in three ways:
1. The clash gets rejected.
2. In one test case, "info qtree" has the floppy devices swapped, and
"info block" has their QOM paths swapped. This is because the
floppy device for -fda now gets created after the one for -global
isa-fdc.driveB.
3. The error message for -global floppy.drive=floppy0 changes. Before
the patch, we set isa-fdc.driveA to -fda's block backend, then
create the floppy device for it, then move the backend from
isa-fdc.driveA to floppy.drive. Floppy creation fails when
applying -global floppy.drive=floppy0, because floppy0 is still
attached to isa-fdc. After the patch, we create the floppy for
-fda, then set its drive property to floppy0. Now floppy creation
succeeds, but setting the drive property fails, because -global
already set it. Yes, this is exasperatingly complicated.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200622094227.1271650-5-armbru@redhat.com>
2020-06-22 17:42:15 +08:00
|
|
|
# Conflicting, -fdX wins
|
iotests/172: Cover -global floppy.drive=...
Use of -global to set a default backend for non-singleton devices is a
bad idea. But as long as we permit it, we better test it.
Test output demonstrates we screw up when -global floppy clashes with
-fda or with -device floppy: according to "info qtree", only the
latter backend is attached, but according to "info block", both are.
Here's the clash with -device:
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global floppy.drive=none0 -device floppy,drive=none1,unit=0
dev: isa-fdc, id ""
[...]
driveA = ""
driveB = ""
[...]
bus: floppy-bus.0
type floppy-bus
dev: floppy, id ""
unit = 0 (0x0)
---> drive = "none1"
[...]
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
---> Attached to: /machine/peripheral-anon/device[0]
Cache mode: writeback
none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
---> Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
/machine/peripheral-anon/device[0] is the floppy created with -device.
Test output further demonstrates the "Drive 'FOO' is already in use
because it has been automatically connected to another device" error
message can be misleading. With '-fda "" -global
floppy.drive=floppy0', it's in use because -global reuses -fda's
backend. There is no other device involved.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200622094227.1271650-4-armbru@redhat.com>
2020-06-22 17:42:14 +08:00
|
|
|
check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global floppy.drive=none0
|
2016-10-28 04:29:14 +08:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Mixing -fdX and -device ===
|
|
|
|
|
|
|
|
# Working
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0
|
|
|
|
check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0,unit=1
|
2016-10-28 04:29:14 +08:00
|
|
|
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0
|
|
|
|
check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0,unit=0
|
2016-10-28 04:29:14 +08:00
|
|
|
|
|
|
|
# Conflicting
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0,unit=0
|
|
|
|
check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0,unit=1
|
2016-10-28 04:29:14 +08:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Mixing -drive and -device ===
|
|
|
|
|
|
|
|
# Working
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -drive if=floppy,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0
|
|
|
|
check_floppy_qtree -drive if=floppy,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0,unit=1
|
2016-10-28 04:29:14 +08:00
|
|
|
|
|
|
|
# Conflicting
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -drive if=floppy,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -device floppy,drive=none0,unit=0
|
2016-10-28 04:29:14 +08:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Mixing -global and -device ===
|
|
|
|
|
|
|
|
# Working
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
|
2016-10-28 04:29:14 +08:00
|
|
|
-global isa-fdc.driveA=none0 -device floppy,drive=none1
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
|
2016-10-28 04:29:14 +08:00
|
|
|
-global isa-fdc.driveA=none0 -device floppy,drive=none1,unit=1
|
|
|
|
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
|
2016-10-28 04:29:14 +08:00
|
|
|
-global isa-fdc.driveB=none0 -device floppy,drive=none1
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
|
2016-10-28 04:29:14 +08:00
|
|
|
-global isa-fdc.driveB=none0 -device floppy,drive=none1,unit=0
|
iotests/172: Cover -global floppy.drive=...
Use of -global to set a default backend for non-singleton devices is a
bad idea. But as long as we permit it, we better test it.
Test output demonstrates we screw up when -global floppy clashes with
-fda or with -device floppy: according to "info qtree", only the
latter backend is attached, but according to "info block", both are.
Here's the clash with -device:
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global floppy.drive=none0 -device floppy,drive=none1,unit=0
dev: isa-fdc, id ""
[...]
driveA = ""
driveB = ""
[...]
bus: floppy-bus.0
type floppy-bus
dev: floppy, id ""
unit = 0 (0x0)
---> drive = "none1"
[...]
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
---> Attached to: /machine/peripheral-anon/device[0]
Cache mode: writeback
none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
---> Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
/machine/peripheral-anon/device[0] is the floppy created with -device.
Test output further demonstrates the "Drive 'FOO' is already in use
because it has been automatically connected to another device" error
message can be misleading. With '-fda "" -global
floppy.drive=floppy0', it's in use because -global reuses -fda's
backend. There is no other device involved.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200622094227.1271650-4-armbru@redhat.com>
2020-06-22 17:42:14 +08:00
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" \
|
|
|
|
-global floppy.drive=none0 -device floppy,unit=0
|
2016-10-28 04:29:14 +08:00
|
|
|
|
|
|
|
# Conflicting
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
|
2016-10-28 04:29:14 +08:00
|
|
|
-global isa-fdc.driveA=none0 -device floppy,drive=none1,unit=0
|
2017-05-03 00:35:48 +08:00
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
|
2016-10-28 04:29:14 +08:00
|
|
|
-global isa-fdc.driveB=none0 -device floppy,drive=none1,unit=1
|
iotests/172: Cover -global floppy.drive=...
Use of -global to set a default backend for non-singleton devices is a
bad idea. But as long as we permit it, we better test it.
Test output demonstrates we screw up when -global floppy clashes with
-fda or with -device floppy: according to "info qtree", only the
latter backend is attached, but according to "info block", both are.
Here's the clash with -device:
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global floppy.drive=none0 -device floppy,drive=none1,unit=0
dev: isa-fdc, id ""
[...]
driveA = ""
driveB = ""
[...]
bus: floppy-bus.0
type floppy-bus
dev: floppy, id ""
unit = 0 (0x0)
---> drive = "none1"
[...]
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
---> Attached to: /machine/peripheral-anon/device[0]
Cache mode: writeback
none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
---> Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
/machine/peripheral-anon/device[0] is the floppy created with -device.
Test output further demonstrates the "Drive 'FOO' is already in use
because it has been automatically connected to another device" error
message can be misleading. With '-fda "" -global
floppy.drive=floppy0', it's in use because -global reuses -fda's
backend. There is no other device involved.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200622094227.1271650-4-armbru@redhat.com>
2020-06-22 17:42:14 +08:00
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
|
|
|
|
-global floppy.drive=none0 -device floppy,drive=none1,unit=0
|
2016-10-28 04:29:14 +08:00
|
|
|
|
2020-06-22 17:42:13 +08:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Attempt to use drive twice ===
|
|
|
|
|
|
|
|
# if=none
|
|
|
|
check_floppy_qtree -drive if=none -device floppy,drive=none0 -device floppy -device floppy,drive=none0
|
iotests/172: Cover -global floppy.drive=...
Use of -global to set a default backend for non-singleton devices is a
bad idea. But as long as we permit it, we better test it.
Test output demonstrates we screw up when -global floppy clashes with
-fda or with -device floppy: according to "info qtree", only the
latter backend is attached, but according to "info block", both are.
Here's the clash with -device:
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global floppy.drive=none0 -device floppy,drive=none1,unit=0
dev: isa-fdc, id ""
[...]
driveA = ""
driveB = ""
[...]
bus: floppy-bus.0
type floppy-bus
dev: floppy, id ""
unit = 0 (0x0)
---> drive = "none1"
[...]
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
---> Attached to: /machine/peripheral-anon/device[0]
Cache mode: writeback
none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
---> Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
/machine/peripheral-anon/device[0] is the floppy created with -device.
Test output further demonstrates the "Drive 'FOO' is already in use
because it has been automatically connected to another device" error
message can be misleading. With '-fda "" -global
floppy.drive=floppy0', it's in use because -global reuses -fda's
backend. There is no other device involved.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200622094227.1271650-4-armbru@redhat.com>
2020-06-22 17:42:14 +08:00
|
|
|
check_floppy_qtree -drive if=none -global floppy.drive=none0 -device floppy -device floppy
|
2020-06-22 17:42:13 +08:00
|
|
|
# if=floppy
|
|
|
|
check_floppy_qtree -fda "" -device floppy,drive=floppy0
|
iotests/172: Cover -global floppy.drive=...
Use of -global to set a default backend for non-singleton devices is a
bad idea. But as long as we permit it, we better test it.
Test output demonstrates we screw up when -global floppy clashes with
-fda or with -device floppy: according to "info qtree", only the
latter backend is attached, but according to "info block", both are.
Here's the clash with -device:
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global floppy.drive=none0 -device floppy,drive=none1,unit=0
dev: isa-fdc, id ""
[...]
driveA = ""
driveB = ""
[...]
bus: floppy-bus.0
type floppy-bus
dev: floppy, id ""
unit = 0 (0x0)
---> drive = "none1"
[...]
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
---> Attached to: /machine/peripheral-anon/device[0]
Cache mode: writeback
none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
---> Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
/machine/peripheral-anon/device[0] is the floppy created with -device.
Test output further demonstrates the "Drive 'FOO' is already in use
because it has been automatically connected to another device" error
message can be misleading. With '-fda "" -global
floppy.drive=floppy0', it's in use because -global reuses -fda's
backend. There is no other device involved.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200622094227.1271650-4-armbru@redhat.com>
2020-06-22 17:42:14 +08:00
|
|
|
check_floppy_qtree -fda "" -global floppy.drive=floppy0
|
2020-06-22 17:42:13 +08:00
|
|
|
# default if=floppy (not found, because it's created later)
|
|
|
|
check_floppy_qtree -device floppy,drive=floppy0
|
|
|
|
|
2016-10-28 04:29:14 +08:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Too many floppy drives ===
|
|
|
|
|
|
|
|
# Working
|
|
|
|
check_floppy_qtree -drive if=floppy,file="$TEST_IMG" \
|
2017-05-03 00:35:48 +08:00
|
|
|
-drive if=none,file="$TEST_IMG.2" \
|
|
|
|
-drive if=none,file="$TEST_IMG.3" \
|
2016-10-28 04:29:14 +08:00
|
|
|
-global isa-fdc.driveB=none0 \
|
|
|
|
-device floppy,drive=none1
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Creating an empty drive with anonymous BB ===
|
|
|
|
|
|
|
|
check_floppy_qtree -device floppy
|
|
|
|
check_floppy_qtree -device floppy,drive-type=120
|
|
|
|
check_floppy_qtree -device floppy,drive-type=144
|
|
|
|
check_floppy_qtree -device floppy,drive-type=288
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Try passing different drive size with image ===
|
|
|
|
|
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,drive-type=120
|
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,drive-type=288
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Try passing different block sizes ===
|
|
|
|
|
|
|
|
# Explicitly setting the default is okay
|
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,logical_block_size=512
|
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,physical_block_size=512
|
|
|
|
|
|
|
|
# Changing it is not
|
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,logical_block_size=4096
|
|
|
|
check_floppy_qtree -drive if=none,file="$TEST_IMG" -device floppy,drive=none0,physical_block_size=1024
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo === Writethrough caching ===
|
|
|
|
|
|
|
|
check_cache_mode -device floppy,drive=none0
|
|
|
|
check_cache_mode -device floppy,drive=none0,write-cache=on
|
|
|
|
check_cache_mode -device floppy,drive=none0,write-cache=off
|
|
|
|
|
|
|
|
# success, all done
|
|
|
|
echo "*** done"
|
|
|
|
rm -f $seq.full
|
|
|
|
status=0
|