Jump to contentJump to page navigation: previous page [access key p]/next page [access key n]
Applies to SUSE Linux Enterprise Server 11 SP4

7 Basic VM Guest Management

Basic management tasks such as starting or stopping a VM Guest, can either be done using the graphical application Virtual Machine Manager or on the command line using virsh. Connecting to the graphical console via VNC is only possible from a graphical user interface.

7.1 Listing VM Guests

In order to be able to list VM Guests, you need to connect to a VM Host Server first. If you start the management tool on the VM Host Server itself, you are automatically connected. When operating from remote, refer to Section 8.3, “Connecting to a VM Host Server” for instructions.

7.1.1 Listing VM Guests with Virtual Machine Manager

The main Window of the Virtual Machine Manager shows a list of all VM Guests for each VM Host Server it is connected to. Each VM Guest entry contains the machine's name, its status (Running, Paused, or Shutoff) displayed as icon and literal, and a CPU usage bar.

7.1.2 Listing VM Guests with virsh

Use the command virsh list to get a list of VM Guests:

List running guests on localhost
virsh -c qemu:///system list
List running and inactive guests as user wilber on a remote host over a TLS connection
virsh -c qemu+tls://wilber@mercury.example.com/system list --all
List running and inactive guests as user tux on a remote host over an SSH tunnel
virsh -c qemu+ssh://tux@mercury.example.com/system list --inactive

7.2 Opening a Graphical Console

Opening a Graphical Console to a VM Guest lets you interact with the machine like a physical host via a VNC connection. If accessing the VNC server requires authentication, you are prompted to enter a username (if applicable) and a password.

Once you click into the VNC console, the cursor is grabbed and cannot be used outside the console anymore. To release it, press AltCtrl.

Tip: Seamless (Absolute) Cursor Movement

In order to prevent the console from grabbing the cursor and to enable seamless cursor movement, add a tablet input device to the VM Guest. See Section 10.1, “Enabling Seamless and Synchronized Cursor Movement” for more information.

Certain key combinations such as CtrlAltDel are interpreted by the host system and are not passed to the VM Guest.

To pass such key combinations to a VM Guest, open the Send Key menu from the VNC window and choose the desired key combination entry. The Send Key menu is only available when using Virtual Machine Manager and virt-viewer

Note: Supported VNC Viewer

Principally all VNC viewers are able to connect to the console of a VM Guest. However, if you are using SASL authentication and/or TLS/SSL connection to access the guest, the options become limited. Common VNC viewers such as tightvnc or tigervnc support neither SASL authentication or TSL/SSL. The only supported alternative to Virtual Machine Manager and virt-viewer is vinagre.

7.2.1 Opening a Graphical Console with Virtual Machine Manager

  1. In the Virtual Machine Manager, right-click a VM Guest entry.

  2. Choose Open from the pop-up menu.

7.2.2 Opening a Graphical Console with virt-viewer

virt-viewer is a simple VNC viewer with added functionality for displaying VM Guest consoles. It can, for example, be started in wait mode, where it waits for a VM Guest to start before it connects. It also supports automatically reconnecting to a VM Guest that is rebooted.

virt-viewer addresses VM Guests by name, by ID or by UUID. Use virsh list --all to get this data.

To connect to a guest that is running or paused, either use the ID, UUID, or name. VM Guests that are shut off do not have an ID—you can only connect by UUID or name.

Local connect to guest with ID 8
virt-viewer -c qemu:///system 8
Local connect to the inactive guest sles11; will connect once the guest starts
virt-viewer -c qemu:///system --wait sles11

With the --wait option, the connection will be upheld even if the VM Guest is not running at the moment. Once the guest starts, the viewer will be launched.

Remote connect via ssh:
virt-viewer -c qemu+ssh://tux@mercury.example.com/system -w sles11

For more information, see virt-viewer --help or man 1 virt-viewer.

7.3 Changing a VM Guest's State: Start, Stop, Pause

Starting, stopping or pausing a VM Guest can either be done with Virtual Machine Manager or virsh. You can also configure a VM Guest to be automatically started when booting the VM Host Server.

When shutting down a VM Guest, you may either shut it down gracefully, or force the shutdown. The latter is equivalent to pulling the power plug on a physical host and is only recommended if there are no alternatives. Forcing a shutdown may cause file system corruption and loss of data on the VM Guest.

Tip: Graceful Shutdown

In order to be able to perform a graceful shutdown, the VM Guest must be configured to support ACPI. If you have created the guest with vm-install or with Virtual Machine Manager, ACPI should be available. Use the following procedure in Virtual Machine Manager to check:

Double-click the VM Guest entry in Virtual Machine Manager. Choose View › Details and then Overview › Machine Settings. ACPI should be checked.

Depending on the guest operating system, enabling ACPI may not be sufficient. It is strongly recommended to test shutting down and rebooting a guest before releasing it to production. openSUSE or SUSE Linux Enterprise Desktop, for example, may require PolicyKit authorization for shutdown and reboot. Make sure this policy is turned off on all VM Guests.

If ACPI was enabled during a Windows XP/Server 2003 guest installation, turning it on in the VM Guest configuration alone is not sufficient. See the following articles for more information:


A graceful shutdown is of course always possible from within the guest operating system, regardless of the VM Guest's configuration.

7.3.1 Changing a VM Guest's State with Virtual Machine Manager

Changing a VM Guest's state can either be done from Virtual Machine Manager's main window, or from a VNC window.

Procedure 7.1: State Change from the Virtual Machine Manager Window
  1. Right-click on a VM Guest entry.

  2. Choose Run, Pause, or one of the Shutdown options from the pop-up menu.

Procedure 7.2: State change from the VNC Window
  1. Open a VNC Window as described in Section 7.2.1, “Opening a Graphical Console with Virtual Machine Manager”.

  2. Choose Run, Pause, or one of the Shut Down options either from the toolbar or from the Virtual Machine menu. Autostarting a VM Guest

Automatically starting a guest when the VM Host Server boots is not enabled by default. This feature needs to be turned on for each VM Guest individually. There is no way to activate it globally.

  1. Double-click the VM Guest entry in Virtual Machine Manager to open its console.

  2. Choose View › Details to open the VM Guest configuration window.

  3. Choose Boot Options and check Start virtual machine on host boot up.

  4. Save the new configuration with Apply.

7.3.2 Changing a VM Guest's State with virsh

In the following examples the state of a VM Guest named sles11 is changed.

virsh -c qemu:///system start sles11
virsh -c qemu:///system suspend sles11
virsh -c qemu:///system reboot sles11
Graceful shutdown
virsh -c qemu:///system shutdown sles11
Force shutdown
virsh -c qemu:///system destroy sles11
Turn on autostart
virsh -c qemu:///system autostart sles11
Turn off autostart
virsh -c qemu:///system autostart --disable sles11

7.4 Saving and Restoring VM Guests

Saving a VM Guest preserves the exact state of the guest’s memory. The operation is slightly similar to hibernating a computer. A saved VM Guest can be quickly restored to its previously saved running condition.

When saved, the VM Guest is paused, its current memory state is saved to disk, and then the guest is stopped. The operation does not make a copy of any portion of the VM Guest’s virtual disk. The amount of time to save the virtual machine depends on the amount of memory allocated. When saved, a VM Guest’s memory is returned to the pool of memory available on the VM Host Server.

The restore operation loads a VM Guest’s previously saved memory state file and starts it. The guest is not booted but rather resumes at the point where it was previously saved. The operation is slightly similar to coming out of hibernation.

The VM Guest is saved to a state file. Make sure there is enough space on the partition you are going to save to. Issue the following command on the guest to get a rough estimation of the file size in megabytes to be expected:

free -m | awk '/^Mem:/ {print $3}'

After using the save operation, do not boot, start, or run the saved VM Guest. Doing so would cause the machine's virtual disk and the saved memory state getting out of sync and can result in critical errors when restoring the guest.

7.4.1 Saving / Restoring with Virtual Machine Manager

Procedure 7.3: Saving a VM Guest
  1. Open a VNC connection window to a VM Guest. Make sure the guest is running.

  2. Choose Virtual Machine › Save

  3. Choose a location and a file name.

  4. Click Save. Saving the guest's state may take some time. After the operation has finished, the VM Guest will automatically shut down.

Procedure 7.4: Restoring a VM Guest
  1. Start the Virtual Machine Manager.

  2. Type AltR or choose File › Restore Saved Machine.

  3. Choose the file you want to restore and proceed with Open. Once the file has been successfully loaded, the VM Guest is up and running.

7.4.2 Saving / Restoring with virsh

Save a running VM Guest with the command virsh save and specify the file to where it is saved.

Save the guest named opensuse11
virsh save opensuse11 /virtual/saves/opensuse11.vmsav
Save the guest with the ID 37
virsh save 37 /virtual/saves/opensuse11.vmsave

To restore it, use virsh restore:

virsh restore /virtual/saves/opensuse11.vmsave

7.5 Deleting a VM Guest

Deleting a VM Guest removes its XML configuration by default. Since the attached storage is not deleted by default, you will be able to use it with another VM Guest. With Virtual Machine Manager you may also delete a guest's storage files as well—this will completely erase the guest.

In order to delete a VM Guest, it has to be shut down first (refer to Section 7.3, “Changing a VM Guest's State: Start, Stop, Pause” for instructions). It is not possible to delete a running guest.

7.5.1 Deleting a VM Guest with Virtual Machine Manager

  1. In the Virtual Machine Manager, right-click a VM Guest entry.

  2. Choose Delete from the pop-up menu.

  3. A confirmation window opens. Clicking Delete will permanently erase the VM Guest. The deletion is not recoverable.

    You may also choose to permanently delete the guest's virtual disk by ticking Delete Associated Storage Files. The deletion is not recoverable either.

7.5.2 Deleting a VM Guest with virsh

To delete a VM Guest with virsh run virsh undefine VM_NAME. There is no option to automatically delete the attached storage files.

Print this page