Skip to content

Commit

Permalink
Merge pull request #1333 from wanyaoqi/fix/no-reboot-on-controller-node
Browse files Browse the repository at this point in the history
fix: no reboot on controller node
  • Loading branch information
zexi authored Jul 30, 2024
2 parents 10045c7 + 323b6b7 commit 5f0e98a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 35 deletions.
5 changes: 4 additions & 1 deletion lib/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ def start(config_file):
except AttributeError:
pass
vars = config.ansible_global_vars()
vars['no_reboot'] = 'false' if need_reboot(ip, inside=True) else 'true'
# 240722 wanyaoqi: no_reboot has been removed before this change
# vars['no_reboot'] = 'false' if need_reboot(ip, inside=True) else 'true'
vars['is_controller_node'] = 'true' if config.is_controller_node() else 'false'
print("vars: ", vars)
return_code = cmd.run_ansible_playbook(
inventory_f,
'./onecloud/install-cluster.yml',
Expand Down
7 changes: 7 additions & 0 deletions lib/ocboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ def get_primary_master_ssh_port(self):
return
return self.primary_master_config.node.port

def is_controller_node(self):
if self.primary_master_config:
return True
if self.master_config:
return True
return False

def _fetch_conf(self, config_cls):
group = config_cls.get_group()
group_config = self.config.get(group, None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
- name: Update GRUB
command: update-grub

- name: Check is need manual reboot to disable unified cgroup hierarchy
fail:
msg: "GRUB updated, Please reboot to disable cgroup hierarchy and run install script again"
when: is_controller_node|default(false)|bool == true

- name: "Reboot the system because GRUB updated. You can rerun this script when system running"
ansible.builtin.reboot:

Expand Down
2 changes: 1 addition & 1 deletion onecloud/roles/utils/gpu-init/files/gpu_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ env_check() {
error_exit "You need sudo or root to run this script."
fi

local supported_distros=("centos" "debian" "openeuler", "ubuntu")
local supported_distros=("centos" "debian" "openeuler" "ubuntu")
local distros=($(get_distro))

local found_supported_distro=false
Expand Down
2 changes: 1 addition & 1 deletion onecloud/roles/utils/kernel-check/files/hugetlb_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ env_check() {
error_exit "You need sudo or root to run this script."
fi

local supported_distros=("centos" "debian" "openeuler", "ubuntu")
local supported_distros=("centos" "debian" "openeuler" "ubuntu")
local distros=($(get_distro))

local found_supported_distro=false
Expand Down
4 changes: 4 additions & 0 deletions onecloud/roles/utils/kernel-check/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
when:
- is_centos_x86 | default(false) | bool == true
- is_yunion_kernel_running.rc != 0
- is_controller_node is not defined or is_controller_node|default(false)|bool == false
- ansible_connection == "ssh"

- name: Local Reboot system if not cloud kernel, it should take a few minutes...
Expand All @@ -97,6 +98,7 @@
when:
- is_centos_x86 | default(false) | bool == true
- is_yunion_kernel_running.rc != 0
- is_controller_node is not defined or is_controller_node|default(false)|bool == false
- ansible_connection == "local"

- name: SSH Reboot system if hugetlb conf is updated
Expand All @@ -106,11 +108,13 @@
become: yes
when:
- hugetlb_is_ready == false
- is_controller_node is not defined or is_controller_node|default(false)|bool == false
- ansible_connection == "ssh"

- name: Local Reboot system if hugetlb conf is updated
command: reboot
become: yes
when:
- hugetlb_is_ready == false
- is_controller_node is not defined or is_controller_node|default(false)|bool == false
- ansible_connection == "local"

This file was deleted.

0 comments on commit 5f0e98a

Please sign in to comment.