|
48 | 48 | (builtins.head xs // { index = n; }) |
49 | 49 | ] ++ (enumerate (n + 1) (builtins.tail xs)); |
50 | 50 |
|
| 51 | + virtioblkOffset = 4; |
| 52 | + virtiofsOffset = virtioblkOffset + builtins.length microvmConfig.volumes; |
| 53 | + |
51 | 54 | forwardPortsOptions = |
52 | 55 | let |
53 | 56 | forwardingOptions = lib.flip lib.concatMapStrings forwardPorts |
|
89 | 92 | "-device" "virtio-blk-${devType 2},drive=store,id=blk_store" |
90 | 93 | ] ++ |
91 | 94 | lib.optionals (socket != null) [ "-qmp" "unix:${socket},server,nowait" ] ++ |
92 | | - builtins.concatMap ({ image, letter, serial, direct, ... }: [ |
93 | | - "-drive" "id=vd${letter},format=raw,file=${image},aio=io_uring,direct=${if direct then "on" else "off"}" |
94 | | - "-device" "virtio-blk-${devType 4},drive=vd${letter},id=blk_vd${letter}${ |
| 95 | + builtins.concatMap ({ index, image, letter, serial, direct, ... }: [ |
| 96 | + "-drive" |
| 97 | + "id=vd${ |
| 98 | + letter |
| 99 | + },format=raw,if=none,aio=io_uring,file=${ |
| 100 | + image |
| 101 | + },direct=${ |
| 102 | + if direct then "on" else "off" |
| 103 | + }" |
| 104 | + "-device" |
| 105 | + "virtio-blk-${ |
| 106 | + devType (virtioblkOffset + index) |
| 107 | + },drive=vd${ |
| 108 | + letter |
| 109 | + },id=blk_vd${ |
| 110 | + letter |
| 111 | + }${ |
95 | 112 | lib.optionalString (serial != null) ",serial=${serial}" |
96 | 113 | }" |
97 | | - ]) volumes ++ |
| 114 | + ]) (enumerate 0 volumes) ++ |
98 | 115 | lib.optionals (shares != []) ( |
99 | 116 | builtins.concatMap ({ proto, index, socket, source, tag, ... }: { |
100 | 117 | "virtiofs" = [ |
101 | | - "-chardev" "socket,id=fs${toString index},path=${socket}" |
102 | | - "-device" "vhost-user-fs-${devType (5 + index)},chardev=fs${toString index},tag=${tag},id=fs${toString index}" |
| 118 | + "-chardev" |
| 119 | + "socket,id=fs${toString index},path=${socket}" |
| 120 | + "-device" |
| 121 | + "vhost-user-fs-${devType (virtiofsOffset + index)},chardev=fs${toString index},tag=${tag},id=fs${toString index}" |
103 | 122 | ]; |
104 | 123 | }.${proto}) (enumerate 0 shares) |
105 | 124 | ) |
|
0 commit comments