The VM doesn’t stop when shutdown is run inside the guest OS
Scenario
The virtual machine exercise9 does not remain powered off after the user executes the shutdown -h now command within the guest operating system. Instead, it powers back on automatically a few seconds after the shutdown process completes.
| You need to modify the Virtual Machine configuration to ensure it remains in a stopped state after shutdown using guest OS. |
The steps to fix exercise9 are:
lab break exercise9
Console
-
Login to OpenShift console using the assigned user account.
userx
{password}
-
Go to virtualization → Virtual Machines - select project for the assigned user account
-
Select the
exercise9virtual machine
-
Open the virtual machine
Consoletab
-
Log in with user
lab-userand passwordredhat1. After that execute thesudo shutdown -h nowcommand
-
Verify the virtual machine stopped
-
After some seconds the virtual machine will be
Runningagain.
-
Open the YAML tab
-
Verify that
runStrategyis configured asAlways
-
Change it to
Manual
lab grade exercise9
Command line (CLI)
-
Login to Openshift server API using the assigned user account with
occommand if not logged in.
{login_command}
-
Go to the assigned namespace-userx
oc project namespace-userx
-
List the virtual machines
oc get vm
-
Shutdown the virtual machine using OS command
virtctl ssh lab-user@exercise9 \
--command 'sudo shutdown -h now'
-
Check the virtual machine stopped and started again after a few seconds
oc get vm
-
Edit the virtual machine and change runStrategy from
alwaystomanual
oc edit vm exercise9
-
Shutdown the virtual machine using OS command again
virtctl ssh lab-user@exercise9 \
--command 'sudo shutdown -h now'
-
Check the virtual machine still stopped
oc get vm