Removed extra steps during upgrade

Minor tweaks were required to enable this upgrade.

The removed steps are covered by the upgrade playbook already.

TEST PLAN
PASS: Optimized B&R on AIO-SX
PASS: Optimized upgrade on AIO-SX, stx8 to stx9
PASS: Optimized upgrade on AIO-SX, stx6 to stx8 to stx9
PASS: Optimized B&R on AIO-SX after upgrade
* stx8 to stx9
* stx6 to stx8 to stx9
PASS: Optimized upgrade on AIO-SX subcloud, stx6 to stx8 to stx9
* With and without prestaging

Story: 2010798
Task: 49009
Joshua Kraitberg <joshua.kraitberg@windriver.com>

Change-Id: I7880aa63fdbf920b778a01646151be85973b7c7a
This commit is contained in:
Joshua Kraitberg 2023-10-27 11:30:49 -04:00
parent 773461c830
commit 65dadf3145
1 changed files with 28 additions and 18 deletions

View File

@ -1226,26 +1226,32 @@ def extract_relative_file(archive, member_name, dest_dir):
def extract_data_from_archive(archive, staging_dir, from_release, to_release):
"""Extracts the data from the archive to the staging directory"""
from_puppet_path = os.path.join(PLATFORM_PATH, "puppet",
from_release, "hieradata")
from_sysinv_path = os.path.join(PLATFORM_PATH, "sysinv", from_release)
from_keyring_path = os.path.join(PLATFORM_PATH, ".keyring",
from_release)
from_pxelinux_path = os.path.join(PLATFORM_PATH, "config",
from_release, "pxelinux.cfg")
# 0755 permissions
dir_options = stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | \
stat.S_IROTH | stat.S_IXOTH
shutil.rmtree(from_puppet_path, ignore_errors=True)
shutil.rmtree(from_keyring_path, ignore_errors=True)
shutil.rmtree(
os.path.join(PLATFORM_PATH, "config", to_release, "pxelinux.cfg"),
ignore_errors=True)
# On newer release this part is handled in the upgrade playbook
if from_release in ["21.12", "22.06"]:
from_puppet_path = os.path.join(PLATFORM_PATH, "puppet",
from_release, "hieradata")
from_pxelinux_path = os.path.join(PLATFORM_PATH, "config",
from_release, "pxelinux.cfg")
os.makedirs(from_puppet_path, dir_options)
os.makedirs(from_keyring_path, dir_options)
shutil.rmtree(from_puppet_path, ignore_errors=True)
shutil.rmtree(
os.path.join(PLATFORM_PATH, "config", to_release, "pxelinux.cfg"),
ignore_errors=True)
os.makedirs(from_puppet_path, dir_options)
extract_relative_directory(
archive, from_puppet_path, from_puppet_path)
extract_relative_directory(
archive, from_pxelinux_path, from_pxelinux_path)
# During legacy upgrade the from_sysinv_path directory should be recreated.
# During optimized upgrade, the from_sysinv_path is already prepared.
@ -1254,9 +1260,11 @@ def extract_data_from_archive(archive, staging_dir, from_release, to_release):
shutil.rmtree(from_sysinv_path, ignore_errors=True)
os.makedirs(from_sysinv_path, dir_options)
extract_relative_directory(archive, from_puppet_path, from_puppet_path)
shutil.rmtree(from_keyring_path, ignore_errors=True)
os.makedirs(from_keyring_path, dir_options)
extract_relative_directory(archive, from_keyring_path, from_keyring_path)
extract_relative_directory(archive, from_pxelinux_path, from_pxelinux_path)
os.makedirs(
os.path.join(PLATFORM_PATH, "config", to_release, "pxelinux.cfg"),
@ -1433,12 +1441,14 @@ def upgrade_controller_simplex(backup_file):
migrate_hiera_data(from_release, to_release, role=role)
db_credentials = get_db_credentials(shared_services, from_release)
extract_postgres_data(archive)
# On newer releases this part is handled in the upgrade playbook
if from_release in ["22.06"]:
extract_postgres_data(archive)
# Import databases
print_log_info("Importing databases...")
import_databases(from_release, to_release, utils.POSTGRES_PATH,
simplex=True)
# Import databases
print_log_info("Importing databases...")
import_databases(from_release, to_release, utils.POSTGRES_PATH,
simplex=True)
# Create any new databases
print_log_info("Creating new databases...")