Baremetal
Unblock a stuck oc delete bmh
command
Sometimes, when deleting a BMH object with oc delete bmh -n openshift-machine-api <node name>
the delete command is stuck forever.
This happens because ironic is trying to decommision and delete stuff from the node itself, and does not always succeed with that.
To unblock the delete command, simply remove the object finalizer:
oc patch -n openshift-machine-api <node name> -p '{"metadata":{"finalizers":null}}' --type=merge
Reprovisioning a node
- for convinency
oc project openshift-machine-api
- locate the correct secret, it’ll have the same name as the bmh with a ‘-bmc-secret’ postfix.
- save the secret -
oc get secret <bmh-name-bmc-secret> -o yaml > secret.yaml
- save the bmh -
oc get bmh <bmh-name> -o yaml > bmh.yaml
- only then delete the bmh -
oc delete bmh <bmh-name>
- edit the
secert.yaml
file so it includes only the date, type, metadata.name and meteadata.namespace fields - edit the bmh.yaml so it includes only the oc spec, metadata.name and meteadata.namespace fields
- apply -
oc apply -f secert.yaml
and thenoc apply -f bmh.yaml
The node should start reprovisioning and be ready after a while.