distro: use FindMountable() to get root filesystem
The `PartitionTable.FindMountable` method is the more generic version of `PartitionTable.RootFilesystem` which returns a `Mountable` interface, instead of a specific `Filesystem` object. This commit thus prepares for the more generic case, like when root is a Btrfs sub-volume. Co-Authored-By: Christian Kellner <christian@kellner.me>
This commit is contained in:
parent
b0899c5c59
commit
bd5b673a99
5 changed files with 18 additions and 10 deletions
|
|
@ -402,13 +402,13 @@ func (t *imageType) pipeline(c *blueprint.Customizations, options distro.ImageOp
|
|||
panic("s390x image must have a partition table, this is a programming error")
|
||||
}
|
||||
|
||||
rootFs := pt.RootFilesystem()
|
||||
rootFs := pt.FindMountable("/")
|
||||
if rootFs == nil {
|
||||
panic("s390x image must have a root filesystem, this is a programming error")
|
||||
}
|
||||
|
||||
p.AddStage(osbuild.NewKernelCmdlineStage(&osbuild.KernelCmdlineStageOptions{
|
||||
RootFsUUID: rootFs.UUID,
|
||||
RootFsUUID: rootFs.GetFSSpec().UUID,
|
||||
KernelOpts: t.kernelOptions,
|
||||
}))
|
||||
}
|
||||
|
|
@ -646,13 +646,13 @@ func (t *imageType) grub2StageOptions(pt *disk.PartitionTable, kernelOptions str
|
|||
if pt == nil {
|
||||
panic("partition table must be defined for grub2 stage, this is a programming error")
|
||||
}
|
||||
rootFs := pt.RootFilesystem()
|
||||
rootFs := pt.FindMountable("/")
|
||||
if rootFs == nil {
|
||||
panic("root filesystem must be defined for grub2 stage, this is a programming error")
|
||||
}
|
||||
|
||||
stageOptions := osbuild.GRUB2StageOptions{
|
||||
RootFilesystemUUID: uuid.MustParse(rootFs.UUID),
|
||||
RootFilesystemUUID: uuid.MustParse(rootFs.GetFSSpec().UUID),
|
||||
KernelOptions: kernelOptions,
|
||||
Legacy: legacy,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,11 +63,11 @@ func qcow2Pipelines(t *imageType, customizations *blueprint.Customizations, opti
|
|||
|
||||
func prependKernelCmdlineStage(pipeline *osbuild.Pipeline, t *imageType, pt *disk.PartitionTable) *osbuild.Pipeline {
|
||||
if t.arch.name == distro.S390xArchName {
|
||||
rootFs := pt.RootFilesystem()
|
||||
rootFs := pt.FindMountable("/")
|
||||
if rootFs == nil {
|
||||
panic("s390x image must have a root filesystem, this is a programming error")
|
||||
}
|
||||
kernelStage := osbuild.NewKernelCmdlineStage(osbuild.NewKernelCmdlineStageOptions(rootFs.UUID, t.kernelOptions))
|
||||
kernelStage := osbuild.NewKernelCmdlineStage(osbuild.NewKernelCmdlineStageOptions(rootFs.GetFSSpec().UUID, t.kernelOptions))
|
||||
pipeline.Stages = append([]*osbuild.Stage{kernelStage}, pipeline.Stages...)
|
||||
}
|
||||
return pipeline
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@ func qcow2Pipelines(t *imageType, customizations *blueprint.Customizations, opti
|
|||
|
||||
func prependKernelCmdlineStage(pipeline *osbuild.Pipeline, t *imageType, pt *disk.PartitionTable) *osbuild.Pipeline {
|
||||
if t.arch.name == distro.S390xArchName {
|
||||
rootFs := pt.RootFilesystem()
|
||||
rootFs := pt.FindMountable("/")
|
||||
if rootFs == nil {
|
||||
panic("s390x image must have a root filesystem, this is a programming error")
|
||||
}
|
||||
kernelStage := osbuild.NewKernelCmdlineStage(osbuild.NewKernelCmdlineStageOptions(rootFs.UUID, t.kernelOptions))
|
||||
kernelStage := osbuild.NewKernelCmdlineStage(osbuild.NewKernelCmdlineStageOptions(rootFs.GetFSSpec().UUID, t.kernelOptions))
|
||||
pipeline.Stages = append([]*osbuild.Stage{kernelStage}, pipeline.Stages...)
|
||||
}
|
||||
return pipeline
|
||||
|
|
|
|||
|
|
@ -41,7 +41,11 @@ func qcow2Pipelines(t *imageType, customizations *blueprint.Customizations, opti
|
|||
}
|
||||
|
||||
func prependKernelCmdlineStage(pipeline *osbuild.Pipeline, t *imageType, pt *disk.PartitionTable) *osbuild.Pipeline {
|
||||
rootFsUUID := pt.RootFilesystem().UUID
|
||||
rootFs := pt.FindMountable("/")
|
||||
if rootFs == nil {
|
||||
panic("root filesystem must be defined for kernel-cmdline stage, this is a programming error")
|
||||
}
|
||||
rootFsUUID := rootFs.GetFSSpec().UUID
|
||||
kernelStage := osbuild.NewKernelCmdlineStage(osbuild.NewKernelCmdlineStageOptions(rootFsUUID, t.kernelOptions))
|
||||
pipeline.Stages = append([]*osbuild.Stage{kernelStage}, pipeline.Stages...)
|
||||
return pipeline
|
||||
|
|
|
|||
|
|
@ -58,7 +58,11 @@ func qcow2Pipelines(t *imageType, customizations *blueprint.Customizations, opti
|
|||
}
|
||||
|
||||
func prependKernelCmdlineStage(pipeline *osbuild.Pipeline, t *imageType, pt *disk.PartitionTable) *osbuild.Pipeline {
|
||||
rootFsUUID := pt.RootFilesystem().UUID
|
||||
rootFs := pt.FindMountable("/")
|
||||
if rootFs == nil {
|
||||
panic("root filesystem must be defined for kernel-cmdline stage, this is a programming error")
|
||||
}
|
||||
rootFsUUID := rootFs.GetFSSpec().UUID
|
||||
kernelStage := osbuild.NewKernelCmdlineStage(osbuild.NewKernelCmdlineStageOptions(rootFsUUID, t.kernelOptions))
|
||||
pipeline.Stages = append([]*osbuild.Stage{kernelStage}, pipeline.Stages...)
|
||||
return pipeline
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue