On Thu, Jul 07, 2016 at 06:04:16PM +0300, Maxim Perevedentsev wrote: > guestfs_set_uuid wants device as argument. > Moreover, btrfstune -U is unable to set uuid for subvolumes, > only unmounted partitions are supported. > > Here we skip btrfs subvolumes. > --- > sysprep/sysprep_operation_fs_uuids.ml | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/sysprep/sysprep_operation_fs_uuids.ml > b/sysprep/sysprep_operation_fs_uuids.ml > index ed4e81a..f125eb0 100644 > --- a/sysprep/sysprep_operation_fs_uuids.ml > +++ b/sysprep/sysprep_operation_fs_uuids.ml > @@ -30,13 +30,15 @@ let rec fs_uuids_perform g root side_effects = > List.iter (function > | _, "unknown" -> () > | dev, typ -> > - let new_uuid = Common_utils.uuidgen () in > - try > - g#set_uuid dev new_uuid > - with > - G.Error msg -> > - warning (f_"cannot set random UUID on filesystem %s type %s: %s") > - dev typ msg > + if not (is_btrfs_subvolume g dev) then ( > + let new_uuid = Common_utils.uuidgen () in > + try > + g#set_uuid dev new_uuid > + with > + G.Error msg -> > + warning (f_"cannot set random UUID on filesystem %s type %s: %s") > + dev typ msg > + ) > ) fses
This patch is fine, because we want to avoid settings UUIDs on btrfs subvolumes. However I'm not convinced that this means my statement before about set_uuid should take a Mountable instead of a Device is wrong. It could still be changed to take a Mountable, and either we'd have to document that setting UUID on a btrfs subvolume makes no sense, or we could have set_uuid refuse to work on a subvolume (only on the "main" btrfs subvolume, if there is such a thing). Anyway, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
