| 1 | wrote 4096/4096 bytes at offset 0 |
| 2 | 4 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"}]} |
| 15 | exports available: 1 |
| 16 | export: 'fmt' |
| 17 | size: 67108864 |
| 18 | flags: 0x158f ( readonly flush fua df multi cache block-status-payload ) |
| 19 | min block: XXX |
| 20 | opt block: XXX |
| 21 | max block: XXX |
| 22 | transaction size: 64-bit |
| 23 | available meta contexts: 1 |
| 24 | base:allocation |
| 25 | |
| 26 | |
| 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"}]} |
| 38 | |
| 39 | === Move export to an iothread === |
| 40 | {"execute": "device_add", "arguments": {"drive": "fmt", "driver": "scsi-hd", "id": "sda"}} |
| 41 | {"return": {}} |
| 42 | {"execute": "query-block-exports", "arguments": {}} |
| 43 | {"return": [{"id": "export0", "node-name": "fmt", "shutting-down": false, "type": "nbd"}]} |
| 44 | exports available: 1 |
| 45 | export: 'fmt' |
| 46 | size: 67108864 |
| 47 | flags: 0x158f ( readonly flush fua df multi cache block-status-payload ) |
| 48 | min block: XXX |
| 49 | opt block: XXX |
| 50 | max block: XXX |
| 51 | transaction size: 64-bit |
| 52 | available meta contexts: 1 |
| 53 | base:allocation |
| 54 | |
| 55 | |
| 56 | === Add export with conflicting iothread === |
| 57 | {"execute": "device_add", "arguments": {"drive": "null", "driver": "scsi-hd", "id": "sdb"}} |
| 58 | {"return": {}} |
| 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)."}} |
| 63 | |
| 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"}} |
| 68 | {"return": {}} |
| 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}} |
| 71 | {"return": {}} |
| 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}} |
| 73 | {"return": {}} |
| 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"}]} |
| 76 | exports available: 2 |
| 77 | export: 'fmt' |
| 78 | size: 67108864 |
| 79 | flags: 0x158f ( readonly flush fua df multi cache block-status-payload ) |
| 80 | min block: XXX |
| 81 | opt block: XXX |
| 82 | max block: XXX |
| 83 | transaction size: 64-bit |
| 84 | available meta contexts: 1 |
| 85 | base:allocation |
| 86 | export: 'export1' |
| 87 | description: This is the writable second export |
| 88 | size: 67108864 |
| 89 | flags: 0x1ded ( flush fua trim zeroes df multi cache fast-zero block-status-payload ) |
| 90 | min block: XXX |
| 91 | opt block: XXX |
| 92 | max block: XXX |
| 93 | transaction size: 64-bit |
| 94 | available meta contexts: 1 |
| 95 | base:allocation |
| 96 | |
| 97 | |
| 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) |
| 101 | |
| 102 | wrote 4096/4096 bytes at offset 4096 |
| 103 | 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) |
| 104 | |
| 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"}} |
| 108 | {"return": {}} |
| 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"}]} |
| 112 | exports available: 1 |
| 113 | export: 'export1' |
| 114 | description: This is the writable second export |
| 115 | size: 67108864 |
| 116 | flags: 0x1ded ( flush fua trim zeroes df multi cache fast-zero block-status-payload ) |
| 117 | min block: XXX |
| 118 | opt block: XXX |
| 119 | max block: XXX |
| 120 | transaction size: 64-bit |
| 121 | available meta contexts: 1 |
| 122 | base:allocation |
| 123 | |
| 124 | |
| 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"}} |
| 129 | {"return": {}} |
| 130 | qemu-io: read failed: Input/output error |
| 131 | |
| 132 | {"execute": "query-block-exports", "arguments": {}} |
| 133 | {"return": []} |
| 134 | exports available: 0 |
| 135 | |
| 136 | |
| 137 | === Using multi-thread with NBD === |
| 138 | {"execute": "block-export-add", "arguments": {"id": "export0", "iothread": ["iothread0", "iothread1"], "node-name": "fmt", "type": "nbd"}} |
| 139 | {"error": {"class": "GenericError", "desc": "NBD export does not support multi-threading"}} |
| 140 | {"execute": "block-export-add", "arguments": {"id": "export0", "iothread": ["iothread0"], "node-name": "fmt", "type": "nbd"}} |
| 141 | {"error": {"class": "GenericError", "desc": "NBD export does not support multi-threading"}} |
| 142 | |
| 143 | === Empty thread list |
| 144 | {"execute": "block-export-add", "arguments": {"id": "export0", "iothread": [], "node-name": "fmt", "type": "nbd"}} |
| 145 | {"error": {"class": "GenericError", "desc": "The set of I/O threads must not be empty"}} |
| 146 | |
| 147 | === Non-existent thread name in list |
| 148 | {"execute": "block-export-add", "arguments": {"id": "export0", "iothread": ["iothread0", "nothread", "iothread1"], "node-name": "fmt", "type": "nbd"}} |
| 149 | {"error": {"class": "GenericError", "desc": "iothread \"nothread\" not found"}} |
| 150 | |
| 151 | === Multi-thread with fixed-iothread |
| 152 | {"execute": "block-export-add", "arguments": {"fixed-iothread": true, "id": "export0", "iothread": ["iothread0", "iothread1"], "node-name": "fmt", "type": "nbd"}} |
| 153 | {"error": {"class": "GenericError", "desc": "Cannot use fixed-iothread for a multi-threaded export"}} |
| 154 | |
| 155 | === Shut down QEMU === |