Skip to content

Commit

Permalink
use UUID instead of LABEL for better identification for partitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Omarabdul3ziz committed Dec 2, 2024
1 parent 6117a0f commit 5e82a32
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/storage/filesystem/btrfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (p *btrfsPool) Device() DeviceInfo {
}

func (p *btrfsPool) prepare() error {
p.name = p.device.Label
p.name = p.device.UUID
if p.device.Used() {
// device already have filesystem
return nil
Expand Down
3 changes: 2 additions & 1 deletion pkg/storage/filesystem/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type DeviceInfo struct {
Filesystem FSType `json:"fstype"`
Rota bool `json:"rota"`
Subsystems string `json:"subsystems"`
UUID string `json:"uuid"`
Children []DeviceInfo `json:"children,omitempty"`
}

Expand Down Expand Up @@ -168,7 +169,7 @@ func (l *lsblkDeviceManager) lsblk(ctx context.Context) ([]DeviceInfo, error) {
args := []string{
"--json",
"-o",
"PATH,NAME,SIZE,SUBSYSTEMS,FSTYPE,LABEL,ROTA",
"PATH,NAME,SIZE,SUBSYSTEMS,FSTYPE,LABEL,ROTA,UUID",
"--bytes",
"--exclude",
"1,2,11",
Expand Down
4 changes: 1 addition & 3 deletions pkg/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ const (
cacheGrowPercent = 60
cacheShrinkPercent = 20
cacheCheckDuration = 5 * time.Minute

PXELABEL = "ZOSPXE"
)

var (
Expand Down Expand Up @@ -201,7 +199,7 @@ func (s *Module) mountPool(device filesystem.DeviceInfo, vm bool) {
log.Debug().Str("path", device.Path).Msg("mounting device")

if device.IsPXEPartition() {
log.Error().Str("device", device.Path).Msg("device has 'zospxe' label")
log.Info().Str("device", device.Path).Msg("device has 'ZOSPXE' label")
s.brokenDevices = append(s.brokenDevices, pkg.BrokenDevice{Path: device.Path, Err: fmt.Errorf("device is a PXE partition")})
return
}
Expand Down

0 comments on commit 5e82a32

Please sign in to comment.