distro/rhel85: introduce the vmdk image type
This commit is contained in:
parent
2ef462bdaa
commit
ceba83dcca
5 changed files with 81 additions and 2 deletions
|
|
@ -461,6 +461,20 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
exports: []string{"vhd"},
|
||||
}
|
||||
|
||||
vmdkImgType := imageType{
|
||||
name: "vmdk",
|
||||
filename: "disk.vmdk",
|
||||
mimeType: "application/x-vmdk",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
"packages": vmdkCommonPackageSet(),
|
||||
},
|
||||
kernelOptions: "ro net.ifnames=0",
|
||||
bootable: true,
|
||||
defaultSize: 4 * GigaByte,
|
||||
pipelines: vmdkPipelines,
|
||||
exports: []string{"vmdk"},
|
||||
}
|
||||
|
||||
tarImgType := imageType{
|
||||
name: "tar",
|
||||
filename: "root.tar.xz",
|
||||
|
|
@ -520,7 +534,7 @@ func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
|||
exports: []string{"container"},
|
||||
}
|
||||
|
||||
x86_64.addImageTypes(qcow2ImgType, vhdImgType, tarImgType, tarInstallerImgTypeX86_64, edgeCommitImgTypeX86_64, edgeInstallerImgTypeX86_64, edgeOCIImgTypeX86_64)
|
||||
x86_64.addImageTypes(qcow2ImgType, vhdImgType, vmdkImgType, tarImgType, tarInstallerImgTypeX86_64, edgeCommitImgTypeX86_64, edgeInstallerImgTypeX86_64, edgeOCIImgTypeX86_64)
|
||||
aarch64.addImageTypes(qcow2ImgType, tarImgType, edgeCommitImgTypeAarch64, edgeOCIImgTypeAarch64)
|
||||
ppc64le.addImageTypes(qcow2ImgType, tarImgType)
|
||||
s390x.addImageTypes(qcow2ImgType, tarImgType)
|
||||
|
|
|
|||
|
|
@ -171,6 +171,19 @@ func vhdCommonPackageSet() rpmmd.PackageSet {
|
|||
}
|
||||
}
|
||||
|
||||
func vmdkCommonPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"@core", "chrony", "firewalld", "langpacks-en", "open-vm-tools",
|
||||
"selinux-policy-targeted",
|
||||
},
|
||||
Exclude: []string{
|
||||
"dracut-config-rescue", "rng-tools",
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// edge commit OS package set
|
||||
func edgeCommitCommonPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
|
|
|
|||
|
|
@ -98,6 +98,43 @@ func vhdPipelines(t *imageType, customizations *blueprint.Customizations, option
|
|||
return pipelines, nil
|
||||
}
|
||||
|
||||
func vmdkPipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
|
||||
pipelines := make([]osbuild.Pipeline, 0)
|
||||
pipelines = append(pipelines, *buildPipeline(repos, packageSetSpecs["build"]))
|
||||
treePipeline, err := osPipeline(repos, packageSetSpecs["packages"], customizations, options, t.enabledServices, t.disabledServices, t.defaultTarget)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if options.Subscription != nil {
|
||||
commands := []string{
|
||||
fmt.Sprintf("/usr/sbin/subscription-manager register --org=%d --activationkey=%s --serverurl %s --baseurl %s", options.Subscription.Organization, options.Subscription.ActivationKey, options.Subscription.ServerUrl, options.Subscription.BaseUrl),
|
||||
}
|
||||
if options.Subscription.Insights {
|
||||
commands = append(commands, "/usr/bin/insights-client --register")
|
||||
}
|
||||
treePipeline.AddStage(osbuild.NewFirstBootStage(&osbuild.FirstBootStageOptions{
|
||||
Commands: commands,
|
||||
WaitForNetwork: true,
|
||||
},
|
||||
))
|
||||
}
|
||||
partitionTable := defaultPartitionTable(options, t.arch, rng)
|
||||
treePipeline.AddStage(osbuild.NewFSTabStage(partitionTable.FSTabStageOptionsV2()))
|
||||
treePipeline.AddStage(osbuild.NewGRUB2Stage(grub2StageOptions(&partitionTable, t.kernelOptions, customizations.GetKernel(), packageSetSpecs["packages"], t.arch.uefi, t.arch.legacy)))
|
||||
pipelines = append(pipelines, *treePipeline)
|
||||
|
||||
diskfile := "disk.img"
|
||||
imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, &partitionTable, t.arch.legacy)
|
||||
pipelines = append(pipelines, *imagePipeline)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
qemuPipeline := qemuPipeline(imagePipeline.Name, diskfile, t.filename, "vmdk", "")
|
||||
pipelines = append(pipelines, *qemuPipeline)
|
||||
return pipelines, nil
|
||||
}
|
||||
|
||||
func tarPipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
|
||||
pipelines := make([]osbuild.Pipeline, 0)
|
||||
pipelines = append(pipelines, *buildPipeline(repos, packageSetSpecs["build"]))
|
||||
|
|
|
|||
|
|
@ -477,6 +477,10 @@ func qemuStageOptions(filename, format, compat string) *osbuild.QEMUStageOptions
|
|||
options = osbuild.VPCOptions{
|
||||
Type: "vpc",
|
||||
}
|
||||
case "vmdk":
|
||||
options = osbuild.VMDKOptions{
|
||||
Type: "vmdk",
|
||||
}
|
||||
default:
|
||||
panic("unknown format in qemu stage: " + format)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ type QEMUStageOptions struct {
|
|||
Format QEMUFormatOptions `json:"format"`
|
||||
}
|
||||
|
||||
func (QEMUStageOptions) isStageOptions() {}
|
||||
|
||||
type QEMUFormatOptions interface {
|
||||
isQEMUFormatOptions()
|
||||
}
|
||||
|
|
@ -39,7 +41,12 @@ type VPCOptions struct {
|
|||
|
||||
func (VPCOptions) isQEMUFormatOptions() {}
|
||||
|
||||
func (QEMUStageOptions) isStageOptions() {}
|
||||
type VMDKOptions struct {
|
||||
// The type of the format must be 'vpc'
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
func (VMDKOptions) isQEMUFormatOptions() {}
|
||||
|
||||
type QEMUStageInputs struct {
|
||||
Image *QEMUStageInput `json:"image"`
|
||||
|
|
@ -88,6 +95,10 @@ func (options QEMUStageOptions) MarshalJSON() ([]byte, error) {
|
|||
if o.Type != "vpc" {
|
||||
return nil, fmt.Errorf("invalid format type %q for vpc options", o.Type)
|
||||
}
|
||||
case VMDKOptions:
|
||||
if o.Type != "vmdk" {
|
||||
return nil, fmt.Errorf("invalid format type %q for vmdk options", o.Type)
|
||||
}
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown format options in QEMU stage: %#v", options.Format)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue