1wrote 4096/4096 bytes at offset 0 24 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 3 4=== Launch VM === 5{"execute": "nbd-server-start", "arguments": {"addr": {"data": {"path": "SOCK_DIR/PID-socket"}, "type": "unix"}}} 6{"return": {}} 7{"execute": "query-block-exports", "arguments": {}} 8{"return": []} 9 10=== Create a read-only NBD export === 11{"execute": "block-export-add", "arguments": {"id": "export0", "node-name": "fmt", "type": "nbd"}} 12{"return": {}} 13{"execute": "query-block-exports", "arguments": {}} 14{"return": [{"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]} 15exports available: 1 16 export: 'fmt' 17 size: 67108864 18 flags: 0x58f ( readonly flush fua df multi cache ) 19 min block: XXX 20 opt block: XXX 21 max block: XXX 22 available meta contexts: 1 23 base:allocation 24 25 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"}]} 37 38=== Move export to an iothread === 39{"execute": "device_add", "arguments": {"drive": "fmt", "driver": "scsi-hd", "id": "sda"}} 40{"return": {}} 41{"execute": "query-block-exports", "arguments": {}} 42{"return": [{"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]} 43exports available: 1 44 export: 'fmt' 45 size: 67108864 46 flags: 0x58f ( readonly flush fua df multi cache ) 47 min block: XXX 48 opt block: XXX 49 max block: XXX 50 available meta contexts: 1 51 base:allocation 52 53 54=== Add export with conflicting iothread === 55{"execute": "device_add", "arguments": {"drive": "null", "driver": "scsi-hd", "id": "sdb"}} 56{"return": {}} 57{"execute": "block-export-add", "arguments": {"fixed-iothread": true, "id": "export1", "iothread": "iothread1", "node-name": "null", "type": "nbd", "writable": true}} 58{"error": {"class": "GenericError", "desc": "Cannot change iothread of active block backend"}} 59{"execute": "block-export-add", "arguments": {"fixed-iothread": false, "id": "export1", "iothread": "iothread1", "node-name": "null", "type": "nbd", "writable": true}} 60{"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)."}} 61 62=== Add a writable export === 63{"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{"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)."}} 65{"execute": "device_del", "arguments": {"id": "sda"}} 66{"return": {}} 67{"data": {"device": "sda", "path": "/machine/peripheral/sda"}, "event": "DEVICE_DELETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} 68{"execute": "device_add", "arguments": {"drive": "fmt", "driver": "scsi-hd", "id": "sda", "share-rw": true}} 69{"return": {}} 70{"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}} 71{"return": {}} 72{"execute": "query-block-exports", "arguments": {}} 73{"return": [{"id": "export1", "node-name": "fmt", "shutting-down": false, "type": "nbd"}, {"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]} 74exports available: 2 75 export: 'fmt' 76 size: 67108864 77 flags: 0x58f ( readonly flush fua df multi cache ) 78 min block: XXX 79 opt block: XXX 80 max block: XXX 81 available meta contexts: 1 82 base:allocation 83 export: 'export1' 84 description: This is the writable second export 85 size: 67108864 86 flags: 0xded ( flush fua trim zeroes df multi cache fast-zero ) 87 min block: XXX 88 opt block: XXX 89 max block: XXX 90 available meta contexts: 1 91 base:allocation 92 93 94=== Connect qemu-io to export1, try removing exports === 95read 4096/4096 bytes at offset 0 964 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 97 98wrote 4096/4096 bytes at offset 4096 994 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 100 101{"execute": "block-export-del", "arguments": {"id": "export1"}} 102{"error": {"class": "GenericError", "desc": "export 'export1' still in use"}} 103{"execute": "block-export-del", "arguments": {"id": "export0"}} 104{"return": {}} 105[{"data": {"id": "export0"}, "event": "BLOCK_EXPORT_DELETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}] 106{"execute": "query-block-exports", "arguments": {}} 107{"return": [{"id": "export1", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]} 108exports available: 1 109 export: 'export1' 110 description: This is the writable second export 111 size: 67108864 112 flags: 0xded ( flush fua trim zeroes df multi cache fast-zero ) 113 min block: XXX 114 opt block: XXX 115 max block: XXX 116 available meta contexts: 1 117 base:allocation 118 119 120=== Connect qemu-io again, try force removing === 121{"execute": "block-export-del", "arguments": {"id": "export1"}} 122{"error": {"class": "GenericError", "desc": "export 'export1' still in use"}} 123{"execute": "block-export-del", "arguments": {"id": "export1", "mode": "hard"}} 124{"return": {}} 125read failed: Input/output error 126 127{"execute": "query-block-exports", "arguments": {}} 128{"return": []} 129exports available: 0 130 131 132=== Shut down QEMU === 133