nixos/tests/udisks2: Fix USB device hotplug

The usb_add and usb_del monitor commands have been removed in QEMU
version 2.12 (introduced in 3e3b39f173).

Quote from https://wiki.qemu.org/ChangeLog/2.12#Incompatible_changes:

> The deprecated HMP commands "usb_add" and "usb_del" have been removed.
> Use "device_add" and "device_del" as replacement instead.

So we're doing exactly that and the udisks2 test now works again.

Signed-off-by: aszlig <aszlig@nix.build>
Cc: @edolstra
This commit is contained in:
aszlig 2018-04-30 00:21:36 +02:00
parent 81c705ad99
commit 1907120f23
No known key found for this signature in database
GPG Key ID: 684089CE67EBB691

View File

@ -37,7 +37,8 @@ in
$machine->fail("udisksctl info -b /dev/sda1");
# Attach a USB stick and wait for it to show up.
$machine->sendMonitorCommand("usb_add disk:$stick");
$machine->sendMonitorCommand("drive_add 0 id=stick,if=none,file=$stick,format=raw");
$machine->sendMonitorCommand("device_add usb-storage,id=stick,drive=stick");
$machine->waitUntilSucceeds("udisksctl info -b /dev/sda1");
$machine->succeed("udisksctl info -b /dev/sda1 | grep 'IdLabel:.*USBSTICK'");
@ -52,7 +53,7 @@ in
$machine->fail("[ -d /run/media/alice/USBSTICK ]");
# Remove the USB stick.
$machine->sendMonitorCommand("usb_del 0.3"); # FIXME
$machine->sendMonitorCommand("device_del stick");
$machine->waitUntilFails("udisksctl info -b /dev/sda1");
$machine->fail("[ -e /dev/sda ]");
'';