disk: remove old unused CreatePartitionTable() function
The new `disk.NewPartitionTable` function is now used in all places and thus `CreatePartitionTable` can be removed; do so.
This commit is contained in:
parent
a95d7de9d9
commit
d3b4349c63
1 changed files with 0 additions and 45 deletions
|
|
@ -1,11 +1,5 @@
|
|||
package disk
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
)
|
||||
|
||||
const (
|
||||
BIOSBootPartitionGUID = "21686148-6449-6E6F-744E-656564454649"
|
||||
BIOSBootPartitionUUID = "FAC7F1FB-3E8D-4137-A512-961DE09A5549"
|
||||
|
|
@ -19,42 +13,3 @@ const (
|
|||
|
||||
RootPartitionUUID = "6264D520-3FB9-423F-8AB8-7A0A8E3D3562"
|
||||
)
|
||||
|
||||
func CreatePartitionTable(
|
||||
mountpoints []blueprint.FilesystemCustomization,
|
||||
imageSize uint64,
|
||||
basePartitionTable *PartitionTable,
|
||||
rng *rand.Rand,
|
||||
) (PartitionTable, error) {
|
||||
|
||||
// we are modifying the contents of the base partition table,
|
||||
// including the file systems, which are shared among shallow
|
||||
// copies of the partition table, so make a copy first
|
||||
table, cloneOk := basePartitionTable.Clone().(*PartitionTable)
|
||||
if !cloneOk {
|
||||
panic("PartitionTable.Clone() returned an Entity that cannot be converted to *PartitionTable; this is a programming error")
|
||||
}
|
||||
|
||||
for _, m := range mountpoints {
|
||||
// if we already have a partition ensure that the
|
||||
// size is at least the requested size, otherwise
|
||||
// create a new filesystem with that size
|
||||
part := table.FindPartitionForMountpoint(m.Mountpoint)
|
||||
if part != nil {
|
||||
part.EnsureSize(m.MinSize)
|
||||
} else {
|
||||
err := table.CreateFilesystem(m.Mountpoint, m.MinSize)
|
||||
if err != nil {
|
||||
return PartitionTable{}, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate partition table offsets and sizes
|
||||
table.relayout(imageSize)
|
||||
|
||||
// Generate new UUIDs for filesystems and partitions
|
||||
table.GenerateUUIDs(rng)
|
||||
|
||||
return *table, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue