File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,11 @@ func (bp *blkidProbe) FillBlockDeviceDetails(bd *blockdevice.BlockDevice) {
6969 // Fortunately, the `libblkid` version in our base container (ubuntu 16.04)
7070 // is `2.27.1`, will provide `PTUUID` tag, so we should fetch `PTUUID` from `blkid`.
7171 if len (bd .PartitionInfo .PartitionTableUUID ) == 0 {
72- bd .PartitionInfo .PartitionTableUUID = di .GetPartitionUUID ()
72+ bd .PartitionInfo .PartitionTableUUID = di .GetPartitionTableUUID ()
73+ }
74+
75+ // PARTUUID also is fetched using blkid, if udev is unable to get the data
76+ if len (bd .PartitionInfo .PartitionEntryUUID ) == 0 {
77+ bd .PartitionInfo .PartitionEntryUUID = di .GetPartitionEntryUUID ()
7378 }
7479}
Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ import (
3333const (
3434 fsTypeIdentifier = "TYPE"
3535 labelIdentifier = "LABEL"
36- partitionUUIDIdentifier = "PTUUID"
36+ partitionTableUUIDIdentifier = "PTUUID"
37+ partitionEntryUUIDIdentifier = "PARTUUID"
3738)
3839
3940type DeviceIdentifier struct {
@@ -52,10 +53,15 @@ func (di *DeviceIdentifier) GetOnDiskLabel() string {
5253 return di .GetTagValue (labelIdentifier )
5354}
5455
55- // GetPartitionUUID returns the partition UUID present on the disk by reading from the disk
56+ // GetPartitionTableUUID returns the partition table UUID present on the disk by reading from the disk
5657// using libblkid
57- func (di * DeviceIdentifier ) GetPartitionUUID () string {
58- return di .GetTagValue (partitionUUIDIdentifier )
58+ func (di * DeviceIdentifier ) GetPartitionTableUUID () string {
59+ return di .GetTagValue (partitionTableUUIDIdentifier )
60+ }
61+
62+ // GetPartitionEntryUUID returns the UUID of the partition, by reading from the disk using libblkid
63+ func (di * DeviceIdentifier ) GetPartitionEntryUUID () string {
64+ return di .GetTagValue (partitionEntryUUIDIdentifier )
5965}
6066
6167func (di * DeviceIdentifier ) GetTagValue (tag string ) string {
You can’t perform that action at this time.
0 commit comments