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.
This commit is contained in:
Maxim Perevedentsev
2016-07-08 14:08:11 +03:00
committed by Richard W.M. Jones
parent f90185dfdf
commit 4e0dbf94e7

View File

@@ -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 = {