1 wrote 4096/4096 bytes at offset 0
2 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
5 {"execute": "nbd-server-start", "arguments": {"addr": {"data": {"path": "SOCK_DIR/PID-socket"}, "type": "unix"}}}
7 {"execute": "query-block-exports", "arguments": {}}
10 === Create a read-only NBD export ===
11 {"execute": "block-export-add", "arguments": {"id": "export0", "node-name": "fmt", "type": "nbd"}}
13 {"execute": "query-block-exports", "arguments": {}}
14 {"return": [{"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]}
18 flags: 0x58f ( readonly flush fua df multi cache )
22 available meta contexts: 1
26 === Try a few invalid things ===
27 {"execute": "block-export-add", "arguments": {"id": "#invalid", "node-name": "fmt", "type": "nbd"}}
28 {"error": {"class": "GenericError", "desc": "Invalid block export id"}}
29 {"execute": "block-export-add", "arguments": {"id": "export0", "node-name": "fmt", "type": "nbd"}}
30 {"error": {"class": "GenericError", "desc": "Block export id 'export0' is already in use"}}
31 {"execute": "block-export-add", "arguments": {"id": "export1", "node-name": "ro", "type": "nbd", "writable": true}}
32 {"error": {"class": "GenericError", "desc": "Cannot export read-only node as writable"}}
33 {"execute": "block-export-del", "arguments": {"id": "export1"}}
34 {"error": {"class": "GenericError", "desc": "Export 'export1' is not found"}}
35 {"execute": "query-block-exports", "arguments": {}}
36 {"return": [{"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]}
38 === Move export to an iothread ===
39 {"execute": "device_add", "arguments": {"drive": "fmt", "driver": "scsi-hd", "id": "sda"}}
41 {"execute": "query-block-exports", "arguments": {}}
42 {"return": [{"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]}
46 flags: 0x58f ( readonly flush fua df multi cache )
50 available meta contexts: 1
54 === Add a writable export ===
55 {"execute": "block-export-add", "arguments": {"description": "This is the writable second export", "id": "export1", "name": "export1", "node-name": "fmt", "type": "nbd", "writable": true, "writethrough": true}}
56 {"error": {"class": "GenericError", "desc": "Conflicts with use by sda as 'root', which does not allow 'write' on fmt"}}
57 {"execute": "device_del", "arguments": {"id": "sda"}}
59 {"data": {"device": "sda", "path": "/machine/peripheral/sda"}, "event": "DEVICE_DELETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
60 {"execute": "device_add", "arguments": {"drive": "fmt", "driver": "scsi-hd", "id": "sda", "share-rw": true}}
62 {"execute": "block-export-add", "arguments": {"description": "This is the writable second export", "id": "export1", "name": "export1", "node-name": "fmt", "type": "nbd", "writable": true, "writethrough": true}}
64 {"execute": "query-block-exports", "arguments": {}}
65 {"return": [{"id": "export1", "node-name": "fmt", "shutting-down": false, "type": "nbd"}, {"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]}
69 flags: 0x58f ( readonly flush fua df multi cache )
73 available meta contexts: 1
76 description: This is the writable second export
78 flags: 0xced ( flush fua trim zeroes df cache fast-zero )
82 available meta contexts: 1
86 === Connect qemu-io to export1, try removing exports ===
87 read 4096/4096 bytes at offset 0
88 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
90 wrote 4096/4096 bytes at offset 4096
91 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
93 {"execute": "block-export-del", "arguments": {"id": "export1"}}
94 {"error": {"class": "GenericError", "desc": "export 'export1' still in use"}}
95 {"execute": "block-export-del", "arguments": {"id": "export0"}}
97 [{"data": {"id": "export0"}, "event": "BLOCK_EXPORT_DELETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}]
98 {"execute": "query-block-exports", "arguments": {}}
99 {"return": [{"id": "export1", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]}
102 description: This is the writable second export
104 flags: 0xced ( flush fua trim zeroes df cache fast-zero )
108 available meta contexts: 1
112 === Connect qemu-io again, try force removing ===
113 {"execute": "block-export-del", "arguments": {"id": "export1"}}
114 {"error": {"class": "GenericError", "desc": "export 'export1' still in use"}}
115 {"execute": "block-export-del", "arguments": {"id": "export1", "mode": "hard"}}
117 read failed: Input/output error
119 {"execute": "query-block-exports", "arguments": {}}
124 === Shut down QEMU ===