From 0267433484f5f4f85cdbe795735fe9864c0d9dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Cluseau?= Date: Mon, 21 Oct 2019 16:25:39 +1100 Subject: [PATCH] fix: PARTNAME override ID_PART_ENTRY_NAME MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When both PARTNAME and ID_PART_ENTRY_NAME are specified, rook takes PARTNAME in account, overriding ID_PART_ENTRY_NAME. As PARTNAME is not always updated by the kernel after sgdisk --change-name, it's better to do the opposite. It also makes GetDevicePartitions coherent with parsePartLabel (called by GetPartitionLabel). Signed-off-by: Mikaƫl Cluseau --- pkg/util/sys/device.go | 4 ++-- pkg/util/sys/device_test.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/util/sys/device.go b/pkg/util/sys/device.go index 0e97f10cc..e36010a21 100644 --- a/pkg/util/sys/device.go +++ b/pkg/util/sys/device.go @@ -134,10 +134,10 @@ func GetDevicePartitions(device string, executor exec.Executor) (partitions []Pa if err != nil { return nil, 0, err } - if v, ok := info["ID_PART_ENTRY_NAME"]; ok { + if v, ok := info["PARTNAME"]; ok { p.Label = v } - if v, ok := info["PARTNAME"]; ok { + if v, ok := info["ID_PART_ENTRY_NAME"]; ok { p.Label = v } if v, ok := info["ID_FS_TYPE"]; ok { diff --git a/pkg/util/sys/device_test.go b/pkg/util/sys/device_test.go index 0526a3fd7..f58a02a51 100644 --- a/pkg/util/sys/device_test.go +++ b/pkg/util/sys/device_test.go @@ -81,6 +81,7 @@ ID_WWN_WITH_EXTENSION=0x600140568c0bd28d4ee43769387c9f02 MAJOR=8 MINOR=35 PARTN=3 +PARTNAME=Linux filesystem SUBSYSTEM=block ` )