Use --kickstart-uri during factory restore
This change updates the factory auto-restore install process to use the newly introduced --kickstart-uri option, allowing the installer to use the miniboot.cfg file from the factory backup directory. It also fixes an issue where the factory restore playbook failed to detect the registry backup file due to the factory backup being named factory_backup.tgz instead of following the default *_platform_backup_*.tgz pattern. The fix sets the registry_backup_filename variable to correctly handle the factory backup naming. Test Plan: 01. PASS - Run a factory restore and verify that the miniboot.cfg stored in the subcloud at /opt/platform-backup/factory/ <sw_version>/miniboot.cfg is used during the installation. 02. PASS - Run a non-factory auto-restore and verify that it still uses the miniboot.cfg from the miniboot image. 03. PASS - Run a factory restore and verify that the restore playbook correctly uses the image registry backup file. Story: 2011454 Task: 52562 Change-Id: I1b94b40c8c311630c8d3c97e6d51e3fa6741c98d Signed-off-by: Gustavo Herzmann <gustavo.herzmann@windriver.com>
This commit is contained in:
@@ -207,7 +207,12 @@ class SubcloudInstall(object):
|
||||
f_out_override_file.write("%s: %s\n" % (k, json.dumps(v)))
|
||||
|
||||
def update_iso(
|
||||
self, override_path, values, subcloud_primary_oam_ip_family, include_paths=None
|
||||
self,
|
||||
override_path,
|
||||
values,
|
||||
subcloud_primary_oam_ip_family,
|
||||
include_paths=None,
|
||||
kickstart_uri=None,
|
||||
):
|
||||
if not os.path.isdir(self.www_iso_root):
|
||||
os.mkdir(self.www_iso_root, 0o755)
|
||||
@@ -274,6 +279,9 @@ class SubcloudInstall(object):
|
||||
for path in include_paths:
|
||||
update_iso_cmd += ["--include-path", path]
|
||||
|
||||
if kickstart_uri:
|
||||
update_iso_cmd += ["--kickstart-uri", kickstart_uri]
|
||||
|
||||
for key, _ in consts.GEN_ISO_OPTIONS.items():
|
||||
if key in values:
|
||||
LOG.debug(
|
||||
@@ -477,6 +485,7 @@ class SubcloudInstall(object):
|
||||
payload,
|
||||
subcloud_primary_oam_ip_family,
|
||||
include_paths=None,
|
||||
kickstart_uri=None,
|
||||
):
|
||||
"""Update the iso image and create the config files for the subcloud"""
|
||||
LOG.info("Prepare for %s remote install" % (self.name))
|
||||
@@ -523,7 +532,11 @@ class SubcloudInstall(object):
|
||||
# Update the default iso image based on the install values
|
||||
# Runs gen-bootloader-iso.sh
|
||||
self.update_iso(
|
||||
override_path, iso_values, subcloud_primary_oam_ip_family, include_paths
|
||||
override_path,
|
||||
iso_values,
|
||||
subcloud_primary_oam_ip_family,
|
||||
include_paths,
|
||||
kickstart_uri,
|
||||
)
|
||||
|
||||
# remove the iso values from the payload
|
||||
|
@@ -2571,6 +2571,13 @@ class SubcloudManager(manager.Manager):
|
||||
else nullcontext()
|
||||
)
|
||||
|
||||
kickstart_uri = None
|
||||
if auto_restore_mode == "factory":
|
||||
kickstart_uri = (
|
||||
"partition://platform_backup:factory/"
|
||||
f"{software_version}/miniboot.cfg"
|
||||
)
|
||||
|
||||
with auto_restore_context as temp_dir:
|
||||
# Stage the auto-restore files so they can be copied to the
|
||||
# miniboot ISO during subcloud installation. These files will
|
||||
@@ -2590,6 +2597,7 @@ class SubcloudManager(manager.Manager):
|
||||
log_file,
|
||||
data_install,
|
||||
include_paths,
|
||||
kickstart_uri,
|
||||
)
|
||||
|
||||
if not install_success:
|
||||
@@ -3065,7 +3073,13 @@ class SubcloudManager(manager.Manager):
|
||||
|
||||
@staticmethod
|
||||
def _run_subcloud_install(
|
||||
context, subcloud, install_command, log_file, payload, include_paths=None
|
||||
context,
|
||||
subcloud,
|
||||
install_command,
|
||||
log_file,
|
||||
payload,
|
||||
include_paths=None,
|
||||
kickstart_uri=None,
|
||||
):
|
||||
software_version = str(payload["software_version"])
|
||||
LOG.info(
|
||||
@@ -3093,6 +3107,7 @@ class SubcloudManager(manager.Manager):
|
||||
payload,
|
||||
subcloud_primary_oam_ip_family,
|
||||
include_paths,
|
||||
kickstart_uri,
|
||||
)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
|
@@ -252,12 +252,18 @@ check_and_set_registry_restore() {
|
||||
local registry_backup_files
|
||||
mapfile -t registry_backup_files < <(find "$backup_dir" -maxdepth 1 -name "*_image_registry_backup_*.tgz" -type f)
|
||||
|
||||
if [[ ${#registry_backup_files[@]} -gt 0 ]]; then
|
||||
log "Found ${#registry_backup_files[@]} image registry backup file(s):"
|
||||
for file in "${registry_backup_files[@]}"; do
|
||||
log " - $(basename "$file")"
|
||||
done
|
||||
if [[ ${#registry_backup_files[@]} -eq 1 ]]; then
|
||||
local registry_backup_filename
|
||||
registry_backup_filename=$(basename "${registry_backup_files[0]}")
|
||||
log "Found image registry backup file: $registry_backup_filename"
|
||||
set_config_value "restore_registry_filesystem" "true" "$RESTORE_CONFIG"
|
||||
set_config_value "registry_backup_filename" "$registry_backup_filename" "$RESTORE_CONFIG"
|
||||
elif [[ ${#registry_backup_files[@]} -gt 1 ]]; then
|
||||
log "Multiple image registry backup files found in $backup_dir:" "ERROR"
|
||||
for file in "${registry_backup_files[@]}"; do
|
||||
log " - $(basename "$file")" "ERROR"
|
||||
done
|
||||
return 1
|
||||
else
|
||||
log "No image registry backup files found matching pattern *_image_registry_backup_*.tgz"
|
||||
# We set restore_registry_filesystem to false so the restore playbook attempts
|
||||
|
Reference in New Issue
Block a user