Saturday, September 06, 2008

Xen Error (22, "Invaid argument"): Pt 2

I give up. The problem was that domains would install correctly, but fail to start.

At first, I thought the failures were when I would install from a kickstart file. During the install, a template kickstart is created as anaconda.cfg, which contains:
bootloader --location=mbr --driveorder=hda --append="rhgb quiet"
If a domain is manually installed, the line is:
bootloader --location=mbr --driveorder=vxda --append="console=xvc0"
My kickstart was actually misconfiguring the boot loader.

To review the bootloader options, I used:
xm create -c domain
This let me get into Grub. Unfortunately, that means Error 22 isn't an MBR problem. No efforts to fix via Grub provided any help.

Next, I found that I could bypass Grub. The trick was to add extra directives to the domain config file:
kernel = "/boot/vmlinuz-2.6.18-1.2798.fc6xen"
root = "/dev/xvda1 ro"
ramdisk = "/boot/initrd-2.6.18-1.2798.fc6xen.img"
#bootloader="/usr/bin/pygrub"
Notice that the bootloader directive is commented out. This failed marvelously, but got further than before. The errors were similar to a lost root partition.

This caused me to realize two things. First: root should not xvda1 but xvda2 or xvda3, as boot would be xvda1. Second: root was on an LVM not a xvda.

So, I reimaged the VM using an image file rather than LVMs. Worked. How strange.

Okay, a couple important issues here: This is Xen 3.0 (as explained in an earlier post), but I don't think that is the prime factor. I am trying to put the image on an logical volume, on a software raid. I know LVM images work fine under 3.1, and others having ti running on 3.0, but I've found no one else trying the three together. It seems the three just don't seem to play well with one another.

Tuesday, September 02, 2008

Mounting A Xen LVM Image

How to access a VM's logical volumes from Dom0. This assumes the VM is powered off and its image resides on an LVM (LVM's inside an LVM). It will not access /boot or the MBR.
Attach and confirm the image
# kpartx -a /dev/volume/domain
# kpartx -l /dev/volume/domain
Acquire and access the logical volumes
# vgscan
# lvdisplay | grep -i "Name\|Status"
# vgchange -ay
# lvdisplay | grep -i "Name\|Status"
Mount and view the volumes
# mount /dev/VolGroup00/LogVol00 /mnt
# cd /mnt
# ls -l
# cat /mnt/etc/hosts
# df
Umount, inactivate, and detach the volumes
# cd
# umount /mnt
# vgchange -an
# kpartx -d /dev/volume/domain
The single biggest "gottcha" is the need to ensure that Dom0 and the DomU's don't use the default volume group name.

Xen Error (22, "Invaid argument")

Occasionally, with enough regularity to be very annoying, a Xen guest that installs fails to start, throwing the error:
libvir: Xen Daemon error : POST operation failed: (xend.err "Error creating domain: (22, 'Invalid argument')")
error: Failed to start domain valhalla
I had little luck finding the nature of Error 22, until I hacked the code.

The error descriptions are listed in the phython control script, but are not passed to the user. All we get is Invalid argument. Gee, thanks.
# tail -70 /usr/lib/python2.4/site-packages/libvirt.py
--------- snip ---------
VIR_ERR_NO_SOURCE = 19
VIR_ERR_NO_TARGET = 20
VIR_ERR_NO_NAME = 21
VIR_ERR_NO_OS = 22
VIR_ERR_NO_DEVICE = 23
VIR_ERR_NO_XENSTORE = 24
VIR_ERR_DRIVER_FULL = 25
--- output truncated ---
Notice number 22: No OS. Okay, that I can deal with. It can't find the boot sector. All we need is a virtual rescue disk.

Stay tuned.

Disappearing Xen Config Files

An interesting "feature" of Xen 3.0 is that when you issue:
virsh undefine domain
it executes:
rm -rf /etc/xen/*domain*
This means you can't keep revisions of the config file in the directory.

BTW: Yes, I know 3.0 an old version, but I'm still running FC6 on my infrastructure hardware. Why? Because if it ain't broke... don't fix it. My Fedora 7 Virtualization server has 3.1, which seems to be current as of this writing. Again, no reason to go to Fedoras 9, if its running 3.1, also.

Disconnecting SSH Xen Console

I SSH's into a server then launched a Xen console, and found myself stuck. Here was the solution:
Fedora Core release 6 (Zod)
Kernel 2.6.18-1.2798.fc6xen on an i686
valhalla.terran.lan login: Ctrl-]
[root@baltar xen]#
The key sequence of Control and Right Bracket got me out of the Xen session, but kept me in the SSH session.

Tuesday, August 26, 2008

DFW Layover


I was actually just testing the Centro to make sure it would sent the Blogger. Something is wrong, however, as this image is hosted at Sprint. They'll delete it after 30 days.


Not acceptable. I'll try again.

Friday, August 22, 2008

Virtualization Round-up

Over the course of the last year, I've done allot of experimenting with virtual system platforms. I think I've decided the best direction for my efforts. These observations are driven by two factors: ease of set up and capacity for remote administration.

OpenVZ
I've done business with two Virtual Private Server (VPS) services, which were oddly named VPSland and VPSlink. I actually ditched VPSland because the provided CentOS, which was highly unstable. (Yes, yes, yes... I've heard all your arguments before: "CentOS is just RedHat". I've worked with RedHat for almost ten years: You're wrong.) What we really want to talk about is OpenVZ at VPSlink.

The OpenVZ platform does not offer VMs a swap file. This means that each VM needs access to large amounts of physical RAM. Given that disk is cheaper than RAM, this significantly limits VM density on the host. In my case, I could not even run RPM commands unless I had 256MB of RAM. Once I converted to Xen, everything ran on 64MB.

Vmware Server 2 Beta
Wow, was I disappointed in this product. All management is done via a web interface that is slow, clunky, and optimized for Windows desktop use. As a result, it posed several challenges. First, it required a 12meg browser plugin. Unfortunately, if I wasn't on the LAN, the plugin would time out.

The next problem was getting all the pieces needed for the install. Vmware provided an RPM, but no indication as to the dependencies for the RPM. Once the RPM was installed, it turns out there are additional, unchecked dependencies. The good news, however, was that all the hardware was recognized. Speaking of recognized hardware...

Vmware ESXi 3.5
Vmware recently announced they were dropping the license requirements for the ESXi server in the standalone mode. This created allot of excitement. I downloaded the ISO and quickly discovered that only "select SATA controllers" are supported. Not mine.

With no hardware to run it, ESXi was less than exciting.

Vmware VI3 ESX+VC
By far, the VI3 product set is the hands down winner... If you have $15,000 to spend. My budget is in the $150 range.

Xen
I'm sorry to say, Linux para-virtualization with full-virt support takes wins. Easy to deploy, remote console available via X11, command line and GUI support. Text based Linux installation is available within an unmodified SSH session. About my only downside is that the memory allocation is not as dynamic as I'd like.

Bottom Line
Is it any surprise the Linux guy didn't test Microsoft? No, not really. Is it a surprise the RHCE guy picked the platform included with Fedora? Maybe-- but in the end, it was stability and ease of access that won the day.

Thursday, August 14, 2008

X11 Forwarding to Vista: Pt 2

Wow. The performance on the Cygwin only X11 tunneling is horrible. I was able to improve performance significantly, however, by going back to PuTTY. In the PuTTY settings for the server, I went to Connection / SSH / X11 and checked Enable X11 Forwarding.

Now, launch Cygwin, PuTTY to target, launch graphical application. Performance still sucks, but it works. Hey, its not like this is the only application that has taken a hit under Vista!

Wednesday, August 13, 2008

Linux RAID0 (striped) Performance

As I continue with the process of reoganizing my virtualization servers, I ran a quick test on my drives in my other Xen box. Originally, I had /home on a RAID1, but wanted to see if I could truly get a boost out of a RAID0. Three tests: an LVM volume on a single disk, a RAID1 mirrored across two disks, the same two partitions in a striped RAID 0:
[root@baltar xen]# hdparm -Tt /dev/vg0/test /dev/md0
/dev/vog0/home:
  Timing cached reads: 416 MB in 2.01 seconds = 207.25 MB/sec
  Timing buffered disk reads: 28 MB in 3.09 seconds = 9.05 MB/sec
/dev/md0:
  Timing cached reads: 416 MB in 2.02 seconds = 206.40 MB/sec
  Timing buffered disk reads: 32 MB in 3.05 seconds = 10.50 MB/sec
Notice the buffered speeds are very close. This is because the LVM is on /dev/hda, as is the first element of the RAID1. (These are old disks on an old Celeron CPU.)

Now we rebuild the same two partitions into a RAID0. The disks are on separate controllers (/dev/hda and /dev/hdc) so we expect a boost in throughput:
[root@baltar xen]# hdparm -Tt /dev/md0
/dev/md0:
  Timing cached reads: 416 MB in 2.00 seconds = 207.91 MB/sec
  Timing buffered disk reads: 68 MB in 3.05 seconds = 22.30 MB/sec
Yeow! Look at those numbers: better than double.

I'm convinced.

Vmware: Reconcile Inventory with Disk

Interesting problem: As we know Linux / Unix don't like file names with spaces. The Vmware GSX, Server 2 Bate, and ESX have a Linux command line, but can support spaces in virtual machine names. This makes it difficult to reconcile VMs in the inventory against those on the storage.

Here's a one-line to handle it:
find -name *.vmx | 's/ /\\ /g' |
  xargs grep -i "display"

Output will show directory path, configuration filename, and inventory name for all VMs. If executed from /vmfs/volumes, it will span shared storage as well.