On Wed, Jul 06, 2016 at 05:33:01PM +0300, Maxim Perevedentsev wrote:
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
The specific problem is that set_uuid is declared to take a Device as
the first parameter [see generator/action.ml], whereas I believe it
should take a Mountable instead.
Compare it to how vfs_uuid is declared in the same file.
This is simply a bug in generator/action.ml, and I believe a simple
one line patch should fix it.
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?
Number 4.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW