Xen - Old

xm commands

  • xm help (shows all the commands with descriptions)
  • xm top (to see the load on each VM)
  • xm reboot <vmname>

Starting a VM

  • The VMs are available under /etc/xen
  • To start a VM: xm create VMNAME (e.g., #: xm create WWW)

Console Commands for Linux

If you want to connect to a domU console that is already running you first have to find the domU id using:

  1. xm list
Name Id Mem(MB) CPU State Time(s) Console
Domain-0 0 123 0 r---- 2482.9
testXM1 30 127 1 -b--- 4.9 9630
testXM2 32 127 1 -b--- 4.7 9632
testXM3 34 128 1 -b--- 0.3 9634

Now you can connect to for example the testXM2 domU with Id 32 using:

  1. xm console 32

You can detach from a console using the escape character: <CTRL> ']'.

Console Access for Windows VMs

  • VNC access - tightvnc
  • /etc/xen/<vmname> contains the needed display number ( vncdisplay=X ) and VNC connection password
  • VNC Address: xen.cehd.tamu.edu:<vncdisplay>

General Info

This server is set up to host VMs from the SAN. Each VM's file system will be contained in a Logical Volume attached to the Volume Group "XenDomU". The NIC eth0 is set up for the 165.91.232.0/22 subnet, and eth1 is set up for the 192.168.128.0/24 local Gb subnet.

  • SSH to xen.cehd.tamu.edu for console access to hypervisor

Host Startup/Reboot

[root@xen ~]#/etc/init.d/iscsid start
[root@xen ~]#iscsiadm -m node -l
[root@xen ~]# lvdisplay
 --- Logical volume ---
  LV Name                /dev/XenDomU/D2K
  VG Name                XenDomU
  LV UUID                Nn1upT-euGq-j6b9-VZrT-FFHP-whPQ-R0tAdF
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                15.00 GB
  Current LE             3840
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Name                /dev/XenDomU/domU2
  VG Name                XenDomU
  LV UUID                NS8BgU-RFpz-9289-2fW4-K2Ze-O7iw-jCpuIp
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                15.00 GB
  Current LE             3840
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3
[root@xen ~]# vgchange -a y XenDomU
[root@xen ~]# ifconfig
peth1     Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
          inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:3682403 errors:0 dropped:0 overruns:0 frame:0
          TX packets:764553 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1685792139 (1.5 GiB)  TX bytes:314217850 (299.6 MiB)
          Interrupt:24 Memory:d6000000-d6012800
xenbr1    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:16917 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1419687 (1.3 MiB)  TX bytes:0 (0.0 b)
[root@xen ~]# /etc/xen/scripts/network-bridge start vifnum=1
[root@xen ~]# /etc/init.d/xend status
xend is running
[root@xen ~]# /etc/init.d/xend start
[root@xen ~]# xm create <VM Name>
  1. Check that iscsid is running.
    • If not, run the init script and login to an iscsi session with the MD3000i.
  2. Make sure that the logical volumes within the volume group XenDomU are available, by checking their status.
    • If not, make the Volume Group active.
  3. Check that xenbr1 is initialized. This is the NIC to the Local Gb switch.
    • If not, run the script to initialize that network bridge
  4. Check that xend is running
    • If not, run the init script.
  5. Now the virtual machines can be started.

Removing Unused Block Devices

When removing or rearranging the iSCSI LUNs on a linux box, the block devices remain when they are no longer associated with that host. This can cause the devices that remain to be reordered, and thus devices to map domUs may no longer exist. They will also be retained and scan for all partition/lvm commands, adding latency to those operations.

  • Remove unwanted block devices
[root@xen ~]# echo 1 > /sys/block/<device name>/device/delete
[root@xen ~]# reboot

LVM resizing

  • Linux
    [root@xen xen]# lvextend -L75G /dev/XenDomU/WWWCEHD
    
     [root@xen xen]# fdisk -l
    
      Disk /dev/xvda: 80.5 GB, 80530636800 bytes
     255 heads, 63 sectors/track, 9790 cylinders
      Units = cylinders of 16065 # 512 = 8225280 bytes
    
        Device Boot      Start         End      Blocks   Id  System
     /dev/xvda1   #           1          13      104391   83  Linux
     /dev/xvda2              14        9790    78533752+  8e  Linux LVM
    1. Shutdown the virtual machine
    2. Resize the LV containing the VM disk. (Note: The following command would resize the volume "/dev/XenDomU/WWWCEHD" to 75G, and must be issued from dom0).
    3. Start the VM and access the console
    4. Determine the current partition layout, and note the starting cylinder of the partition to resize.
    5. Delete the partition
    6. Add the partition using the same starting cylinder, extending the end cylinder to correspond to the desired size of the partition
    7. Resize the filesystem
      [root@xen xen] resize2fs /dev/mapper/<LV>
      
       [root@xen xen] resize2fs /dev/<partition>
      
      • If the filesystem resides on a LVM within the partition
      • If the filesystem resides on the partition itself
  • Windows
    [root@xen xen]# lvextend -L75G /dev/XenDomU/WWWCEHD
    
    1. Shutdown the virtual machine
    2. Resize the LV containing the VM disk. (Note: The following command would resize the volume "/dev/XenDomU/WWWCEHD" to 75G, and must be issued from dom0).
    3. Start the VM and access the console
    4. Under Server Manager, expand "Storage" and select "Disk Management (Local)"
    5. Right click on the specific volume, select "Extend Volume", and complete the steps in the extend volume wizard
Taxonomy: