fix: PARTNAME override ID_PART_ENTRY_NAME

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 <mikael.cluseau@gmail.com>
This commit is contained in:
Mikaël Cluseau authored and Mikaël Cluseau committed 2019-10-22 09:23:48 +11:00
1 parent b759b40364
commit 0267433484
2 files changed
+3 -2

No files matched your search

+2 -2
View File
@@ -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 {
+1
View File
@@ -81,6 +81,7 @@ ID_WWN_WITH_EXTENSION=0x600140568c0bd28d4ee43769387c9f02
MAJOR=8
MINOR=35
PARTN=3
PARTNAME=Linux filesystem
SUBSYSTEM=block
`
)