distro/rhel9: define qcow2 image type in function
The global qcow2ImgType was unconfigured and meant to be used by calling the mkQcow2ImgType() function. In the distro initialisation code, the new variable created from the mkQcow2ImgType() function with the configuration was shadowing the global variable. This can lead to errors in the future where it's not clear which variable is used where. Putting the definition in a function makes it impossible to use without configuring.
This commit is contained in:
parent
7da0cde855
commit
6374ec022d
1 changed files with 16 additions and 18 deletions
|
|
@ -8,23 +8,6 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
qcow2ImgType = imageType{
|
||||
name: "qcow2",
|
||||
filename: "disk.qcow2",
|
||||
mimeType: "application/x-qemu-disk",
|
||||
kernelOptions: "console=tty0 console=ttyS0,115200n8 no_timer_check net.ifnames=0",
|
||||
packageSets: map[string]packageSetFunc{
|
||||
osPkgsKey: qcow2CommonPackageSet,
|
||||
},
|
||||
bootable: true,
|
||||
defaultSize: 10 * common.GibiByte,
|
||||
image: liveImage,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "qcow2"},
|
||||
exports: []string{"qcow2"},
|
||||
basePartitionTables: defaultBasePartitionTables,
|
||||
}
|
||||
|
||||
openstackImgType = imageType{
|
||||
name: "openstack",
|
||||
filename: "disk.qcow2",
|
||||
|
|
@ -167,7 +150,22 @@ func qcowImageConfig(d distribution) *distro.ImageConfig {
|
|||
}
|
||||
|
||||
func mkQcow2ImgType(d distribution) imageType {
|
||||
it := qcow2ImgType
|
||||
it := imageType{
|
||||
name: "qcow2",
|
||||
filename: "disk.qcow2",
|
||||
mimeType: "application/x-qemu-disk",
|
||||
kernelOptions: "console=tty0 console=ttyS0,115200n8 no_timer_check net.ifnames=0",
|
||||
packageSets: map[string]packageSetFunc{
|
||||
osPkgsKey: qcow2CommonPackageSet,
|
||||
},
|
||||
bootable: true,
|
||||
defaultSize: 10 * common.GibiByte,
|
||||
image: liveImage,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "qcow2"},
|
||||
exports: []string{"qcow2"},
|
||||
basePartitionTables: defaultBasePartitionTables,
|
||||
}
|
||||
it.defaultImageConfig = qcowImageConfig(d)
|
||||
return it
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue