diff --git a/toolkit/tools/imagecustomizerapi/mountidentifiertype.go b/toolkit/tools/imagecustomizerapi/mountidentifiertype.go index 3f9ae357c..c5e45ade6 100644 --- a/toolkit/tools/imagecustomizerapi/mountidentifiertype.go +++ b/toolkit/tools/imagecustomizerapi/mountidentifiertype.go @@ -22,6 +22,8 @@ const ( MountIdentifierTypeOverlay MountIdentifierType = "overlay" + MountIdentifierTypeCustom MountIdentifierType = "custom" + // MountIdentifierTypeDefault uses the default type, which is PARTUUID. MountIdentifierTypeDefault MountIdentifierType = "" ) diff --git a/toolkit/tools/pkg/imagecustomizerlib/partitionutils.go b/toolkit/tools/pkg/imagecustomizerlib/partitionutils.go index 05c1b02f4..717b4ad5e 100644 --- a/toolkit/tools/pkg/imagecustomizerlib/partitionutils.go +++ b/toolkit/tools/pkg/imagecustomizerlib/partitionutils.go @@ -313,7 +313,8 @@ func findSourcePartitionHelper(source string, var partitionIndex int if mountIdType != imagecustomizerapi.MountIdentifierTypeDeviceMapper && - mountIdType != imagecustomizerapi.MountIdentifierTypeOverlay { + mountIdType != imagecustomizerapi.MountIdentifierTypeOverlay && + mountIdType != imagecustomizerapi.MountIdentifierTypeCustom { partition, partitionIndex, err = findPartition(mountIdType, mountId, partitions) if err != nil { return imagecustomizerapi.MountIdentifierTypeDefault, diskutils.PartitionInfo{}, 0, err @@ -378,6 +379,11 @@ func parseSourcePartition(source string) (imagecustomizerapi.MountIdentifierType return imagecustomizerapi.MountIdentifierTypeDeviceMapper, deviceMapperValue, nil } + _, isDeviceCustom := strings.CutPrefix(source, "/dev/disk") + if isDeviceCustom { + return imagecustomizerapi.MountIdentifierTypeCustom, "", nil + } + if source == "overlay" { return imagecustomizerapi.MountIdentifierTypeOverlay, "", nil }