ublk-org / ublksrv

ublk: userspace block device driver
MIT License
138 stars 47 forks source link

failed to create ublk device with qcow2 #67

Open zhongchanghui opened 5 months ago

zhongchanghui commented 5 months ago

I can not create ublk device with qcow2,

# qemu-img create -f qcow2 ublk_qcow2.qcow2 10G
Formatting 'ublk_qcow2.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=10737418240 lazy_refcounts=off refcount_bits=16
# ublk add -t qcow2 -f ublk_qcow2.qcow2
start dev 0 daemon failed, ret -1
#
# ublk -v
ublksrv 1.1-10-g6550517

and the testing generic/003 ,generic/005 all hit this issue:

running generic/003
    mount/umount /dev/ublkb0(ublk -t loop -q 2 -g 0 -f /mnt/tests/gitlab.com/redhat/centos-stream/tests/kernel/kernel-tests/-/archive/main/kernel-tests-main.zip/storage/block/RHEL_2107_ublk_testing/ubdsrv/tests/tmp/ublk_loop_null_1G_P1zCV) with fstype(xfs)...ok
    mount/umount /dev/ublkb0(ublk -t loop -q 2 -g 1 -f /mnt/tests/gitlab.com/redhat/centos-stream/tests/kernel/kernel-tests/-/archive/main/kernel-tests-main.zip/storage/block/RHEL_2107_ublk_testing/ubdsrv/tests/tmp/ublk_loop_null_1G_P1zCV) with fstype(xfs)...ok
    mount/umount /dev/ublkb0(ublk -t qcow2 -q 1 -g 0 -f /mnt/tests/gitlab.com/redhat/centos-stream/tests/kernel/kernel-tests/-/archive/main/kernel-tests-main.zip/storage/block/RHEL_2107_ublk_testing/ubdsrv/tests/tmp/ublk_null_1G_HA4aN.qcow2) with fstype(xfs)...failed
    mount/umount /dev/ublkb0(ublk -t qcow2 -q 1 -g 1 -f /mnt/tests/gitlab.com/redhat/centos-stream/tests/kernel/kernel-tests/-/archive/main/kernel-tests-main.zip/storage/block/RHEL_2107_ublk_testing/ubdsrv/tests/tmp/ublk_null_1G_HA4aN.qcow2) with fstype(xfs)...failed
    mount/umount /dev/ublkb0(ublk -t nbd -q 1 -g 0 -d 127 --host 127.0.0.1) with fstype(xfs)...failed
    mount/umount /dev/ublkb0(ublk -t nbd -q 1 -g 1 -d 127 --host 127.0.0.1) with fstype(xfs)...failed

running generic/005
    run fio with dev recovery, type 1:
    (1)kill all ubq_deamon, (2)recover with new ubq_daemon, (3)delete dev
    run fio with killing /dev/ublkb0(ublk add -t null -q 2 -u 1 -g 1 -r 1 -i 0 ) queue daemon 1
    run fio with killing /dev/ublkb0(ublk add -t null -q 2 -u 1 -g 1 -r 1 -i 1 ) queue daemon 1
    run fio with killing /dev/ublkb0(ublk add -t loop -q 2 -u 1 -g 1 -r 1 -i 0 -f /mnt/tests/gitlab.com/redhat/centos-stream/tests/kernel/kernel-tests/-/archive/main/kernel-tests-main.zip/storage/block/RHEL_2107_ublk_testing/ubdsrv/tests/tmp/ublk_loop_null_256M_7rATm) queue daemon 1
    run fio with killing /dev/ublkb0(ublk add -t loop -q 2 -u 1 -g 1 -r 1 -i 1 -f /mnt/tests/gitlab.com/redhat/centos-stream/tests/kernel/kernel-tests/-/archive/main/kernel-tests-main.zip/storage/block/RHEL_2107_ublk_testing/ubdsrv/tests/tmp/ublk_loop_null_256M_RQNoP) queue daemon 1
    run fio with killing /dev/ublkb0(ublk add -t qcow2 -q 1 -u 1 -g 1 -r 1 -i 0 -f /mnt/tests/gitlab.com/redhat/centos-stream/tests/kernel/kernel-tests/-/archive/main/kernel-tests-main.zip/storage/block/RHEL_2107_ublk_testing/ubdsrv/tests/tmp/ublk_null_256M_qWWtG.qcow2) queue daemon 1
can't get dev info from 0: -19
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
can't get dev info from 0: -19
can't get dev info from 0: -19
can't get dev info from 0: -19
can't get dev info from 0: -19
can't get dev info from 0: -19
can't get dev info from 0: -19
can't get dev info from 0: -19
can't get dev info from 0: -19
can't get dev info from 0: -19
can't get dev info from 0: -19
can't get dev info from 0
can't get dev info from 0
can't get dev info from 0
ming1 commented 4 months ago

Hi Changhui,

For nbd test failure, please check if nbdkit is installed.

For qcow2 test, please ignore it, since I plan to remove qcow2 from ublksrv project and all qcow2 related tests.

And please test rublk from user viewpoint if you are interested, which is supposed for production uses.

https://github.com/ublk-org/rublk

Thanks,

zhongchanghui commented 4 months ago

Hi,Ming

got it,thanks for reply, what is the difference between rublk and ublksrv? it looks like their commands are similar, just rublk write by rust. if I test rublk I only need to install rublk when testing,and I don’t need to compile and install ublksrv?

Thanks,

ming1 commented 4 months ago

Hi,Ming

got it,thanks for reply, what is the difference between rublk and ublksrv?

rublk is re-written by Rust, and IMO, Rust is:

it looks like their commands are similar, just rublk write by rust.

Yes, but rublk supports more command line parameters, and Rust's command line and json processing is stronger.

if I test rublk I only need to install rublk when testing,and I don’t need to compile and install ublksrv?

There are two ways:

1) test the 'rublk' from 'crates' directly

2) test 'rublk' from github https://github.com/ublk-org/rublk

Also blktests support to run test over rublk if 'rublk' is installed on test machine, and we can add more tests for covering rublk

Thanks,

ming1 commented 4 months ago

I can not create ublk device with qcow2,

# qemu-img create -f qcow2 ublk_qcow2.qcow2 10G
Formatting 'ublk_qcow2.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=10737418240 lazy_refcounts=off refcount_bits=16
# ublk add -t qcow2 -f ublk_qcow2.qcow2
start dev 0 daemon failed, ret -1
#
# ublk -v
ublksrv 1.1-10-g6550517

Hi Changhui,

I can't reproduce the issue, maybe io_uring doesn't work in your environment?

Thanks,

zhongchanghui commented 4 months ago

Hi,Ming

not sure why happen this, but loop/null works well at that time. and now I checked new test with ublksrv, all looks good, if I hit again next time, I can share my test machine with you

Thanks,