1f51af04cSKevin Wolfwrote 4096/4096 bytes at offset 0 2f51af04cSKevin Wolf4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 3f51af04cSKevin Wolf 4f51af04cSKevin Wolf=== Launch VM === 5f51af04cSKevin Wolf{"execute": "nbd-server-start", "arguments": {"addr": {"data": {"path": "SOCK_DIR/PID-socket"}, "type": "unix"}}} 6f51af04cSKevin Wolf{"return": {}} 7f51af04cSKevin Wolf{"execute": "query-block-exports", "arguments": {}} 8f51af04cSKevin Wolf{"return": []} 9f51af04cSKevin Wolf 10f51af04cSKevin Wolf=== Create a read-only NBD export === 11f51af04cSKevin Wolf{"execute": "block-export-add", "arguments": {"id": "export0", "node-name": "fmt", "type": "nbd"}} 12f51af04cSKevin Wolf{"return": {}} 13f51af04cSKevin Wolf{"execute": "query-block-exports", "arguments": {}} 14f51af04cSKevin Wolf{"return": [{"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]} 15f51af04cSKevin Wolfexports available: 1 16f51af04cSKevin Wolf export: 'fmt' 17f51af04cSKevin Wolf size: 67108864 18*2dcbb11bSEric Blake flags: 0x158f ( readonly flush fua df multi cache block-status-payload ) 19f51af04cSKevin Wolf min block: XXX 20f51af04cSKevin Wolf opt block: XXX 21f51af04cSKevin Wolf max block: XXX 2256cf9d04SEric Blake transaction size: 64-bit 23f51af04cSKevin Wolf available meta contexts: 1 24f51af04cSKevin Wolf base:allocation 25f51af04cSKevin Wolf 26f51af04cSKevin Wolf 27f51af04cSKevin Wolf=== Try a few invalid things === 28f51af04cSKevin Wolf{"execute": "block-export-add", "arguments": {"id": "#invalid", "node-name": "fmt", "type": "nbd"}} 29f51af04cSKevin Wolf{"error": {"class": "GenericError", "desc": "Invalid block export id"}} 30f51af04cSKevin Wolf{"execute": "block-export-add", "arguments": {"id": "export0", "node-name": "fmt", "type": "nbd"}} 31f51af04cSKevin Wolf{"error": {"class": "GenericError", "desc": "Block export id 'export0' is already in use"}} 32f51af04cSKevin Wolf{"execute": "block-export-add", "arguments": {"id": "export1", "node-name": "ro", "type": "nbd", "writable": true}} 33f51af04cSKevin Wolf{"error": {"class": "GenericError", "desc": "Cannot export read-only node as writable"}} 34f51af04cSKevin Wolf{"execute": "block-export-del", "arguments": {"id": "export1"}} 35f51af04cSKevin Wolf{"error": {"class": "GenericError", "desc": "Export 'export1' is not found"}} 36f51af04cSKevin Wolf{"execute": "query-block-exports", "arguments": {}} 37f51af04cSKevin Wolf{"return": [{"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]} 38f51af04cSKevin Wolf 39f51af04cSKevin Wolf=== Move export to an iothread === 40f51af04cSKevin Wolf{"execute": "device_add", "arguments": {"drive": "fmt", "driver": "scsi-hd", "id": "sda"}} 41f51af04cSKevin Wolf{"return": {}} 42f51af04cSKevin Wolf{"execute": "query-block-exports", "arguments": {}} 43f51af04cSKevin Wolf{"return": [{"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]} 44f51af04cSKevin Wolfexports available: 1 45f51af04cSKevin Wolf export: 'fmt' 46f51af04cSKevin Wolf size: 67108864 47*2dcbb11bSEric Blake flags: 0x158f ( readonly flush fua df multi cache block-status-payload ) 48f51af04cSKevin Wolf min block: XXX 49f51af04cSKevin Wolf opt block: XXX 50f51af04cSKevin Wolf max block: XXX 5156cf9d04SEric Blake transaction size: 64-bit 52f51af04cSKevin Wolf available meta contexts: 1 53f51af04cSKevin Wolf base:allocation 54f51af04cSKevin Wolf 55f51af04cSKevin Wolf 56d2147169SMax Reitz=== Add export with conflicting iothread === 57d2147169SMax Reitz{"execute": "device_add", "arguments": {"drive": "null", "driver": "scsi-hd", "id": "sdb"}} 58d2147169SMax Reitz{"return": {}} 59d2147169SMax Reitz{"execute": "block-export-add", "arguments": {"fixed-iothread": true, "id": "export1", "iothread": "iothread1", "node-name": "null", "type": "nbd", "writable": true}} 60d2147169SMax Reitz{"error": {"class": "GenericError", "desc": "Cannot change iothread of active block backend"}} 61d2147169SMax Reitz{"execute": "block-export-add", "arguments": {"fixed-iothread": false, "id": "export1", "iothread": "iothread1", "node-name": "null", "type": "nbd", "writable": true}} 62d2147169SMax Reitz{"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)."}} 63d2147169SMax Reitz 64f51af04cSKevin Wolf=== Add a writable export === 65f51af04cSKevin Wolf{"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}} 6630ebb9aaSVladimir Sementsov-Ogievskiy{"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)."}} 67f51af04cSKevin Wolf{"execute": "device_del", "arguments": {"id": "sda"}} 68f51af04cSKevin Wolf{"return": {}} 69f51af04cSKevin Wolf{"data": {"device": "sda", "path": "/machine/peripheral/sda"}, "event": "DEVICE_DELETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} 70f51af04cSKevin Wolf{"execute": "device_add", "arguments": {"drive": "fmt", "driver": "scsi-hd", "id": "sda", "share-rw": true}} 71f51af04cSKevin Wolf{"return": {}} 72f51af04cSKevin Wolf{"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}} 73f51af04cSKevin Wolf{"return": {}} 74f51af04cSKevin Wolf{"execute": "query-block-exports", "arguments": {}} 75f51af04cSKevin Wolf{"return": [{"id": "export1", "node-name": "fmt", "shutting-down": false, "type": "nbd"}, {"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]} 76f51af04cSKevin Wolfexports available: 2 77f51af04cSKevin Wolf export: 'fmt' 78f51af04cSKevin Wolf size: 67108864 79*2dcbb11bSEric Blake flags: 0x158f ( readonly flush fua df multi cache block-status-payload ) 80f51af04cSKevin Wolf min block: XXX 81f51af04cSKevin Wolf opt block: XXX 82f51af04cSKevin Wolf max block: XXX 8356cf9d04SEric Blake transaction size: 64-bit 84f51af04cSKevin Wolf available meta contexts: 1 85f51af04cSKevin Wolf base:allocation 86f51af04cSKevin Wolf export: 'export1' 87f51af04cSKevin Wolf description: This is the writable second export 88f51af04cSKevin Wolf size: 67108864 89*2dcbb11bSEric Blake flags: 0x1ded ( flush fua trim zeroes df multi cache fast-zero block-status-payload ) 90f51af04cSKevin Wolf min block: XXX 91f51af04cSKevin Wolf opt block: XXX 92f51af04cSKevin Wolf max block: XXX 9356cf9d04SEric Blake transaction size: 64-bit 94f51af04cSKevin Wolf available meta contexts: 1 95f51af04cSKevin Wolf base:allocation 96f51af04cSKevin Wolf 97f51af04cSKevin Wolf 98f51af04cSKevin Wolf=== Connect qemu-io to export1, try removing exports === 99f51af04cSKevin Wolfread 4096/4096 bytes at offset 0 100f51af04cSKevin Wolf4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 101f51af04cSKevin Wolf 102f51af04cSKevin Wolfwrote 4096/4096 bytes at offset 4096 103f51af04cSKevin Wolf4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 104f51af04cSKevin Wolf 105f51af04cSKevin Wolf{"execute": "block-export-del", "arguments": {"id": "export1"}} 106f51af04cSKevin Wolf{"error": {"class": "GenericError", "desc": "export 'export1' still in use"}} 107f51af04cSKevin Wolf{"execute": "block-export-del", "arguments": {"id": "export0"}} 108f51af04cSKevin Wolf{"return": {}} 109f51af04cSKevin Wolf[{"data": {"id": "export0"}, "event": "BLOCK_EXPORT_DELETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}] 110f51af04cSKevin Wolf{"execute": "query-block-exports", "arguments": {}} 111f51af04cSKevin Wolf{"return": [{"id": "export1", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]} 112f51af04cSKevin Wolfexports available: 1 113f51af04cSKevin Wolf export: 'export1' 114f51af04cSKevin Wolf description: This is the writable second export 115f51af04cSKevin Wolf size: 67108864 116*2dcbb11bSEric Blake flags: 0x1ded ( flush fua trim zeroes df multi cache fast-zero block-status-payload ) 117f51af04cSKevin Wolf min block: XXX 118f51af04cSKevin Wolf opt block: XXX 119f51af04cSKevin Wolf max block: XXX 12056cf9d04SEric Blake transaction size: 64-bit 121f51af04cSKevin Wolf available meta contexts: 1 122f51af04cSKevin Wolf base:allocation 123f51af04cSKevin Wolf 124f51af04cSKevin Wolf 125f51af04cSKevin Wolf=== Connect qemu-io again, try force removing === 126f51af04cSKevin Wolf{"execute": "block-export-del", "arguments": {"id": "export1"}} 127f51af04cSKevin Wolf{"error": {"class": "GenericError", "desc": "export 'export1' still in use"}} 128f51af04cSKevin Wolf{"execute": "block-export-del", "arguments": {"id": "export1", "mode": "hard"}} 129f51af04cSKevin Wolf{"return": {}} 130f51af04cSKevin Wolfread failed: Input/output error 131f51af04cSKevin Wolf 132f51af04cSKevin Wolf{"execute": "query-block-exports", "arguments": {}} 133f51af04cSKevin Wolf{"return": []} 134f51af04cSKevin Wolfexports available: 0 135f51af04cSKevin Wolf 136f51af04cSKevin Wolf 137f51af04cSKevin Wolf=== Shut down QEMU === 138