Chapter 4. Managing a Virtualization Environment

Contents

4.1. Virtual Machine Manager
4.2. Controlling the Host by Modifying xend Settings
4.3. Configuring a Virtual Machine by Modifying its xend Settings
4.4. The xm Command

Graphical utilities, text-based commands, and modified configuration files are methods you can choose from to manage your virtualization environment.Virtual Machine Manager is a graphical utility available in YaST that can be launched from the virtual machine Domain0.

Figure 4.1. Desktop Showing Virtual Machine Manager and Virtual Machines

Desktop Showing Virtual Machine Manager and Virtual Machines

From a command line interface on the virtual machine host, you can use the vm-install program and xm commands to create and manage virtual machines. You can also edit configuration files to change the settings of the virtual machine host or a virtual machine.

4.1. Virtual Machine Manager

From the desktop of the management virtual machine, the YaST Virtual Machine Manager provides a graphical user interface you can use to create and manage virtual machines.

[Note]

Close Virtual Machine Manager if you are not actively using it and restart it when needed. Closing Virtual Machine Manager does not affect the state of virtual machines.

Figure 4.2. Virtual Machine Manager Main Console

Virtual Machine Manager Main Console

  • Selecting a virtual machine and clicking Open displays the virtual machine window showing the virtual machine’s current state.

  • Clicking Run on the virtual machine window boots the virtual machine and displays the user interface or text console running on the virtual machine.

  • Selecting a virtual machine and clicking Details lets you view performance and configure hardware details associated with the virtual machine.

  • Clicking New in Virtual Machine Manager launches the Create Virtual Machine Wizard, which walks you through the steps required to set up a virtual machine. See also Section 3.1, “Creating a Virtual Machine”.

4.2. Controlling the Host by Modifying xend Settings

The xend is a key component of Xen virtualization. It performs management functions and stores settings that relate to the host environment and each virtual machine. You can customize xend to meet your specific configuration requirements.

  • To specify xend operating parameters, edit the /etc/xen/xend-config.sxp file. The settings take effect the next time xend starts.

    # -*- sh -*-
    
    #
    # Xend configuration file.
    #
    
    # This example configuration is appropriate for an installation that
    # utilizes a bridged network configuration. Access to xend via http
    # is disabled.
    
    # Commented out entries show the default for that entry, unless otherwise
    # specified.
    
    #(logfile /var/log/xen/xend.log)
    #(loglevel DEBUG)
    
    
    # The Xen-API server configuration.
    #
    # This value configures the ports, interfaces, and access controls for the
    # Xen-API server. Each entry in the list starts with either unix, or a port
  • To start the xend daemon, enter rcxend start.

  • To stop the xend daemon, enter rcxend stop.

  • To restart the xend daemon, enter rcxend restart.

  • To check the status of the xend daemon, enter rcxend status.

The parameters in the xend-config.sxp file can be customized to meet your requirements for virtualization. For a full list of all available options, read the manual page of xend-config.sxp.

4.3. Configuring a Virtual Machine by Modifying its xend Settings

The machine settings of each virtual guest are stored in an internal database managed by xend. You can change a virtual machine’s settings by modifying the settings stored in xend. This process requires you to export a virtual machine’s settings from the xend database to a text file, edit the settings in the file to meet your configuration requirements, import the file back into xend, and restart the virtual machine.

[Note]

It is no longer recommended that you edit the initial startup files stored in /etc/xen/vm, because they are used only during the creation of a new virtual machine.

To modify a virtual machine’s settings that is administrated with the virtual machine manager:

  1. At Domain0, enter

    xm list -l vm_name > filename
    

    where vm_name is the name of the virtual machine you want to modify and filename is whatever you want to name the text file.

  2. Use a text editor to make and save any desired changes.

    (domain
       (domid 1)
       (on_crash destroy)
       (memory 384)
       (uuid 4fbcb943-871c-9a51-3a48-3ad99d933841)
       (bootloader_args '- -entry=xvda2:/boot/vmlinuz-xen,/boot/initrd-xen')
       (name SLES10withOES2)    (maxmem 512)
       (on_reboot restart)
       (on_poweroff destroy)
       (vcpus 1)
       (bootloader /usr/lib/xen/boot/domUloader.py)
       (shadow_memory 0)
       (cpu_weight 256)
       (cpu_cap 0)
       (features )
       (on_xend_start ignore)
       (on_xend_stop ignore)
       (start_time 1178219902.47)
       (cpu_time 4574.26779201)
       (online_vcpus 1)
       (image
           (linux
               (kernel /var/lib/xen/tmp/kernel.Bg0o6h)
               (ramdisk /var/lib/xen/tmp/ramdisk.Bch8YM)
               (args 'TERM=xterm ')
           )
       )
       (status 2)
    ....
    
  3. Delete the existing configuration from xenstore with the command xm del vm_name

  4. Enter xm new -F filename to import the virtual machine’s new settings into xend.

  5. Enter xm start vm_name to start the virtual machine with its new settings.

    You should repeat the entire process of exporting the file each time you want to make changes to a virtual machine’s settings.

4.4. The xm Command

The xm command provides a command line interface for managing virtual machines. It can be used to create, pause, and shut down virtual machines. It can also be used to list the current domains, enable or pin virtual CPUs, and attach or detach block devices. For example, the xm list command displays the status of all virtual machines.

# xm list
Name                                 ID    Mem VCPUs        State   Time(s)
Domain-0                              0    457     2       r-----   2712.9
OES                                   7    512     1       -b----     16.3
SLES10                                     512     1                  12.9

The syntax of the xm command usually follows the format:

xm  <subcommand> [domain-id] [OPTIONS]

where subcommand is the xm command to run, domain-id is the ID number assigned to a domain or the name of the virtual machine, and OPTIONS indicates subcommand-specific options.

Other useful xm commands include:

  • xm start starts a virtual machine

  • xm reboot reboots a virtual machine

  • xm destroy immediately terminates a virtual machine

  • xm block-list displays all virtual block devices attached to a virtual machine

  • All xm operations require that the Xen control daemon, xend, be running. For this reason, you should make sure xend starts whenever the host boots.

  • Most xm commands require root privileges to allow interaction with the Xen hypervisor. Entering the xm command when you are not logged in as root returns an error.

  • Some xm commands return no information even though the action is completed. In some instances, for example, when shutting down a virtual machine, the action can take several seconds to complete. To verify that the action has completed, you might need to view its status another way, such as, using the xm list command.

For a complete list of xm command parameters, enter xm help at the command line or read the manual page of xm.