|
|
|
@@ -0,0 +1,529 @@
|
|
|
|
|
From 19cbf4febbf042248266188e3629e0c88e06906a Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: Nicolas Belouin <nicolas.belouin@suse.com>
|
|
|
|
|
Date: Thu, 26 Jun 2025 09:37:19 +0200
|
|
|
|
|
Subject: [PATCH] Allow configuring different IPA images per architecture
|
|
|
|
|
|
|
|
|
|
When using multiple architectures, having a way to set the Ironic
|
|
|
|
|
"bootloader" (a.k.a EFI partition) accordingly is important, so this
|
|
|
|
|
commit adds a new `DEPLOY_BOOTLOADER_URL` variable to set this Ironic
|
|
|
|
|
option.
|
|
|
|
|
|
|
|
|
|
This commit adds a set of new environment variables allowing to specify
|
|
|
|
|
different URLs per target CPU architecture for the IPA image:
|
|
|
|
|
- `DEPLOY_KERNEL_URL_<ARCH>`
|
|
|
|
|
- `DEPLOY_RAMDISK_URL_<ARCH>`
|
|
|
|
|
- `DEPLOY_ISO_URL_<ARCH>`
|
|
|
|
|
- `DEPLOY_BOOTLOADER_URL_<ARCH>`
|
|
|
|
|
|
|
|
|
|
Non suffixed variables are used as defaults, if there is no architecture
|
|
|
|
|
specific image(s) defined for the BMH CPU architecture.
|
|
|
|
|
|
|
|
|
|
Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
|
|
|
|
|
---
|
|
|
|
|
.../metal3.io/baremetalhost_controller.go | 1 +
|
|
|
|
|
pkg/imageprovider/imageprovider.go | 1 +
|
|
|
|
|
pkg/provisioner/ironic/factory.go | 61 ++++++++++----
|
|
|
|
|
pkg/provisioner/ironic/factory_test.go | 25 ++++--
|
|
|
|
|
pkg/provisioner/ironic/ironic.go | 46 ++++++++---
|
|
|
|
|
pkg/provisioner/ironic/ironic_test.go | 10 ++-
|
|
|
|
|
pkg/provisioner/ironic/register_test.go | 80 ++++++++++++-------
|
|
|
|
|
pkg/provisioner/provisioner.go | 1 +
|
|
|
|
|
8 files changed, 160 insertions(+), 65 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/internal/controller/metal3.io/baremetalhost_controller.go b/internal/controller/metal3.io/baremetalhost_controller.go
|
|
|
|
|
index d04bb618..a4ea9d19 100644
|
|
|
|
|
--- a/internal/controller/metal3.io/baremetalhost_controller.go
|
|
|
|
|
+++ b/internal/controller/metal3.io/baremetalhost_controller.go
|
|
|
|
|
@@ -847,6 +847,7 @@ func (r *BareMetalHostReconciler) registerHost(prov provisioner.Provisioner, inf
|
|
|
|
|
PreprovisioningNetworkData: preprovisioningNetworkData,
|
|
|
|
|
HasCustomDeploy: hasCustomDeploy(info.host),
|
|
|
|
|
DisablePowerOff: info.host.Spec.DisablePowerOff,
|
|
|
|
|
+ CPUArchitecture: getHostArchitecture(info.host),
|
|
|
|
|
},
|
|
|
|
|
credsChanged,
|
|
|
|
|
info.host.Status.ErrorType == metal3api.RegistrationError)
|
|
|
|
|
diff --git a/pkg/imageprovider/imageprovider.go b/pkg/imageprovider/imageprovider.go
|
|
|
|
|
index 459fdf2d..f307c041 100644
|
|
|
|
|
--- a/pkg/imageprovider/imageprovider.go
|
|
|
|
|
+++ b/pkg/imageprovider/imageprovider.go
|
|
|
|
|
@@ -20,6 +20,7 @@ type ImageData struct {
|
|
|
|
|
type GeneratedImage struct {
|
|
|
|
|
ImageURL string
|
|
|
|
|
KernelURL string
|
|
|
|
|
+ BootloaderURL string
|
|
|
|
|
ExtraKernelParams string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
diff --git a/pkg/provisioner/ironic/factory.go b/pkg/provisioner/ironic/factory.go
|
|
|
|
|
index 95cc21b4..5f4189bb 100644
|
|
|
|
|
--- a/pkg/provisioner/ironic/factory.go
|
|
|
|
|
+++ b/pkg/provisioner/ironic/factory.go
|
|
|
|
|
@@ -58,9 +58,10 @@ func (f *ironicProvisionerFactory) init(havePreprovImgBuilder bool) error {
|
|
|
|
|
f.log.Info("ironic settings",
|
|
|
|
|
"endpoint", ironicEndpoint,
|
|
|
|
|
"ironicAuthType", ironicAuth.Type,
|
|
|
|
|
- "deployKernelURL", f.config.deployKernelURL,
|
|
|
|
|
- "deployRamdiskURL", f.config.deployRamdiskURL,
|
|
|
|
|
- "deployISOURL", f.config.deployISOURL,
|
|
|
|
|
+ "defaultDeployKernelURL", f.config.defaultDeployConfig.kernelURL,
|
|
|
|
|
+ "defaultDeployRamdiskURL", f.config.defaultDeployConfig.ramdiskURL,
|
|
|
|
|
+ "defaultDeployISOURL", f.config.defaultDeployConfig.ISOURL,
|
|
|
|
|
+ "defaultDeployBootloaderURL", f.config.defaultDeployConfig.bootloaderURL,
|
|
|
|
|
"liveISOForcePersistentBootDevice", f.config.liveISOForcePersistentBootDevice,
|
|
|
|
|
"CACertFile", tlsConf.TrustedCAFile,
|
|
|
|
|
"ClientCertFile", tlsConf.ClientCertificateFile,
|
|
|
|
|
@@ -105,27 +106,55 @@ func (f ironicProvisionerFactory) NewProvisioner(ctx context.Context, hostData p
|
|
|
|
|
return f.ironicProvisioner(ctx, hostData, publisher)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-func loadConfigFromEnv(havePreprovImgBuilder bool) (ironicConfig, error) {
|
|
|
|
|
- c := ironicConfig{
|
|
|
|
|
- havePreprovImgBuilder: havePreprovImgBuilder,
|
|
|
|
|
+func loadDeployURLFromEnv(arch string, havePreprovImgBuilder bool) (ironicDeployConfig, error) {
|
|
|
|
|
+ c := ironicDeployConfig{}
|
|
|
|
|
+ var suffix string
|
|
|
|
|
+ if arch != "" {
|
|
|
|
|
+ suffix = "_" + strings.ToUpper(arch)
|
|
|
|
|
}
|
|
|
|
|
+ c.kernelURL = os.Getenv("DEPLOY_KERNEL_URL" + suffix)
|
|
|
|
|
+ c.ramdiskURL = os.Getenv("DEPLOY_RAMDISK_URL" + suffix)
|
|
|
|
|
+ c.ISOURL = os.Getenv("DEPLOY_ISO_URL" + suffix)
|
|
|
|
|
+ c.bootloaderURL = os.Getenv("DEPLOY_BOOTLOADER_URL" + suffix)
|
|
|
|
|
|
|
|
|
|
- c.deployKernelURL = os.Getenv("DEPLOY_KERNEL_URL")
|
|
|
|
|
- c.deployRamdiskURL = os.Getenv("DEPLOY_RAMDISK_URL")
|
|
|
|
|
- c.deployISOURL = os.Getenv("DEPLOY_ISO_URL")
|
|
|
|
|
if !havePreprovImgBuilder {
|
|
|
|
|
- if c.deployISOURL == "" &&
|
|
|
|
|
- (c.deployKernelURL == "" || c.deployRamdiskURL == "") {
|
|
|
|
|
- return c, errors.New("either DEPLOY_KERNEL_URL and DEPLOY_RAMDISK_URL or DEPLOY_ISO_URL must be set")
|
|
|
|
|
- }
|
|
|
|
|
- if (c.deployKernelURL == "" && c.deployRamdiskURL != "") ||
|
|
|
|
|
- (c.deployKernelURL != "" && c.deployRamdiskURL == "") {
|
|
|
|
|
+ if (c.kernelURL == "" && c.ramdiskURL != "") ||
|
|
|
|
|
+ (c.kernelURL != "" && c.ramdiskURL == "") {
|
|
|
|
|
return c, errors.New("DEPLOY_KERNEL_URL and DEPLOY_RAMDISK_URL can only be set together")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
- if c.deployKernelURL == "" && c.deployRamdiskURL != "" {
|
|
|
|
|
+ if c.kernelURL == "" && c.ramdiskURL != "" {
|
|
|
|
|
return c, errors.New("DEPLOY_RAMDISK_URL requires DEPLOY_KERNEL_URL to be set also")
|
|
|
|
|
}
|
|
|
|
|
+ return c, nil
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func loadConfigFromEnv(havePreprovImgBuilder bool) (ironicConfig, error) {
|
|
|
|
|
+ c := ironicConfig{
|
|
|
|
|
+ havePreprovImgBuilder: havePreprovImgBuilder,
|
|
|
|
|
+ archDeployConfig: make(map[string]ironicDeployConfig),
|
|
|
|
|
+ }
|
|
|
|
|
+ var err error
|
|
|
|
|
+ c.defaultDeployConfig, err = loadDeployURLFromEnv("", havePreprovImgBuilder)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return c, err
|
|
|
|
|
+ }
|
|
|
|
|
+ for _, arch := range supportedArch {
|
|
|
|
|
+ archDeployConfig, err := loadDeployURLFromEnv(arch, havePreprovImgBuilder)
|
|
|
|
|
+ // Only register valid arch specific deploy configuration
|
|
|
|
|
+ if archDeployConfig.ISOURL != "" || (archDeployConfig.kernelURL != "" && archDeployConfig.ramdiskURL != "") {
|
|
|
|
|
+ c.archDeployConfig[arch] = archDeployConfig
|
|
|
|
|
+ }
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return c, err
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if !havePreprovImgBuilder {
|
|
|
|
|
+ if c.defaultDeployConfig.ISOURL == "" &&
|
|
|
|
|
+ (c.defaultDeployConfig.kernelURL == "" || c.defaultDeployConfig.ramdiskURL == "") {
|
|
|
|
|
+ return c, errors.New("either DEPLOY_KERNEL_URL and DEPLOY_RAMDISK_URL or DEPLOY_ISO_URL must be set")
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
c.maxBusyHosts = 20
|
|
|
|
|
if maxHostsStr := os.Getenv("PROVISIONING_LIMIT"); maxHostsStr != "" {
|
|
|
|
|
diff --git a/pkg/provisioner/ironic/factory_test.go b/pkg/provisioner/ironic/factory_test.go
|
|
|
|
|
index db47d8b2..acdedf1c 100644
|
|
|
|
|
--- a/pkg/provisioner/ironic/factory_test.go
|
|
|
|
|
+++ b/pkg/provisioner/ironic/factory_test.go
|
|
|
|
|
@@ -14,6 +14,11 @@ type EnvFixture struct {
|
|
|
|
|
kernelURL string
|
|
|
|
|
ramdiskURL string
|
|
|
|
|
isoURL string
|
|
|
|
|
+ bootloaderURL string
|
|
|
|
|
+ aarch64kernelURL string
|
|
|
|
|
+ aarch64ramdiskURL string
|
|
|
|
|
+ aarch64isoURL string
|
|
|
|
|
+ aarch64bootloaderURL string
|
|
|
|
|
liveISOForcePersistentBootDevice string
|
|
|
|
|
ironicCACertFile string
|
|
|
|
|
ironicClientCertFile string
|
|
|
|
|
@@ -49,6 +54,11 @@ func (f *EnvFixture) SetUp() {
|
|
|
|
|
f.replace("DEPLOY_KERNEL_URL", f.kernelURL)
|
|
|
|
|
f.replace("DEPLOY_RAMDISK_URL", f.ramdiskURL)
|
|
|
|
|
f.replace("DEPLOY_ISO_URL", f.isoURL)
|
|
|
|
|
+ f.replace("DEPLOY_BOOTLOADER_URL", f.bootloaderURL)
|
|
|
|
|
+ f.replace("DEPLOY_KERNEL_URL_AARCH64", f.aarch64kernelURL)
|
|
|
|
|
+ f.replace("DEPLOY_RAMDISK_URL_AARCH64", f.aarch64ramdiskURL)
|
|
|
|
|
+ f.replace("DEPLOY_ISO_URL_AARCH64", f.aarch64isoURL)
|
|
|
|
|
+ f.replace("DEPLOY_BOOTLOADER_URL_AARCH64", f.aarch64bootloaderURL)
|
|
|
|
|
f.replace("LIVE_ISO_FORCE_PERSISTENT_BOOT_DEVICE", f.liveISOForcePersistentBootDevice)
|
|
|
|
|
f.replace("IRONIC_CACERT_FILE", f.ironicCACertFile)
|
|
|
|
|
f.replace("IRONIC_CLIENT_CERT_FILE", f.ironicClientCertFile)
|
|
|
|
|
@@ -58,9 +68,14 @@ func (f *EnvFixture) SetUp() {
|
|
|
|
|
}
|
|
|
|
|
func (f EnvFixture) VerifyConfig(t *testing.T, c ironicConfig, _ string) {
|
|
|
|
|
t.Helper()
|
|
|
|
|
- assert.Equal(t, f.kernelURL, c.deployKernelURL)
|
|
|
|
|
- assert.Equal(t, f.ramdiskURL, c.deployRamdiskURL)
|
|
|
|
|
- assert.Equal(t, f.isoURL, c.deployISOURL)
|
|
|
|
|
+ assert.Equal(t, f.kernelURL, c.defaultDeployConfig.kernelURL)
|
|
|
|
|
+ assert.Equal(t, f.ramdiskURL, c.defaultDeployConfig.ramdiskURL)
|
|
|
|
|
+ assert.Equal(t, f.isoURL, c.defaultDeployConfig.ISOURL)
|
|
|
|
|
+ assert.Equal(t, f.bootloaderURL, c.defaultDeployConfig.bootloaderURL)
|
|
|
|
|
+ assert.Equal(t, f.aarch64kernelURL, c.archDeployConfig["aarch64"].kernelURL)
|
|
|
|
|
+ assert.Equal(t, f.aarch64ramdiskURL, c.archDeployConfig["aarch64"].ramdiskURL)
|
|
|
|
|
+ assert.Equal(t, f.aarch64isoURL, c.archDeployConfig["aarch64"].ISOURL)
|
|
|
|
|
+ assert.Equal(t, f.aarch64bootloaderURL, c.archDeployConfig["aarch64"].bootloaderURL)
|
|
|
|
|
assert.Equal(t, f.liveISOForcePersistentBootDevice, c.liveISOForcePersistentBootDevice)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -108,14 +123,14 @@ func TestLoadConfigFromEnv(t *testing.T) {
|
|
|
|
|
env: EnvFixture{
|
|
|
|
|
kernelURL: "http://kernel",
|
|
|
|
|
},
|
|
|
|
|
- expectedError: "either DEPLOY_KERNEL_URL and DEPLOY_RAMDISK_URL or DEPLOY_ISO_URL must be set",
|
|
|
|
|
+ expectedError: "DEPLOY_KERNEL_URL and DEPLOY_RAMDISK_URL can only be set together",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "only ramdisk",
|
|
|
|
|
env: EnvFixture{
|
|
|
|
|
ramdiskURL: "http://ramdisk",
|
|
|
|
|
},
|
|
|
|
|
- expectedError: "either DEPLOY_KERNEL_URL and DEPLOY_RAMDISK_URL or DEPLOY_ISO_URL must be set",
|
|
|
|
|
+ expectedError: "DEPLOY_KERNEL_URL and DEPLOY_RAMDISK_URL can only be set together",
|
|
|
|
|
expectedImgBuildError: "DEPLOY_RAMDISK_URL requires DEPLOY_KERNEL_URL to be set also",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
diff --git a/pkg/provisioner/ironic/ironic.go b/pkg/provisioner/ironic/ironic.go
|
|
|
|
|
index 4bc753f2..52d03479 100644
|
|
|
|
|
--- a/pkg/provisioner/ironic/ironic.go
|
|
|
|
|
+++ b/pkg/provisioner/ironic/ironic.go
|
|
|
|
|
@@ -30,6 +30,7 @@ var (
|
|
|
|
|
subscriptionRequeueDelay = time.Second * 10
|
|
|
|
|
introspectionRequeueDelay = time.Second * 15
|
|
|
|
|
softPowerOffTimeout = time.Second * 180
|
|
|
|
|
+ supportedArch = [...]string{"x86_64", "aarch64"}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
@@ -41,6 +42,7 @@ const (
|
|
|
|
|
nameSeparator = "~"
|
|
|
|
|
customDeployPriority = 80
|
|
|
|
|
|
|
|
|
|
+ bootloaderKey = "bootloader"
|
|
|
|
|
deployKernelKey = "deploy_kernel"
|
|
|
|
|
deployRamdiskKey = "deploy_ramdisk"
|
|
|
|
|
deployISOKey = "deploy_iso"
|
|
|
|
|
@@ -61,11 +63,17 @@ func NewMacAddressConflictError(address, node string) error {
|
|
|
|
|
return macAddressConflictError{Address: address, ExistingNode: node}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+type ironicDeployConfig struct {
|
|
|
|
|
+ kernelURL string
|
|
|
|
|
+ ramdiskURL string
|
|
|
|
|
+ bootloaderURL string
|
|
|
|
|
+ ISOURL string
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
type ironicConfig struct {
|
|
|
|
|
havePreprovImgBuilder bool
|
|
|
|
|
- deployKernelURL string
|
|
|
|
|
- deployRamdiskURL string
|
|
|
|
|
- deployISOURL string
|
|
|
|
|
+ defaultDeployConfig ironicDeployConfig
|
|
|
|
|
+ archDeployConfig map[string]ironicDeployConfig
|
|
|
|
|
liveISOForcePersistentBootDevice string
|
|
|
|
|
maxBusyHosts int
|
|
|
|
|
externalURL string
|
|
|
|
|
@@ -318,7 +326,7 @@ func (p *ironicProvisioner) createPXEEnabledNodePort(uuid, macAddress string) er
|
|
|
|
|
func (p *ironicProvisioner) configureImages(data provisioner.ManagementAccessData, ironicNode *nodes.Node, bmcAccess bmc.AccessDetails) (result provisioner.Result, err error) {
|
|
|
|
|
updater := clients.UpdateOptsBuilder(p.log)
|
|
|
|
|
|
|
|
|
|
- deployImageInfo := setDeployImage(p.config, bmcAccess, data.PreprovisioningImage)
|
|
|
|
|
+ deployImageInfo := setDeployImage(p.config, bmcAccess, data.PreprovisioningImage, data.CPUArchitecture)
|
|
|
|
|
updater.SetDriverInfoOpts(deployImageInfo, ironicNode)
|
|
|
|
|
|
|
|
|
|
// NOTE(dtantsur): It is risky to update image information for active nodes since it may affect the ability to clean up.
|
|
|
|
|
@@ -430,14 +438,20 @@ func setExternalURL(p *ironicProvisioner, driverInfo map[string]interface{}) map
|
|
|
|
|
return driverInfo
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-func setDeployImage(config ironicConfig, accessDetails bmc.AccessDetails, hostImage *provisioner.PreprovisioningImage) clients.UpdateOptsData {
|
|
|
|
|
+func setDeployImage(config ironicConfig, accessDetails bmc.AccessDetails, hostImage *provisioner.PreprovisioningImage, cpuArch string) clients.UpdateOptsData {
|
|
|
|
|
deployImageInfo := clients.UpdateOptsData{
|
|
|
|
|
+ bootloaderKey: nil,
|
|
|
|
|
deployKernelKey: nil,
|
|
|
|
|
deployRamdiskKey: nil,
|
|
|
|
|
deployISOKey: nil,
|
|
|
|
|
kernelParamsKey: nil,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ deployConfig, ok := config.archDeployConfig[cpuArch]
|
|
|
|
|
+ if !ok {
|
|
|
|
|
+ deployConfig = config.defaultDeployConfig
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
allowISO := accessDetails.SupportsISOPreprovisioningImage()
|
|
|
|
|
|
|
|
|
|
if hostImage != nil {
|
|
|
|
|
@@ -450,10 +464,15 @@ func setDeployImage(config ironicConfig, accessDetails bmc.AccessDetails, hostIm
|
|
|
|
|
case metal3api.ImageFormatInitRD:
|
|
|
|
|
if hostImage.KernelURL != "" {
|
|
|
|
|
deployImageInfo[deployKernelKey] = hostImage.KernelURL
|
|
|
|
|
- } else if config.deployKernelURL == "" {
|
|
|
|
|
+ } else if deployConfig.kernelURL == "" {
|
|
|
|
|
return nil
|
|
|
|
|
} else {
|
|
|
|
|
- deployImageInfo[deployKernelKey] = config.deployKernelURL
|
|
|
|
|
+ deployImageInfo[deployKernelKey] = deployConfig.kernelURL
|
|
|
|
|
+ }
|
|
|
|
|
+ if hostImage.BootloaderURL != "" {
|
|
|
|
|
+ deployImageInfo[bootloaderKey] = hostImage.BootloaderURL
|
|
|
|
|
+ } else if deployConfig.bootloaderURL != "" {
|
|
|
|
|
+ deployImageInfo[bootloaderKey] = deployConfig.bootloaderURL
|
|
|
|
|
}
|
|
|
|
|
deployImageInfo[deployRamdiskKey] = hostImage.ImageURL
|
|
|
|
|
if hostImage.ExtraKernelParams != "" {
|
|
|
|
|
@@ -465,13 +484,16 @@ func setDeployImage(config ironicConfig, accessDetails bmc.AccessDetails, hostIm
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !config.havePreprovImgBuilder {
|
|
|
|
|
- if allowISO && config.deployISOURL != "" {
|
|
|
|
|
- deployImageInfo[deployISOKey] = config.deployISOURL
|
|
|
|
|
+ if allowISO && deployConfig.ISOURL != "" {
|
|
|
|
|
+ deployImageInfo[deployISOKey] = deployConfig.ISOURL
|
|
|
|
|
return deployImageInfo
|
|
|
|
|
}
|
|
|
|
|
- if config.deployKernelURL != "" && config.deployRamdiskURL != "" {
|
|
|
|
|
- deployImageInfo[deployKernelKey] = config.deployKernelURL
|
|
|
|
|
- deployImageInfo[deployRamdiskKey] = config.deployRamdiskURL
|
|
|
|
|
+ if deployConfig.kernelURL != "" && deployConfig.ramdiskURL != "" {
|
|
|
|
|
+ deployImageInfo[deployKernelKey] = deployConfig.kernelURL
|
|
|
|
|
+ deployImageInfo[deployRamdiskKey] = deployConfig.ramdiskURL
|
|
|
|
|
+ if deployConfig.bootloaderURL != "" {
|
|
|
|
|
+ deployImageInfo[bootloaderKey] = deployConfig.bootloaderURL
|
|
|
|
|
+ }
|
|
|
|
|
return deployImageInfo
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
diff --git a/pkg/provisioner/ironic/ironic_test.go b/pkg/provisioner/ironic/ironic_test.go
|
|
|
|
|
index a8759c44..f65592e6 100644
|
|
|
|
|
--- a/pkg/provisioner/ironic/ironic_test.go
|
|
|
|
|
+++ b/pkg/provisioner/ironic/ironic_test.go
|
|
|
|
|
@@ -27,10 +27,12 @@ func newTestProvisionerFactory() ironicProvisionerFactory {
|
|
|
|
|
return ironicProvisionerFactory{
|
|
|
|
|
log: logf.Log,
|
|
|
|
|
config: ironicConfig{
|
|
|
|
|
- deployKernelURL: "http://deploy.test/ipa.kernel",
|
|
|
|
|
- deployRamdiskURL: "http://deploy.test/ipa.initramfs",
|
|
|
|
|
- deployISOURL: "http://deploy.test/ipa.iso",
|
|
|
|
|
- maxBusyHosts: 20,
|
|
|
|
|
+ defaultDeployConfig: ironicDeployConfig{
|
|
|
|
|
+ kernelURL: "http://deploy.test/ipa.kernel",
|
|
|
|
|
+ ramdiskURL: "http://deploy.test/ipa.initramfs",
|
|
|
|
|
+ ISOURL: "http://deploy.test/ipa.iso",
|
|
|
|
|
+ },
|
|
|
|
|
+ maxBusyHosts: 20,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
diff --git a/pkg/provisioner/ironic/register_test.go b/pkg/provisioner/ironic/register_test.go
|
|
|
|
|
index c7d6bc75..9ded5946 100644
|
|
|
|
|
--- a/pkg/provisioner/ironic/register_test.go
|
|
|
|
|
+++ b/pkg/provisioner/ironic/register_test.go
|
|
|
|
|
@@ -1112,9 +1112,11 @@ func TestSetDeployImage(t *testing.T) {
|
|
|
|
|
Scenario: "iso no imgbuilder",
|
|
|
|
|
Config: ironicConfig{
|
|
|
|
|
havePreprovImgBuilder: false,
|
|
|
|
|
- deployKernelURL: localKernel,
|
|
|
|
|
- deployRamdiskURL: localRamdisk,
|
|
|
|
|
- deployISOURL: localIso,
|
|
|
|
|
+ defaultDeployConfig: ironicDeployConfig{
|
|
|
|
|
+ kernelURL: localKernel,
|
|
|
|
|
+ ramdiskURL: localRamdisk,
|
|
|
|
|
+ ISOURL: localIso,
|
|
|
|
|
+ },
|
|
|
|
|
},
|
|
|
|
|
Driver: isoDriver,
|
|
|
|
|
ExpectBuild: false,
|
|
|
|
|
@@ -1125,8 +1127,10 @@ func TestSetDeployImage(t *testing.T) {
|
|
|
|
|
Scenario: "no imgbuilder no iso",
|
|
|
|
|
Config: ironicConfig{
|
|
|
|
|
havePreprovImgBuilder: false,
|
|
|
|
|
- deployKernelURL: localKernel,
|
|
|
|
|
- deployRamdiskURL: localRamdisk,
|
|
|
|
|
+ defaultDeployConfig: ironicDeployConfig{
|
|
|
|
|
+ kernelURL: localKernel,
|
|
|
|
|
+ ramdiskURL: localRamdisk,
|
|
|
|
|
+ },
|
|
|
|
|
},
|
|
|
|
|
Driver: isoDriver,
|
|
|
|
|
ExpectBuild: false,
|
|
|
|
|
@@ -1137,9 +1141,11 @@ func TestSetDeployImage(t *testing.T) {
|
|
|
|
|
Scenario: "pxe no imgbuilder",
|
|
|
|
|
Config: ironicConfig{
|
|
|
|
|
havePreprovImgBuilder: false,
|
|
|
|
|
- deployKernelURL: localKernel,
|
|
|
|
|
- deployRamdiskURL: localRamdisk,
|
|
|
|
|
- deployISOURL: localIso,
|
|
|
|
|
+ defaultDeployConfig: ironicDeployConfig{
|
|
|
|
|
+ kernelURL: localKernel,
|
|
|
|
|
+ ramdiskURL: localRamdisk,
|
|
|
|
|
+ ISOURL: localIso,
|
|
|
|
|
+ },
|
|
|
|
|
},
|
|
|
|
|
Driver: pxeDriver,
|
|
|
|
|
ExpectBuild: false,
|
|
|
|
|
@@ -1150,9 +1156,11 @@ func TestSetDeployImage(t *testing.T) {
|
|
|
|
|
Scenario: "iso no build",
|
|
|
|
|
Config: ironicConfig{
|
|
|
|
|
havePreprovImgBuilder: true,
|
|
|
|
|
- deployKernelURL: localKernel,
|
|
|
|
|
- deployRamdiskURL: localRamdisk,
|
|
|
|
|
- deployISOURL: localIso,
|
|
|
|
|
+ defaultDeployConfig: ironicDeployConfig{
|
|
|
|
|
+ kernelURL: localKernel,
|
|
|
|
|
+ ramdiskURL: localRamdisk,
|
|
|
|
|
+ ISOURL: localIso,
|
|
|
|
|
+ },
|
|
|
|
|
},
|
|
|
|
|
Driver: isoDriver,
|
|
|
|
|
ExpectISO: false,
|
|
|
|
|
@@ -1162,9 +1170,11 @@ func TestSetDeployImage(t *testing.T) {
|
|
|
|
|
Scenario: "iso build",
|
|
|
|
|
Config: ironicConfig{
|
|
|
|
|
havePreprovImgBuilder: true,
|
|
|
|
|
- deployKernelURL: localKernel,
|
|
|
|
|
- deployRamdiskURL: localRamdisk,
|
|
|
|
|
- deployISOURL: localIso,
|
|
|
|
|
+ defaultDeployConfig: ironicDeployConfig{
|
|
|
|
|
+ kernelURL: localKernel,
|
|
|
|
|
+ ramdiskURL: localRamdisk,
|
|
|
|
|
+ ISOURL: localIso,
|
|
|
|
|
+ },
|
|
|
|
|
},
|
|
|
|
|
Driver: isoDriver,
|
|
|
|
|
Image: &provisioner.PreprovisioningImage{
|
|
|
|
|
@@ -1181,9 +1191,11 @@ func TestSetDeployImage(t *testing.T) {
|
|
|
|
|
Scenario: "pxe build",
|
|
|
|
|
Config: ironicConfig{
|
|
|
|
|
havePreprovImgBuilder: true,
|
|
|
|
|
- deployKernelURL: localKernel,
|
|
|
|
|
- deployRamdiskURL: localRamdisk,
|
|
|
|
|
- deployISOURL: localIso,
|
|
|
|
|
+ defaultDeployConfig: ironicDeployConfig{
|
|
|
|
|
+ kernelURL: localKernel,
|
|
|
|
|
+ ramdiskURL: localRamdisk,
|
|
|
|
|
+ ISOURL: localIso,
|
|
|
|
|
+ },
|
|
|
|
|
},
|
|
|
|
|
Driver: pxeDriver,
|
|
|
|
|
Image: &provisioner.PreprovisioningImage{
|
|
|
|
|
@@ -1200,9 +1212,11 @@ func TestSetDeployImage(t *testing.T) {
|
|
|
|
|
Scenario: "pxe build with new kernel and kernel params",
|
|
|
|
|
Config: ironicConfig{
|
|
|
|
|
havePreprovImgBuilder: true,
|
|
|
|
|
- deployKernelURL: localKernel,
|
|
|
|
|
- deployRamdiskURL: localRamdisk,
|
|
|
|
|
- deployISOURL: localIso,
|
|
|
|
|
+ defaultDeployConfig: ironicDeployConfig{
|
|
|
|
|
+ kernelURL: localKernel,
|
|
|
|
|
+ ramdiskURL: localRamdisk,
|
|
|
|
|
+ ISOURL: localIso,
|
|
|
|
|
+ },
|
|
|
|
|
},
|
|
|
|
|
Driver: pxeDriver,
|
|
|
|
|
Image: &provisioner.PreprovisioningImage{
|
|
|
|
|
@@ -1223,9 +1237,11 @@ func TestSetDeployImage(t *testing.T) {
|
|
|
|
|
Scenario: "pxe iso build",
|
|
|
|
|
Config: ironicConfig{
|
|
|
|
|
havePreprovImgBuilder: true,
|
|
|
|
|
- deployKernelURL: localKernel,
|
|
|
|
|
- deployRamdiskURL: localRamdisk,
|
|
|
|
|
- deployISOURL: localIso,
|
|
|
|
|
+ defaultDeployConfig: ironicDeployConfig{
|
|
|
|
|
+ kernelURL: localKernel,
|
|
|
|
|
+ ramdiskURL: localRamdisk,
|
|
|
|
|
+ ISOURL: localIso,
|
|
|
|
|
+ },
|
|
|
|
|
},
|
|
|
|
|
Driver: pxeDriver,
|
|
|
|
|
Image: &provisioner.PreprovisioningImage{
|
|
|
|
|
@@ -1242,7 +1258,9 @@ func TestSetDeployImage(t *testing.T) {
|
|
|
|
|
Scenario: "pxe build no kernel",
|
|
|
|
|
Config: ironicConfig{
|
|
|
|
|
havePreprovImgBuilder: true,
|
|
|
|
|
- deployISOURL: localIso,
|
|
|
|
|
+ defaultDeployConfig: ironicDeployConfig{
|
|
|
|
|
+ ISOURL: localIso,
|
|
|
|
|
+ },
|
|
|
|
|
},
|
|
|
|
|
Driver: pxeDriver,
|
|
|
|
|
Image: &provisioner.PreprovisioningImage{
|
|
|
|
|
@@ -1273,7 +1291,9 @@ func TestSetDeployImage(t *testing.T) {
|
|
|
|
|
Scenario: "pxe iso build no initrd",
|
|
|
|
|
Config: ironicConfig{
|
|
|
|
|
havePreprovImgBuilder: true,
|
|
|
|
|
- deployKernelURL: localKernel,
|
|
|
|
|
+ defaultDeployConfig: ironicDeployConfig{
|
|
|
|
|
+ kernelURL: localKernel,
|
|
|
|
|
+ },
|
|
|
|
|
},
|
|
|
|
|
Driver: pxeDriver,
|
|
|
|
|
Image: &provisioner.PreprovisioningImage{
|
|
|
|
|
@@ -1289,7 +1309,9 @@ func TestSetDeployImage(t *testing.T) {
|
|
|
|
|
Scenario: "no build no initrd",
|
|
|
|
|
Config: ironicConfig{
|
|
|
|
|
havePreprovImgBuilder: true,
|
|
|
|
|
- deployKernelURL: localKernel,
|
|
|
|
|
+ defaultDeployConfig: ironicDeployConfig{
|
|
|
|
|
+ kernelURL: localKernel,
|
|
|
|
|
+ },
|
|
|
|
|
},
|
|
|
|
|
Driver: pxeDriver,
|
|
|
|
|
ExpectISO: false,
|
|
|
|
|
@@ -1299,7 +1321,9 @@ func TestSetDeployImage(t *testing.T) {
|
|
|
|
|
Scenario: "pxe no imgbuilder no pxe",
|
|
|
|
|
Config: ironicConfig{
|
|
|
|
|
havePreprovImgBuilder: false,
|
|
|
|
|
- deployISOURL: localIso,
|
|
|
|
|
+ defaultDeployConfig: ironicDeployConfig{
|
|
|
|
|
+ ISOURL: localIso,
|
|
|
|
|
+ },
|
|
|
|
|
},
|
|
|
|
|
Driver: pxeDriver,
|
|
|
|
|
ExpectISO: false,
|
|
|
|
|
@@ -1318,7 +1342,7 @@ func TestSetDeployImage(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
for _, tc := range testCases {
|
|
|
|
|
t.Run(tc.Scenario, func(t *testing.T) {
|
|
|
|
|
- opts := setDeployImage(tc.Config, tc.Driver, tc.Image)
|
|
|
|
|
+ opts := setDeployImage(tc.Config, tc.Driver, tc.Image, "x86_64")
|
|
|
|
|
|
|
|
|
|
switch {
|
|
|
|
|
case tc.ExpectISO:
|
|
|
|
|
diff --git a/pkg/provisioner/provisioner.go b/pkg/provisioner/provisioner.go
|
|
|
|
|
index faddd0fd..f7f55c0d 100644
|
|
|
|
|
--- a/pkg/provisioner/provisioner.go
|
|
|
|
|
+++ b/pkg/provisioner/provisioner.go
|
|
|
|
|
@@ -82,6 +82,7 @@ type ManagementAccessData struct {
|
|
|
|
|
PreprovisioningNetworkData string
|
|
|
|
|
HasCustomDeploy bool
|
|
|
|
|
DisablePowerOff bool
|
|
|
|
|
+ CPUArchitecture string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type AdoptData struct {
|
|
|
|
|
--
|
|
|
|
|
2.50.0
|
|
|
|
|
|