Skip to content

Commit c2003ad

Browse files
committed
Add OSP CP node migration docs
Resolves OSDOCS-3061
1 parent e495b33 commit c2003ad

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * nodes/nodes/nodes-nodes-working.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="nodes-control-plane-osp-migrating_{context}"]
7+
= Migrating control plane nodes from one RHOSP host to another
8+
9+
You can run a script that moves a control plane node from one {rh-openstack-first} node to another.
10+
11+
.Prerequisites
12+
13+
* The environment variable `OS_CLOUD` refers to a `clouds` entry that has administrative credentials in a `clouds.yaml` file.
14+
* The environment variable `KUBECONFIG` refers to a configuration that contains administrative {product-title} credentials.
15+
16+
.Procedure
17+
18+
* From a command line, run the following script:
19+
20+
[source,bash]
21+
----
22+
#!/usr/bin/env bash
23+
24+
set -Eeuo pipefail
25+
26+
if [ $# -lt 1 ]; then
27+
echo "Usage: '$0 node_name'"
28+
exit 64
29+
fi
30+
31+
# Check for admin OpenStack credentials
32+
openstack server list --all-projects >/dev/null || { >&2 echo "The script needs OpenStack admin credentials. Exiting"; exit 77; }
33+
34+
# Check for admin OpenShift credentials
35+
oc adm top node >/dev/null || { >&2 echo "The script needs OpenShift admin credentials. Exiting"; exit 77; }
36+
37+
set -x
38+
39+
declare -r node_name="$1"
40+
declare server_id
41+
server_id="$(openstack server list --all-projects -f value -c ID -c Name | grep "$node_name" | cut -d' ' -f1)"
42+
readonly server_id
43+
44+
# Drain the node
45+
oc adm cordon "$node_name"
46+
oc adm drain "$node_name" --delete-emptydir-data --ignore-daemonsets --force
47+
48+
# Power off the server
49+
oc debug "node/${node_name}" -- chroot /host shutdown -h 1
50+
51+
# Verify the server is shut off
52+
until openstack server show "$server_id" -f value -c status | grep -q 'SHUTOFF'; do sleep 5; done
53+
54+
# Migrate the node
55+
openstack server migrate --wait "$server_id"
56+
57+
# Resize the VM
58+
openstack server resize confirm "$server_id"
59+
60+
# Wait for the resize confirm to finish
61+
until openstack server show "$server_id" -f value -c status | grep -q 'SHUTOFF'; do sleep 5; done
62+
63+
# Restart the VM
64+
openstack server start "$server_id"
65+
66+
# Wait for the node to show up as Ready:
67+
until oc get node "$node_name" | grep -q "^${node_name}[[:space:]]\+Ready"; do sleep 5; done
68+
69+
# Uncordon the node
70+
oc adm uncordon "$node_name"
71+
72+
# Wait for cluster operators to stabilize
73+
until oc get co -o go-template='statuses: {{ range .items }}{{ range .status.conditions }}{{ if eq .type "Degraded" }}{{ if ne .status "False" }}DEGRADED{{ end }}{{ else if eq .type "Progressing"}}{{ if ne .status "False" }}PROGRESSING{{ end }}{{ else if eq .type "Available"}}{{ if ne .status "True" }}NOTAVAILABLE{{ end }}{{ end }}{{ end }}{{ end }}' | grep -qv '\(DEGRADED\|PROGRESSING\|NOTAVAILABLE\)'; do sleep 5; done
74+
----
75+
76+
If the script completes, the control plane machine is migrated to a new {rh-openstack} node.

nodes/nodes/nodes-nodes-working.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ include::modules/nodes-nodes-rtkernel-arguments.adoc[leveloffset=+1]
4141
endif::openshift-webscale[]
4242
include::modules/nodes-nodes-cgroups-2.adoc[leveloffset=+1]
4343
include::modules/nodes-nodes-swap-memory.adoc[leveloffset=+1]
44+
include::modules/nodes-control-plane-osp-migrating.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)