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 exercise
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
exercise9
virtual machine
-
Open the virtual machine
Console
tab
-
Log in with user
lab-user
and passwordredhat1
. After that execute thesudo shutdown -h now
command
-
Verify the virtual machine stopped
-
After some seconds the virtual machine will be
Running
again.
-
Open the YAML tab
-
Verify that
runStrategy
is configured asAlways
-
Change it to
Manual
lab grade exercise9
Command line (CLI)
-
Login to Openshift server API using the assigned user account with
oc
command 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
always
tomanual
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