[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] list-filesystems and btrfs snapshots



Richard and Cedric, thank you for your replies.


On 07/06/2016 09:11 PM, Richard W.M. Jones wrote:
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
I'll send a patch soon.
- 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.
I tried that, but this does not work.
btrfstune takes an unmounted filesystem as an argument.
It is impossible to change uuid for a subvolume. Passing a Mountable
results in setting different uuids to /dev/sda2  16 times.

I think it is better to skip subvolumes on this operation.


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.

Do I understand right that the right way of skipping btrfs subvolumes is
guestfs_mountable_device(fs) != NULL && guestfs_mountable_subvolume(fs) != NULL.

And we should add this code to every place where we need Device?


--
Your sincerely,
Maxim Perevedentsev


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]