Hello everyone!
I have an issue with OpenSUSE-42.1 (I guess this is the only distro with
btrfs snapshots by default).
As we remember, list_filesystems returns btrfs snapshots along with devices.
<fs> list-filesystems
/dev/sda1: swap
btrfsvol:/dev/sda2/@: btrfs
btrfsvol:/dev/sda2/@/.snapshots: btrfs
btrfsvol:/dev/sda2/@/.snapshots/1/snapshot: btrfs
btrfsvol:/dev/sda2/@/.snapshots/2/snapshot: btrfs
...
btrfsvol:/dev/sda2/@/.snapshots/16/snapshot: btrfs
/dev/sda2: btrfs
The btrfs snapshots are not block devices, so an error is thrown by
RESOLVE_DEVICE macro in stubs.c. That means we will get an error
trying to call blockdev - oriented functions at these devices.
=========================
After grepping "list_filesystems" issues were found in:
- virt-sparsify (in-place and copying): is_lv
- virt-filesystems: blockdev_getsize64
- virt-cat (inspect_os) treats this as multiboot system and refuses to
proceed
- virt-rescue --suggest suggests all snapshots (maybe this is correct)
- virt-sysprep --operation fs-uuids goes into infinite loop
[ 144.2] Performing "fs-uuids" ...
virt-sysprep: warning: cannot set random UUID on filesystem
btrfsvol:/dev/sda2/@/.snapshots/16/snapshot type btrfs: set_uuid:
set_uuid_stub: btrfsvol:/dev/sda2/@/.snapshots/16/snapshot: expecting a
device name
...
virt-sysprep: warning: cannot set random UUID on filesystem
btrfsvol:/dev/sda2/@/.snapshots/1/snapshot type btrfs: set_uuid:
set_uuid_stub: btrfsvol:/dev/sda2/@/.snapshots/1/snapshot: expecting a
device name
virt-sysprep: warning: cannot set random UUID on filesystem
btrfsvol:/dev/sda2/@/.snapshots type btrfs: set_uuid: set_uuid_stub:
btrfsvol:/dev/sda2/@/.snapshots: expecting a device name
virt-sysprep: warning: cannot set random UUID on filesystem
btrfsvol:/dev/sda2/@ type btrfs: set_uuid: set_uuid_stub:
btrfsvol:/dev/sda2/@: expecting a device name
[ 154.4] Performing "fs-uuids" ...
=========================
I'd like to ask for your comments on fixing this.
Should we
1. add a new command (guestfs_list_filesystems_devices) to return only
device-like filesystems?
2. add something like guestfs_is_device which handles subvolumes on host
side?
NB: guestfs_is_blockdev also fails on stub
3. allow guestfs_is_(blockdev|chardev|...) to check subvolumes on host
side? (maybe together with 2?)
4. anything else?
Thank you!
--
Your sincerely,
Maxim Perevedentsev