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: 0x158f ( readonly flush fua df multi cache block-status-payload )
22 transaction size: 64-bit
23 available meta contexts: 1
27 === Try a few invalid things ===
28 {"execute": "block-export-add", "arguments": {"id": "#invalid", "node-name": "fmt", "type": "nbd"}}
29 {"error": {"class": "GenericError", "desc": "Invalid block export id"}}
30 {"execute": "block-export-add", "arguments": {"id": "export0", "node-name": "fmt", "type": "nbd"}}
31 {"error": {"class": "GenericError", "desc": "Block export id 'export0' is already in use"}}
32 {"execute": "block-export-add", "arguments": {"id": "export1", "node-name": "ro", "type": "nbd", "writable": true}}
33 {"error": {"class": "GenericError", "desc": "Cannot export read-only node as writable"}}
34 {"execute": "block-export-del", "arguments": {"id": "export1"}}
35 {"error": {"class": "GenericError", "desc": "Export 'export1' is not found"}}
36 {"execute": "query-block-exports", "arguments": {}}
37 {"return": [{"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]}
39 === Move export to an iothread ===
40 {"execute": "device_add", "arguments": {"drive": "fmt", "driver": "scsi-hd", "id": "sda"}}
42 {"execute": "query-block-exports", "arguments": {}}
43 {"return": [{"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]}
47 flags: 0x158f ( readonly flush fua df multi cache block-status-payload )
51 transaction size: 64-bit
52 available meta contexts: 1
56 === Add export with conflicting iothread ===
57 {"execute": "device_add", "arguments": {"drive": "null", "driver": "scsi-hd", "id": "sdb"}}
59 {"execute": "block-export-add", "arguments": {"fixed-iothread": true, "id": "export1", "iothread": "iothread1", "node-name": "null", "type": "nbd", "writable": true}}
60 {"error": {"class": "GenericError", "desc": "Cannot change iothread of active block backend"}}
61 {"execute": "block-export-add", "arguments": {"fixed-iothread": false, "id": "export1", "iothread": "iothread1", "node-name": "null", "type": "nbd", "writable": true}}
62 {"error": {"class": "GenericError", "desc": "Permission conflict on node 'null': permissions 'write' are both required by an unnamed block device (uses node 'null' as 'root' child) and unshared by block device 'sdb' (uses node 'null' as 'root' child)."}}
64 === Add a writable export ===
65 {"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}}
66 {"error": {"class": "GenericError", "desc": "Permission conflict on node 'fmt': permissions 'write' are both required by an unnamed block device (uses node 'fmt' as 'root' child) and unshared by block device 'sda' (uses node 'fmt' as 'root' child)."}}
67 {"execute": "device_del", "arguments": {"id": "sda"}}
69 {"data": {"device": "sda", "path": "/machine/peripheral/sda"}, "event": "DEVICE_DELETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
70 {"execute": "device_add", "arguments": {"drive": "fmt", "driver": "scsi-hd", "id": "sda", "share-rw": true}}
72 {"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}}
74 {"execute": "query-block-exports", "arguments": {}}
75 {"return": [{"id": "export1", "node-name": "fmt", "shutting-down": false, "type": "nbd"}, {"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]}
79 flags: 0x158f ( readonly flush fua df multi cache block-status-payload )
83 transaction size: 64-bit
84 available meta contexts: 1
87 description: This is the writable second export
89 flags: 0x1ded ( flush fua trim zeroes df multi cache fast-zero block-status-payload )
93 transaction size: 64-bit
94 available meta contexts: 1
98 === Connect qemu-io to export1, try removing exports ===
99 read 4096/4096 bytes at offset 0
100 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
102 wrote 4096/4096 bytes at offset 4096
103 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
105 {"execute": "block-export-del", "arguments": {"id": "export1"}}
106 {"error": {"class": "GenericError", "desc": "export 'export1' still in use"}}
107 {"execute": "block-export-del", "arguments": {"id": "export0"}}
109 [{"data": {"id": "export0"}, "event": "BLOCK_EXPORT_DELETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}]
110 {"execute": "query-block-exports", "arguments": {}}
111 {"return": [{"id": "export1", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]}
114 description: This is the writable second export
116 flags: 0x1ded ( flush fua trim zeroes df multi cache fast-zero block-status-payload )
120 transaction size: 64-bit
121 available meta contexts: 1
125 === Connect qemu-io again, try force removing ===
126 {"execute": "block-export-del", "arguments": {"id": "export1"}}
127 {"error": {"class": "GenericError", "desc": "export 'export1' still in use"}}
128 {"execute": "block-export-del", "arguments": {"id": "export1", "mode": "hard"}}
130 read failed: Input/output error
132 {"execute": "query-block-exports", "arguments": {}}
137 === Shut down QEMU ===