1 ==Unplug a SCSI disk and then plug it again==
2 {"execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-zeroes": true}}
4 {"execute": "object-add", "arguments": {"id": "iothread0", "qom-type": "iothread"}}
6 {"execute": "device_add", "arguments": {"driver": "virtio-scsi", "id": "scsi0", "iothread": "iothread0"}}
8 {"execute": "device_add", "arguments": {"drive": "hd0", "driver": "scsi-hd", "id": "scsi-hd0"}}
10 {"execute": "device_del", "arguments": {"id": "scsi-hd0"}}
12 {"execute": "device_add", "arguments": {"drive": "hd0", "driver": "scsi-hd", "id": "scsi-hd0"}}
14 {"execute": "device_del", "arguments": {"id": "scsi-hd0"}}
16 {"execute": "blockdev-del", "arguments": {"node-name": "hd0"}}
18 .==Attach two SCSI disks using the same block device and the same iothread==
19 {"execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true, "read-zeroes": true}}
21 {"execute": "object-add", "arguments": {"id": "iothread0", "qom-type": "iothread"}}
23 {"execute": "device_add", "arguments": {"driver": "virtio-scsi", "id": "scsi0", "iothread": "iothread0"}}
25 {"execute": "device_add", "arguments": {"drive": "hd0", "driver": "scsi-hd", "id": "scsi-hd0"}}
27 {"execute": "device_add", "arguments": {"drive": "hd0", "driver": "scsi-hd", "id": "scsi-hd1"}}
29 {"execute": "device_del", "arguments": {"id": "scsi-hd0"}}
31 {"execute": "device_del", "arguments": {"id": "scsi-hd1"}}
33 {"execute": "blockdev-del", "arguments": {"node-name": "hd0"}}
35 .==Attach two SCSI disks using the same block device but different iothreads==
36 {"execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true, "read-zeroes": true}}
38 {"execute": "object-add", "arguments": {"id": "iothread0", "qom-type": "iothread"}}
40 {"execute": "object-add", "arguments": {"id": "iothread1", "qom-type": "iothread"}}
42 {"execute": "device_add", "arguments": {"driver": "virtio-scsi", "id": "scsi0", "iothread": "iothread0"}}
44 {"execute": "device_add", "arguments": {"driver": "virtio-scsi", "id": "scsi1", "iothread": "iothread1"}}
46 {"execute": "device_add", "arguments": {"bus": "scsi0.0", "drive": "hd0", "driver": "scsi-hd", "id": "scsi-hd0"}}
48 {"execute": "device_add", "arguments": {"bus": "scsi1.0", "drive": "hd0", "driver": "scsi-hd", "id": "scsi-hd1"}}
49 {"error": {"class": "GenericError", "desc": "Cannot change iothread of active block backend"}}
50 {"execute": "device_del", "arguments": {"id": "scsi-hd0"}}
52 {"execute": "device_add", "arguments": {"bus": "scsi1.0", "drive": "hd0", "driver": "scsi-hd", "id": "scsi-hd1"}}
54 {"execute": "device_del", "arguments": {"id": "scsi-hd1"}}
56 {"execute": "blockdev-del", "arguments": {"node-name": "hd0"}}
58 .==Attach a SCSI disks using the same block device as a NBD server==
59 {"execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true, "read-zeroes": true}}
61 {"execute": "nbd-server-start", "arguments": {"addr": {"data": {"path": "SOCK_DIR/PID-nbd.sock"}, "type": "unix"}}}
63 {"execute": "nbd-server-add", "arguments": {"device": "hd0"}}
65 {"execute": "object-add", "arguments": {"id": "iothread0", "qom-type": "iothread"}}
67 {"execute": "device_add", "arguments": {"driver": "virtio-scsi", "id": "scsi0", "iothread": "iothread0"}}
69 {"execute": "device_add", "arguments": {"drive": "hd0", "driver": "scsi-hd", "id": "scsi-hd0"}}
72 ----------------------------------------------------------------------