Skip to content

Commit f52c8e6

Browse files
authored
Partial revert of "Toolkit: Add missing flock calls. (#10804)". (#10917)
Reverting toolkit/imager changes in #10804. Leaving off the changes to image customizer to avoid conflicts with #10902,
1 parent 918bcf0 commit f52c8e6

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

toolkit/tools/imagegen/diskutils/diskutils.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ func CreatePartitions(diskDevPath string, disk configuration.Disk, rootEncryptio
492492
return partDevPathMap, partIDToFsTypeMap, encryptedRoot, readOnlyRoot, err
493493
}
494494

495-
partFsType, err := formatSinglePartition(diskDevPath, partDevPath, partition)
495+
partFsType, err := FormatSinglePartition(partDevPath, partition)
496496
if err != nil {
497497
err = fmt.Errorf("failed to format partition:\n%w", err)
498498
return partDevPathMap, partIDToFsTypeMap, encryptedRoot, readOnlyRoot, err
@@ -792,13 +792,12 @@ func setGptPartitionType(partition configuration.Partition, timeoutInSeconds, di
792792
return
793793
}
794794

795-
// formatSinglePartition formats the given partition to the type specified in the partition configuration
796-
func formatSinglePartition(diskDevPath string, partDevPath string, partition configuration.Partition,
795+
// FormatSinglePartition formats the given partition to the type specified in the partition configuration
796+
func FormatSinglePartition(partDevPath string, partition configuration.Partition,
797797
) (fsType string, err error) {
798798
const (
799-
totalAttempts = 5
800-
retryDuration = time.Second
801-
timeoutInSeconds = "5"
799+
totalAttempts = 5
800+
retryDuration = time.Second
802801
)
803802

804803
fsType = partition.FsType
@@ -814,14 +813,14 @@ func formatSinglePartition(diskDevPath string, partDevPath string, partition con
814813
fsType = "vfat"
815814
}
816815

817-
mkfsArgs := []string{"--timeout", timeoutInSeconds, diskDevPath, "mkfs", "-t", fsType}
816+
mkfsArgs := []string{"-t", fsType}
818817
mkfsArgs = append(mkfsArgs, mkfsOptions...)
819818
mkfsArgs = append(mkfsArgs, partDevPath)
820819

821820
err = retry.Run(func() error {
822-
_, stderr, err := shell.Execute("flock", mkfsArgs...)
821+
_, stderr, err := shell.Execute("mkfs", mkfsArgs...)
823822
if err != nil {
824-
logger.Log.Warnf("Failed to format partition using mkfs (and flock): %v", stderr)
823+
logger.Log.Warnf("Failed to format partition using mkfs: %v", stderr)
825824
return err
826825
}
827826

0 commit comments

Comments
 (0)