5.1 Virtual Machines (Paravirtual Mode)

This section contains the latest issues and information common to all operating systems running in paravirtual mode on the VM Server. It contains the following subsections:

5.1.1 Creating a Paravirtual VM

Basic instructions for creating a paravirtual VM are in Section 3.1.3, Creating a Virtual Machine (Paravirtual Mode).

5.1.2 Working with a Specific Operating System

Information in this section is common to all operating systems running in paravirtual mode. Before creating or running a VM, you should review issues related to its specific operating system in Section 7.0, Specific Operating Systems .

5.1.3 Power Management Features

Power management features, such as the suspend-to-disk feature, are not supported and should be disabled on the VM Server and all VMs.

5.1.4 Virtual Disk Performance Settings

For best performance, create each virtual disk from an entire disk or a partition. For next best performance, create an image file but do not create it as a sparse image file. A virtual disk based on a sparse image file delivers the most disk-space flexibility but the slowest installation and disk access speeds. (179409)

5.1.5 File-Backed Virtual Disks and Write Modes

By default, a VM’s virtual disk uses asynchronous write mode to write data to the disk. Asynchronous write mode dramatically improves VM system-to-disk performance because the VM Server can buffer data before actually writing to disk. Although it delivers better performance, the asynchronous write mode might corrupt the file system if the VM is using a file-backed virtual disk and the VM server has a system crash or power outage. This is because Xen does not support write barriers, which preserve the order of data being written to disk.

A virtual disk using synchronous write mode maintains file system integrity in the event of a system crash, but significantly slows write-to-disk performance by executing each write-to-disk activity before continuing. In synchronous write mode, the VM Server does not cache data.

To change between modes, append or remove the S flag to the existing writable flag in the disk line in the VM's configuration file. This mode is set per disk.

For example, the first statement specifies asynchronous disk-write mode (no S). The second statement specifies synchronous write mode (added S).

disk = [ 'file:/var/lib/xen/images/vm1/hda,hda,w' , 'phy:/dev/hdb,hdb,w' ]

disk = [ 'file:/var/lib/xen/images/vm1/hda,hda,wS', 'phy:/dev/hdb,hdb,w' ]

5.1.6 VM Hardware Clock Settings

If you are installing a paravirtualized Linux OS, you should choose UTC as the VM’s hardware clock setting. Choose Local Time if you are installing a paravirtualized OS that does not recognize the UTC setting, such as NetWare.

5.1.7 Using the Manage Virtual Machine Page

The following commands are available by running the Virtual Machine Management (Xen) module on the VM Server desktop.

  1. On the VM Server desktop, click YaST > System > Virtual Machine Management (Xen).

    The Manage Virtual Machines page displays all VMs.

  2. From the Manage Virtual Machines page, you can perform the following actions.

    • Add starts the process to create a new VM.
    • Start boots the operating system of the selected VM.
    • Refresh displays the current status of all VMs.
    • Delete completely removes the selected VM.
    • View displays the command console for the selected VM.
    • Shutdown performs a normal shutdown of the selected VM.
    • Terminate acts as if power is shut off to the selected VM.

5.1.8 Useful File Locations

Files

Location

VM configuration files

/etc/xen/vm/vm_name where vm_name is the name you entered for the VM

Example VM configuration files

/etc/xen/examples

File-backed virtual disk images

/var/lib/xen/images/vm_name/disk_image where vm_name is the VM name and disk_image is the name of the disk image file

5.1.9 Using the xm Command

You can perform actions on VMs by using the xm command. In a terminal, log in as root and enter the desired command.

Command

Action

xm help

View a list of actions available for the xm command

xm list

View a list of all running virtual machines

xm create /etc/xen/vm/vm_name -c

Start and view a VM (paravirtual)

(The VM starts and displays in the terminal window)

xm console vm_name

View the console of an already-running VM

xm mem-set vm_name MB_Memory

Change the memory available to a VM

xm shutdown vm_name

Perform a normal shutdown of the VM’s operating system

xm destroy vm_name

Terminate a VM immediately

5.1.10 Using a Remote Graphical Session to Log In to a VM

You can use a remote graphical session to log into a VM.This procedure describes using the VNC viewer.

  1. Start the VM.

  2. Make sure remote administration is allowed on the VM. (You only need to do this once for each VM.)

    1. Log in to the VM in text mode.

    2. At the command prompt, enter yast2 to run the text version of YaST.

    3. Select Network Services > Remote Administration.

    4. Select the box to allow remote administration.

    5. Click Finish and then exit YaST.

    6. At the command prompt, enter rcxdm restart.

  3. On the Xen VM Server desktop, open a new terminal.

  4. In the new terminal, enter vncviewer ip_address:1 where ip_address is the IP address of the VM.

    HINT:To get the IP address, select the VM in the Manage Virtual Machines window, click View, log in as root, and then enter ifconfig at the command prompt.

    You could also log in to the VM by entering http://vm_ip_address:5801 in a Web browser running on any network-attached computer.

You can also log in to a VM using other access methods, such as SSH.

5.1.11 Disabling Virtual Hardware Clock Synchronization

A paravirtualized OS gets its clock time by continuously synchronizing with the VM Server clock. If you want the OS to get its clock time from another source, such as an NTP server, you must disable the VM Server clock synchronization.

  1. Log in to the VM’s OS as root.

  2. In a terminal, enter cat /proc/sys/xen/independent_wallclock to view the VM’s current clock synchronization setting.

    • 0 means it is being synchronized with Xen VM Server.
    • 1 means it is not being synchronized with Xen VM Server.
  3. Change the setting.

    • To disable synchronization permanently, add xen.independent_wallclock = 1 to the VM’s /etc/sysctl.conf file.
    • To temporarily disable synchronization until the next reboot, enter echo "1" > /proc/sys/xen/independent_wallclock at the VM’s command prompt. Replace 1 with 0 to enable synchronization.

5.1.12 Working with Virtual CD Readers

The following information might help resolve issues related to virtual CD readers. All issues relate to both CD and DVD media and readers.

About Paravirtual CD Readers

A paravirtual VM accesses CD or DVD media by attaching a CD reader as a fixed block device, not as a removable media device. For this reason, typical commands associated with CD readers, such as eject or autorun, do not work. Writing to the CD is not possible from a paravirtualized VM (even if you specify the block device as -w).

Accessing and ejecting the CD is still possible, but must be done using the VM Server terminal commands attach and detach. For example, instead of using the eject command (or simply pressing the eject button on the reader) to eject the CD from the reader, you must detach the CD reader from the VM using the detach command. After the CD reader detaches, the CD can then be safely removed from the CD reader. To read another CD, you must insert the CD and reattach the CD reader.

Some applications running are programmed to specifically recognize the CD reader. This type of application might not be able to access the CD media, even though it is attached as a block device.

Ejecting and Switching CDs

You might need to press the eject button twice to eject a CD on a paravirtual VM. When you insert a CD, make sure to pause long enough for the CD to be recognized by the VM Server. If the inserted CD cannot be read, you should detach and reattach the VM to the CD reader.

VM CD Reader Cannot Access Installation Media

When installing software from CD, you might receive a message stating “Cannot access installation media...” If inserting the CD and choosing OK does not read the newly inserted CD but returns the same message, you should detach and reattach the VM to the CD reader.

Attaching a CD Reader

To attach a CD reader to a VM:

  1. Make sure the CD reader is detached by following the instructions in Detaching a CD Reader.

  2. Make sure the desired CD is inserted in the CD reader.

    HINT:Give VM Server enough time to recognize the CD before continuing.

  3. Open a VM Server terminal, then enter the following command:

    xm block-attach vm_id device_type:/path/device_name virtual_device_name rights
    

    where:

    • vm_id is the ID number of the VM. For example, 1.
    • device_type:/path/device_name is the device type, location, and name of the CD reader. For example, phy:/dev/hdc
    • virtual_device_name is the device name to present to the VM. For example, hdb.
    • rights are the access rights to the device, such as r.

    For example, the command to attach hdc as a CD reader on VM 1 is:

    xm block-attach 1 phy:/dev/hdc hdb r
    

    HINT:If you are reattaching a CD reader, you can view the device information by opening the VM Server’s file at /etc/xen/vm/vm_name where vm_name is the name of the VM. The device information is part of the disk entry line. It begins with phy: and is usually listed near the end of the output string. Remember to use spaces instead of commas between the parameters.

    The CD should now be accessible to the VM.

Detaching a CD Reader

To detach a CD reader:

  1. Enter xm block-detach vm_id Vdev_number in a VM Server terminal.

    This command detaches the connection between the VM and the CD reader. For example, xm block-detach 1 832 detaches the connection between VM with an ID of 1 and the device with a Vdev of 832.

HINT:Get the relevant information for the command by performing the following actions:

  • VM ID: Open a terminal on the VM Server desktop and enter xm list.
  • Vdev number: Enter xm block-list vm_id where vm_id is the ID number of the VM. The last device displayed in the list usually represents the CD reader, because the first devices are usually disk drives.

Sometimes, even after entering the command, the virtual CD reader does not detach correctly. If this happens, you can attach the virtual CD reader with a new drive designation. (See Attaching a Virtual CD Drive with a Different Drive Designation.)

Adding a Virtual CD Reader

Attaching to a CD reader makes it available until you reboot the VM. To make a CD reader available after rebooting, complete the following instructions.

  1. On the VM Server desktop, open the VM’s configuration file at /etc/xen/vm/vm_name where vm_name is the name of the VM.

  2. Edit the disk entry line to include the CD information using the syntax:

    device_type:/path/device_name virtual_device_name rights
    

    where:

    • device_type:/path/device_name is the device type, location, and name of the CD reader. For example, phy:/dev/hdc
    • virtual_device_name is the device name to present to the VM. For example, hdb.
    • rights are the access rights to the device, such as r.

    For example, the following string specifies a virtual disk (based on a file) and no CD reader:

    disk = [ 'file:/var/lib/xen/images/vm1/hda,hda,w' ]

    The following string adds a CD reader identified as hdc and recognized by the VM as hdb:

    disk = [ 'file:/var/lib/xen/images/vm1/hda,hda,w' , 'phy:/dev/hdc,hdb,r' ]

  3. Save and close the file.

  4. Reboot the VM to make the virtual CD reader available.

Attaching a Virtual CD Drive with a Different Drive Designation

You can temporarily change the virtual CD drive designation using either of the methods described below. This is useful if the existing virtual CD reader is not functioning correctly and will not detach or attach.

The temporary drive designation is available for the current VM session only. When the VM reboots, the former drive designation, as defined in the VM configuration file, returns.

The first method is performed from a terminal on the VM Server desktop. The second method is performed when you receive the message stating, “Cannot access installation media...” These methods might also be useful when working with disk drives, partitions, volumes, or other types of block devices.

Attaching From a Terminal
  1. Make sure the desired CD is inserted and has spun up in the CD reader.

  2. Open a terminal and enter the following command but specify a different virtual drive designation than originally specified.

    xm block-attach vm_id device_type:/path/device_name virtual_device_name rights
    

    For example, you could specify the drive designation as hdb instead of hdc, such as changing phy:/dev/hdc,hdb,r to phy:/dev/hdc,hdc,r.

Attaching from the “Cannot Access Installation Media” Message
  1. Insert the CD into the CD reader.

  2. Access the CD from the VM.

  3. When the “Cannot Access Installation Media...” message displays, press Alt+d to view the details.

  4. Press Alt+u to change the URL.

  5. In the URL field, change the virtual drive designation of the CD reader. For example, you could change the VM to recognize the CD reader as hdc instead of hdb, such as changing phy:/dev/hdc,hdb,r to phy:/dev/hdc,hdc,r.

  6. Make sure the desired CD is inserted and spinning in the CD reader.

  7. Choose OK to read the CD.

Using a CD As an Installation Source

The VM does not differentiate between a CD reader and a fixed disk device; therefore, a CD cannot be configured as a CD or DVD installation source, but must be configured as a virtual drive by specifying a URL..

Complete the following instructions to set up and access a CD as an installation source:

  1. Make sure the correct CD installation media is in the CD reader.

  2. From the VM’s desktop, run the YaST > Software > Installation Source module.

  3. Press Add > Specify URL.

  4. Specify the URL as hd:///?device=/path/drive_designation where drive_designation is the drive designation of the physical CD reader.

    For example, for a CD reader with the path and drive designation /dev/hdc, enter hd:///?device=/dev/hdc

  5. Make sure the new installation source is enabled, then choose Finish.

The CD installation source is now accessible through the YaST > Software > Software Management module.