virt-install --name ubuntu18 --vcpus 4 --memory 2048 --disk path=ubuntu18.iso,bus=virtio,cache=writeback --graphics vnc,listen=0.0.0.0 --noautoconsole --os-variant=ubuntu18.10 --import --virt-type kvm
;; virsh 8.0.0
virsh attach-disk ubuntu18 --source foo --source-protocol nbd --source-host-name localhost:6666 --target vde
;; xml
<disk type='network'>
<source protocol='nbd' name='foo'>
<host name='localhost' port='6666'/>
</source>
<target dev='vde'/>
</disk>
;; virsh 6.0.0 doesn't support source-protocol, etc
virsh attach-device ubuntu18 --file nbd.xml --persistent --live ;; do we need persistent+live?
;; to cleanup
virsh destroy ubuntu18; virsh undefine ubuntu18
gonbdserver:[INFO] Loaded configuration. Available backends: aiofile, file, rbd.
gonbdserver:[INFO] Starting server tcp:127.0.0.1:6666
gonbdserver:[INFO] Starting listening on tcp:127.0.0.1:6666
gonbdserver:[INFO] Connect to tcp:127.0.0.1:6666 from 127.0.0.1:47774
> writing newStyleHeader: {5639144782019643715 5280542401877725268 3} 24
< reading client flags...
< reading client opt...
=> Read opt: 8
> write NBD_REP_ERR_UNSUP: {1100100111001001 8 2147483649 0} 24
< reading client opt...
=> Read opt: 7
<read NBD_OPT_GO>
< reading name length...
< reading numInfoElements...
< reading one infoElement...
find export [102 111 111]
Export: foo
|
> writing NBD_REP_INFO pt1: {1100100111001001 7 3 12} 24
> writing NBD_INFO_EXPORT: {0 4096000000 333} 24
> writing NBD_REP_INFO: {1100100111001001 7 3 5} 24
> writing NBD_INFO_NAME uint16(NBD_INFO_NAME) 1
> writing name [102 111 111] 24
> writing NBD_REP_INFO for description: {1100100111001001 7 3 2} 24
> writing NBD_INFO_DESCRIPTION uint16(NBD_INFO_DESCRIPTION) 2
> writing description [] 24
> writing NBD_REP_INFO: {1100100111001001 7 3 14} 24
> writing NBD_INFO_BLOCK_SIZE: {3 1 32768 134217728} 16
> writing ACK or error: {1100100111001001 7 1 0} 24
gonbdserver:[INFO] Negotiation succeeded with 127.0.0.1:47774/foo, serving with 5 worker(s)
...