From 4e0dbf94e77cf18d01e30a81d3bc4c007f64d4a4 Mon Sep 17 00:00:00 2001 From: Maxim Perevedentsev Date: Fri, 8 Jul 2016 14:08:11 +0300 Subject: [PATCH] sysprep: fix btrfs subvolume processing in fs-uuids 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 ed4e81a14..f125eb0d4 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 let op = {