Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a flag to prep-node to bypass initial OS check #376

Merged
merged 4 commits into from
Jul 2, 2024

Conversation

manasabsv26
Copy link
Contributor

@manasabsv26 manasabsv26 commented Jun 21, 2024

ISSUE(S):

PMK-6468

SUMMARY

Adding a flag --skip-os-checks to prep-node which does not cause prep-node to fail if version requirements are not met when Validating Platform

ISSUE TYPE

  • New feature (non-breaking change which adds functionality)

TESTING DONE

Manual

Supported versions of Ubuntu: 18.04, 20.04., 22.04.
Supported versions of redhat: CentOS 7.[3-9], RHEL 7.[3-9] & RHEL 8.[5-9] & Rocky 9.[1-2]

Use Case Result after initial os-check bypassed with --skip-os-checks flag
Higher major version of ubuntu (24.04) hostagent installed but fails to start
Higher minor version of ubuntu (22.08) prep-node succeeds
Higher major version of rhel (10.7) other pre-req checks fail (Packages not found and could not be installed ntp policycoreutils-python)
Higher minor version of rhel (8.10) prep-node succeeds
Higher major version of rocky (10.2) other pre-req checks fail (Packages not found and could not be installed ntp policycoreutils-python)
Higher minor version of rocky (9.3) prep-node succeeds
  1. Higher major version of ubuntu: Tested on ubuntu node. Edited the /etc/os-release file on ubuntu 20.04 node, changed version from 20.04 to 24.04
./pf9ctl_skip8 prep-node --skip-os-checks 
✓ Loaded Config Successfully
2024-06-19T18:53:02.7202Z	INFO	Unable to determine OS type
2024-06-19T18:53:02.7202Z	INFO	This OS version is not supported. Continuing as --skip-os-checks flag was used
✓ Removal of existing CLI
✓ Existing Platform9 Packages Check
✓ Required OS Packages Check
✓ SudoCheck
✓ CPUCheck
x DiskCheck - At least 30 GB of total disk space and 15 GB of free space is needed on host. Disk Space found: 12 GB
x MemoryCheck - At least 12 GB of memory is needed on host. Total memory found: 2 GB
✓ PortCheck
✓ Existing Kubernetes Cluster Check
✓ Check lock on dpkg
✓ Check lock on apt
✓ Check if system is booted with systemd
✓ Check time synchronization
✓ Check if firewalld service is not running
✓ Disabling swap and removing swap in fstab

✓ Completed Pre-Requisite Checks successfully


Optional pre-requisite check(s) failed. Do you want to continue? (y/n) 

Verbose logs:

2024-06-19T18:52:36.6401Z	DEBUG	Received a call to validate platform
2024-06-19T18:52:36.6647Z	DEBUG	Ran command sudo "cat" "/etc/os-release"
2024-06-19T18:52:36.6647Z	DEBUG	stdout:NAME="Ubuntu"
VERSION="24.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 24.04.6 LTS"
VERSION_ID="24.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
stderr:
2024-06-19T18:52:36.6838Z	DEBUG	Ran command sudo "bash" "-c" "cat /etc/*os-release | grep -i pretty_name | cut -d ' ' -f 2"
2024-06-19T18:52:36.6839Z	DEBUG	stdout:24.04.6
stderr:
2024-06-19T18:52:36.684Z	INFO	Unable to determine OS type
2024-06-19T18:52:36.684Z	INFO	This OS version is not supported. Continuing as --skip-os-checks flag was used

Hostagent gets installed succesfully.
However since this OS is not supported, hostagent svc fails to start

2024-06-19T20:30:23.9406Z	FATAL	
Failed to prepare node. Error: Unable to install hostagent. error while running installer script: SYSTEMCTL_FAILED_TO_START_HOSTAGENT. See /root/pf9/log/pf9ctl-20240619.log or use --verbose for logs
systemctl status pf9-hostagent.service
● pf9-hostagent.service - Platform9 Host Agent Service
     Loaded: loaded (/lib/systemd/system/pf9-hostagent.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2024-06-19 20:33:47 UTC; 8h ago
    Process: 72969 ExecStartPre=/opt/pf9/hostagent/pf9-hostagent-prestart.sh (code=exited, status=1/FAILURE)

Jun 19 20:33:47 manasa-test systemd[1]: pf9-hostagent.service: Scheduled restart job, restart counter is at 7.
Jun 19 20:33:47 manasa-test systemd[1]: Stopped Platform9 Host Agent Service.

pf9-hostagent-prestart.sh checks the ubuntu version of the node and according to major version, does some corresponding steps. So it is expected behaviour for prep-node to fail here.

  1. Higher minor version of ubuntu : Tested on ubuntu node. Edited the /etc/os-release file on ubuntu 20.04 node, changed version from 20.04 to 20.08
 ./pf9ctl_skip8 prep-node --skip-os-checks 
Error checking versions  open /usr/bin/pf9ctl: no such file or directory
✓ Loaded Config Successfully
2024-06-21T10:53:46.0672Z	INFO	Unable to determine OS type
2024-06-21T10:53:46.0674Z	INFO	This OS version is not supported. Continuing as --skip-os-checks flag was used
✓ Removal of existing CLI
x Existing Platform9 Packages Check - Platform9 packages already exist. These must be uninstalled.
✓ Required OS Packages Check
✓ SudoCheck
✓ CPUCheck
x DiskCheck - At least 30 GB of total disk space and 15 GB of free space is needed on host. Disk Space found: 12 GB
x MemoryCheck - At least 12 GB of memory is needed on host. Total memory found: 2 GB
x PortCheck - Following port(s) should not be in use: 3306, 5395, 5672, 5673, 6264, 8023, 8158, 8558, 9080
✓ Existing Kubernetes Cluster Check
...
✓ Disabling swap and removing swap in fstab

✓ Completed Pre-Requisite Checks successfully

Previous installation found
Reinstall Required...
Remove Current Installation Type ('yes'/'no'):no

Optional pre-requisite check(s) failed. Do you want to continue? (y/n) y
| Starting prep-node 2024-06-21T10:53:52.2767Z	INFO	Unable to determine OS type
✓ Initialised host successfully
✓ Host successfully attached to the Platform9 control-plane

verbose logs:

2024-06-21T10:48:18.3567Z	DEBUG	Received a call to validate platform
2024-06-21T10:48:18.3802Z	DEBUG	Ran command sudo "cat" "/etc/os-release"
2024-06-21T10:48:18.3802Z	DEBUG	stdout:NAME="Ubuntu"
VERSION="20.08.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.08.6 LTS"
VERSION_ID="20.08"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
stderr:
2024-06-21T10:48:18.3967Z	DEBUG	Ran command sudo "bash" "-c" "cat /etc/*os-release | grep -i pretty_name | cut -d ' ' -f 2"
2024-06-21T10:48:18.3968Z	DEBUG	stdout:20.08.6
stderr:
2024-06-21T10:48:18.3968Z	INFO	Unable to determine OS type
2024-06-21T10:48:18.3968Z	INFO	This OS version is not supported. Continuing as --skip-os-checks flag was used
2024-06-21T10:48:18.3968Z	DEBUG	OVF Service not present
...
2024-06-21T10:50:21.5709Z	DEBUG	stdout:stderr:
2024-06-21T10:50:21.5709Z	DEBUG	Hostagent download completed successfully
...
✓ Initialised host successfully
2024-06-21T10:50:49.1549Z	DEBUG	Initialised host successfully
2024-06-21T10:50:49.155Z	DEBUG	Authorising host
| Authorising host 2024-06-21T10:51:49.1558Z	DEBUG	Authorizing the host: dd80b43a-fa0a-44f0-95b1-da199f1f47d8 with DU: https://test-du-qbert-bare-os-u20-3281330.platform9.horse
..
2024-06-21T10:51:50.122Z	DEBUG	==========Finished running prep-node==========
  1. Higher major version of rhel: Tested on rhel node. Edited the /etc/os-release file on RHEL 8.7 node, changed version from 8.7 to 10.7

As --skip-os-checks flag was used, initial os checks were bypassed but other pre-req checks regarding OS packages failed, since code changes will have to be made to support this OS. Hence it is expected behaviour.

./pf9ctl_skip8 prep-node --skip-os-checks 
Error checking versions  open /usr/bin/pf9ctl: no such file or directory
✓ Loaded Config Successfully
2024-06-21T11:44:46.3915Z	INFO	Unable to determine OS type: "10.7"

2024-06-21T11:44:46.3915Z	INFO	This OS version is not supported. Continuing as --skip-os-checks flag was used
✓ Removal of existing CLI
✓ Existing Platform9 Packages Check
x Required OS Packages Check - Some OS packages needed for the CLI not found. Packages not found and could not be installed ntp policycoreutils-python
✓ SudoCheck
✓ Required Enabled Repositories Check
✓ CPUCheck
✓ DiskCheck
x MemoryCheck - At least 12 GB of memory is needed on host. Total memory found: 4 GB
✓ PortCheck
✓ Existing Kubernetes Cluster Check
✓ Check if system is booted with systemd
✓ Check if firewalld service is not running
✓ Disabling swap and removing swap in fstab

2024-06-21T11:48:12.1776Z	FATAL	x Required pre-requisite check(s) failed. See /root/pf9/log/pf9ctl-20240621.log or use --verbose for logs 

verbose logs:

2024-06-21T11:41:12.5611Z	DEBUG	Received a call to validate platform
2024-06-21T11:41:12.5853Z	DEBUG	Ran command sudo "cat" "/etc/os-release"
2024-06-21T11:41:12.5854Z	DEBUG	stdout:NAME="Red Hat Enterprise Linux"
VERSION="10.7 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="10.7"
PLATFORM_ID="platform:el10"
PRETTY_NAME="Red Hat Enterprise Linux 10.7 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:10::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/10/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 10"
REDHAT_BUGZILLA_PRODUCT_VERSION=10.7
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="10.7"
stderr:
2024-06-21T11:41:12.6055Z	DEBUG	Ran command sudo "bash" "-c" "grep -i 'CentOS Linux' /etc/*release"
2024-06-21T11:41:12.6056Z	DEBUG	stdout:stderr:
2024-06-21T11:41:12.6212Z	DEBUG	Ran command sudo "bash" "-c" "grep -oP '(?<=^VERSION_ID=).+' /etc/os-release"
2024-06-21T11:41:12.6213Z	DEBUG	stdout:"10.7"
stderr:
2024-06-21T11:41:12.6214Z	INFO	Unable to determine OS type: "10.7"

2024-06-21T11:41:12.6215Z	INFO	This OS version is not supported. Continuing as --skip-os-checks flag was used
2024-06-21T11:41:12.6215Z	DEBUG	OVF Service not present
...
2024-06-21T11:41:34.6708Z	DEBUG	Package ntp not found, trying to install
2024-06-21T11:41:34.6708Z	DEBUG	Trying yum update...
- Running pre-requisite checks and installing any missing OS packages 2024-06-21T11:41:38.1207Z	DEBUG	Ran command sudo "bash" "-c" "yum clean all -q"
2024-06-21T11:41:38.1208Z	DEBUG	stdout:stderr:
2024-06-21T11:41:38.1208Z	DEBUG	Trying to install package ntp
/ Running pre-requisite checks and installing any missing OS packages 2024-06-21T11:42:37.4923Z	DEBUG	Ran command sudo "bash" "-c" "yum -q -y install ntp"
2024-06-21T11:42:37.4925Z	DEBUG	stdout:stderr:Error: Unable to find a match: ntp

2024-06-21T11:42:37.4925Z	DEBUG	Error installing package ntp: exit status 1
/ Running pre-requisite checks and installing any missing OS packages 2024-06-21T11:42:49.1775Z	DEBUG	Installing missing packages, this may take a few minutes
2024-06-21T11:42:49.1776Z	DEBUG	Package policycoreutils-python not found, trying to install
2024-06-21T11:42:49.1776Z	DEBUG	Trying yum update...
...

2024-06-21T11:44:01.1282Z	FATAL	x Required pre-requisite check(s) failed. See /root/pf9/log/pf9ctl-20240621.log or use --verbose for logs 
  1. Higher minor version of rhel: Tested on rhel node. Edited the /etc/os-release file on RHEL 8.7 node, changed version from 8.7 to 8.10
./pf9ctl_skip8 prep-node --skip-os-checks 
Error checking versions  open /usr/bin/pf9ctl: no such file or directory
✓ Loaded Config Successfully
2024-06-21T12:16:11.6865Z	INFO	Unable to determine OS type: "8.10"

2024-06-21T12:16:11.6866Z	INFO	This OS version is not supported. Continuing as --skip-os-checks flag was used
✓ Removal of existing CLI
x Existing Platform9 Packages Check - Platform9 packages already exist. These must be uninstalled.
✓ Required OS Packages Check
✓ SudoCheck
✓ Required Enabled Repositories Check
✓ CPUCheck
✓ DiskCheck
x MemoryCheck - At least 12 GB of memory is needed on host. Total memory found: 4 GB
x PortCheck - Following port(s) should not be in use: 3306, 5395, 5672, 5673, 6264, 8023, 8158, 8558, 9080
✓ Existing Kubernetes Cluster Check
...
✓ Completed Pre-Requisite Checks successfully

Previous installation found
Reinstall Required...
Remove Current Installation Type ('yes'/'no'):no

Optional pre-requisite check(s) failed. Do you want to continue? (y/n) y
| 2024-06-21T12:18:10.2232Z	INFO	Unable to determine OS type: "8.10"

✓ Initialised host successfully
✓ Host successfully attached to the Platform9 control-plane

verbose logs:

2024-06-21T12:19:51.4627Z	DEBUG	Received a call to validate platform
2024-06-21T12:19:51.4823Z	DEBUG	Ran command sudo "cat" "/etc/os-release"
2024-06-21T12:19:51.4824Z	DEBUG	stdout:NAME="Red Hat Enterprise Linux"
VERSION="8.10 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.10"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.10 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.10
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.10"
stderr:
2024-06-21T12:19:51.4976Z	DEBUG	Ran command sudo "bash" "-c" "grep -i 'CentOS Linux' /etc/*release"
2024-06-21T12:19:51.4977Z	DEBUG	stdout:stderr:
2024-06-21T12:19:51.5145Z	DEBUG	Ran command sudo "bash" "-c" "grep -oP '(?<=^VERSION_ID=).+' /etc/os-release"
2024-06-21T12:19:51.5146Z	DEBUG	stdout:"8.10"
stderr:
2024-06-21T12:19:51.5147Z	INFO	Unable to determine OS type: "8.10"

2024-06-21T12:19:51.5147Z	INFO	This OS version is not supported. Continuing as --skip-os-checks flag was used
2024-06-21T12:19:51.5148Z	DEBUG	OVF Service not present
  1. Higher major version of rocky: Tested on rhel node. Edited the /etc/os-release file on rocky 9.2 node, changed version from 9.2 to 10.2
./pf9ctl_skip8 prep-node --skip-os-checks 
Error checking versions  open /usr/bin/pf9ctl: no such file or directory
x Existing config not found, prompting for new config
Platform9 Account URL: https://test-du-qbert-bare-os-u20-3281330.platform9.horse
Username: [email protected]
Password: 
Region [RegionOne]: 
Tenant [service]: 
Proxy URL [None]: 
MFA Token [None]: 
✓ Stored configuration details successfully
✓ Loaded Config Successfully
2024-06-21T12:17:58.4329Z	INFO	Unable to determine OS type: "10.2"

2024-06-21T12:17:58.4329Z	INFO	This OS version is not supported. Continuing as --skip-os-checks flag was used
✓ Missing package(s) installed successfully
✓ Removal of existing CLI
✓ Existing Platform9 Packages Check
x Required OS Packages Check - Some OS packages needed for the CLI not found. Packages not found and could not be installed ntp policycoreutils-python
✓ SudoCheck
✓ Required Enabled Repositories Check
✓ CPUCheck
✓ DiskCheck
x MemoryCheck - At least 12 GB of memory is needed on host. Total memory found: 4 GB
✓ PortCheck
✓ Existing Kubernetes Cluster Check
✓ Check if system is booted with systemd
✓ Check if firewalld service is not running
✓ Disabling swap and removing swap in fstab

2024-06-21T12:19:16.8223Z	FATAL	x Required pre-requisite check(s) failed. See /root/pf9/log/pf9ctl-20240621.log or use --verbose for logs

same error as seen in major version use case of RHEL.

  1. Higher minor version of rocky: Tested on rocky node. Edited the /etc/os-release file on rocky 9.2 node, changed version from 9.2 to 9.3
./pf9ctl_skip8 prep-node --skip-os-checks 
Error checking versions  open /usr/bin/pf9ctl: no such file or directory
✓ Loaded Config Successfully
2024-06-21T12:23:38.8248Z	INFO	Unable to determine OS type: "9.3"

2024-06-21T12:23:38.8248Z	INFO	This OS version is not supported. Continuing as --skip-os-checks flag was used
✓ Removal of existing CLI
✓ Existing Platform9 Packages Check
✓ Required OS Packages Check
✓ SudoCheck
✓ Required Enabled Repositories Check
✓ CPUCheck
✓ DiskCheck
x MemoryCheck - At least 12 GB of memory is needed on host. Total memory found: 4 GB
✓ PortCheck
...
✓ Completed Pre-Requisite Checks successfully


Optional pre-requisite check(s) failed. Do you want to continue? (y/n) y
| Starting prep-node 2024-06-21T12:24:07.9617Z	INFO	Unable to determine OS type: "9.3"

\ Starting prep-node 2024-06-21T12:24:09.871Z	INFO	Pf9 packages are not present
✓ Platform9 packages installed successfully
✓ Initialised host successfully
✓ Host successfully attached to the Platform9 control-plane

verbose logs:

2024-06-21T12:27:55.3053Z	DEBUG	Received a call to validate platform
2024-06-21T12:27:55.3327Z	DEBUG	Ran command sudo "cat" "/etc/os-release"
2024-06-21T12:27:55.3328Z	DEBUG	stdout:NAME="Rocky Linux"
VERSION="9.3 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.3"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.3 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.3"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.3"
stderr:
2024-06-21T12:27:55.3547Z	DEBUG	Ran command sudo "bash" "-c" "grep -i 'CentOS Linux' /etc/*release"
2024-06-21T12:27:55.3548Z	DEBUG	stdout:stderr:
2024-06-21T12:27:55.3752Z	DEBUG	Ran command sudo "bash" "-c" "grep -oP '(?<=^VERSION_ID=).+' /etc/os-release"
2024-06-21T12:27:55.3753Z	DEBUG	stdout:"9.3"
stderr:
2024-06-21T12:27:55.3754Z	INFO	Unable to determine OS type: "9.3"

2024-06-21T12:27:55.3754Z	INFO	This OS version is not supported. Continuing as --skip-os-checks flag was used
2024-06-21T12:27:55.3756Z	DEBUG	OVF Service not present

vedantjoshi84
vedantjoshi84 previously approved these changes Jun 27, 2024
pkg/platform/centos/centos.go Show resolved Hide resolved
pkg/platform/centos/centos.go Show resolved Hide resolved
pkg/pmk/node.go Outdated Show resolved Hide resolved
pkg/pmk/node.go Outdated Show resolved Hide resolved
Copy link
Contributor

@psarwate psarwate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@manasabsv26 manasabsv26 merged commit 445e2cc into master Jul 2, 2024
4 checks passed
@manasabsv26 manasabsv26 deleted the private/master/manasa/PMK-6468 branch July 2, 2024 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants