Merge "Deploy precheck/start cleanup"
This commit is contained in:
@@ -86,8 +86,6 @@ class HealthCheck(object):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# TODO(heitormatsui): implement patch precheck targeted against USM
|
|
||||||
# and implement patch precheck for subcloud
|
|
||||||
def _check_required_patches_state(self, required_patches, allow_available=False):
|
def _check_required_patches_state(self, required_patches, allow_available=False):
|
||||||
"""
|
"""
|
||||||
Check if the required patches are in 'deployed' or 'unavailable' state,
|
Check if the required patches are in 'deployed' or 'unavailable' state,
|
||||||
@@ -171,8 +169,6 @@ class UpgradeHealthCheck(HealthCheck):
|
|||||||
super().__init__(config)
|
super().__init__(config)
|
||||||
self._ostree_feed_path = f"/var/www/pages/feed/rel-{self._major_release}"
|
self._ostree_feed_path = f"/var/www/pages/feed/rel-{self._major_release}"
|
||||||
|
|
||||||
# TODO(heitormatsui): switch from using upgrade metadata xml to
|
|
||||||
# the new USM metadata format
|
|
||||||
def _check_valid_upgrade_path(self):
|
def _check_valid_upgrade_path(self):
|
||||||
"""Checks if active release to specified release is a valid upgrade path"""
|
"""Checks if active release to specified release is a valid upgrade path"""
|
||||||
# Get active release
|
# Get active release
|
||||||
@@ -193,7 +189,6 @@ class UpgradeHealthCheck(HealthCheck):
|
|||||||
success = active_release in supported_releases
|
success = active_release in supported_releases
|
||||||
return success, active_release, supported_releases.get(active_release, [])
|
return success, active_release, supported_releases.get(active_release, [])
|
||||||
|
|
||||||
# TODO(heitormatsui) do we need this check on USM? Remove if we don't
|
|
||||||
def _check_active_is_controller_0(self):
|
def _check_active_is_controller_0(self):
|
||||||
"""Checks that active controller is controller-0"""
|
"""Checks that active controller is controller-0"""
|
||||||
controllers = self._sysinv_client.ihost.list()
|
controllers = self._sysinv_client.ihost.list()
|
||||||
@@ -205,8 +200,6 @@ class UpgradeHealthCheck(HealthCheck):
|
|||||||
|
|
||||||
def _get_supported_k8s_versions(self):
|
def _get_supported_k8s_versions(self):
|
||||||
supported_versions = []
|
supported_versions = []
|
||||||
# TODO(heitormatsui): is this the most appropriate way
|
|
||||||
# to fetch valid k8s versions for a given release?
|
|
||||||
cmd = ["ostree", f"--repo={self._ostree_feed_path}/ostree_repo",
|
cmd = ["ostree", f"--repo={self._ostree_feed_path}/ostree_repo",
|
||||||
"ls", "starlingx", "/usr/local/kubernetes"]
|
"ls", "starlingx", "/usr/local/kubernetes"]
|
||||||
try:
|
try:
|
||||||
@@ -284,7 +277,6 @@ class UpgradeHealthCheck(HealthCheck):
|
|||||||
(active_version, ", ".join(supported_versions)))
|
(active_version, ", ".join(supported_versions)))
|
||||||
health_ok = health_ok and success
|
health_ok = health_ok and success
|
||||||
|
|
||||||
# TODO(heitormatsui) Do we need the following check on USM?
|
|
||||||
# The load is only imported to controller-0. An upgrade can only
|
# The load is only imported to controller-0. An upgrade can only
|
||||||
# be started when controller-0 is active.
|
# be started when controller-0 is active.
|
||||||
is_controller_0 = self._check_active_is_controller_0()
|
is_controller_0 = self._check_active_is_controller_0()
|
||||||
|
|||||||
@@ -63,19 +63,6 @@ class DeployStart:
|
|||||||
self._remove_temporary_data()
|
self._remove_temporary_data()
|
||||||
|
|
||||||
def _checkout_ostree_repo(self):
|
def _checkout_ostree_repo(self):
|
||||||
# TODO(bqian) make commit_id mandatory once the commit-id is built to metadata.xml for major releases
|
|
||||||
if self._commit_id is None:
|
|
||||||
LOG.info("Retrieving commit-id...")
|
|
||||||
# get commit id, only latest for now
|
|
||||||
try:
|
|
||||||
cmd = ["ostree", "rev-parse", f"--repo={self._feed_ostree_repo_dir}", self.OSTREE_BRANCH]
|
|
||||||
process = subprocess.run(cmd, check=True, text=True, capture_output=True)
|
|
||||||
self._commit_id = process.stdout.strip()
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
LOG.error(f"Failed to retrieve commit-id: {e.stderr}")
|
|
||||||
raise
|
|
||||||
LOG.info(f"Latest commit-id: {self._commit_id}")
|
|
||||||
|
|
||||||
LOG.info(f"Checking out ostree repo, commit-id: {self._commit_id}")
|
LOG.info(f"Checking out ostree repo, commit-id: {self._commit_id}")
|
||||||
os.makedirs(self.STAGING_DIR, exist_ok=True)
|
os.makedirs(self.STAGING_DIR, exist_ok=True)
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ POSTGRES_PATH = '/var/lib/postgresql'
|
|||||||
DISTRIBUTED_CLOUD_ROLE_SYSTEMCONTROLLER = 'systemcontroller'
|
DISTRIBUTED_CLOUD_ROLE_SYSTEMCONTROLLER = 'systemcontroller'
|
||||||
SERVICE_TYPE_IDENTITY = 'identity'
|
SERVICE_TYPE_IDENTITY = 'identity'
|
||||||
PLATFORM_PATH = "/opt/platform"
|
PLATFORM_PATH = "/opt/platform"
|
||||||
ETCD_PATH = '/opt/etcd'
|
|
||||||
ETCD_DIR_NAME = 'db'
|
|
||||||
RABBIT_PATH = '/var/lib/rabbitmq'
|
RABBIT_PATH = '/var/lib/rabbitmq'
|
||||||
KUBERNETES_CONF_PATH = "/etc/kubernetes"
|
KUBERNETES_CONF_PATH = "/etc/kubernetes"
|
||||||
KUBERNETES_ADMIN_CONF_FILE = "admin.conf"
|
KUBERNETES_ADMIN_CONF_FILE = "admin.conf"
|
||||||
|
|||||||
@@ -250,15 +250,11 @@ def read_log_config():
|
|||||||
|
|
||||||
global logging_default_format_string
|
global logging_default_format_string
|
||||||
|
|
||||||
# TODO(lbonatti) Remove this default_format when logging_default_format_string is present in stx11,
|
|
||||||
# when this becomes the N release.
|
|
||||||
default_format = ('%(asctime)s.%(msecs)03d USM - %(exec)s [%(process)s:%(thread)d]: %(filename)s(%(lineno)s): '
|
|
||||||
'%(levelname)s: %(message)s')
|
|
||||||
config = configparser.ConfigParser(interpolation=None)
|
config = configparser.ConfigParser(interpolation=None)
|
||||||
|
|
||||||
config.read(software_conf)
|
config.read(software_conf)
|
||||||
software_conf_mtime = os.stat(software_conf).st_mtime
|
software_conf_mtime = os.stat(software_conf).st_mtime
|
||||||
logging_default_format_string = config.get("DEFAULT", "logging_default_format_string", fallback=default_format)
|
logging_default_format_string = config.get("DEFAULT", "logging_default_format_string")
|
||||||
|
|
||||||
|
|
||||||
def get_available_gib_in_vg():
|
def get_available_gib_in_vg():
|
||||||
|
|||||||
Reference in New Issue
Block a user