Monday, December 28, 2009

Dell RHEL Cluster Wiki

Dell has a wiki page which documents setting up a Red Hat GFS Cluster which covers using the Dell M1000e blade enclosure. Thank you Dell.

Wednesday, December 23, 2009

xen2kvm: Change a xen VM to run on KVM

If you want to move a guest running on a Xen host to a KVM host you can do the following:

1. Create a place-holder guest on the KVM host, note its mac address and shut it down.

2. Make the following changes to the Xen guest while its still running on the xen host:

  • Replace the xen kernel with a normal kernel: "yum install kernel"
  • Verify /etc/grub.conf will boot the new non-xen kernel by default
  • Comment out the following line in /etc/inittab:
    co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav
    
  • Uncomment the following lines in /etc/inittab:
     1:2345:respawn:/sbin/mingetty tty1
     2:2345:respawn:/sbin/mingetty tty2
     3:2345:respawn:/sbin/mingetty tty3
     4:2345:respawn:/sbin/mingetty tty4
     5:2345:respawn:/sbin/mingetty tty5
     6:2345:respawn:/sbin/mingetty tty6
    
  • Modify /etc/sysconfig/network-scripts/ifcfg-eth0 to insert the MAC address from the place holder guest.
  • Shut the Xen guest down

3. Move the disk file from the Xen host to the KVM host:

  scp $USER@xen-host:/var/lib/xen/images/guest.img \
      $USER@kvm-host:/var/lib/libvirt/images/guest.img
In the above step you should be overwriting the disk file for the place-holder guest with the Xen guest's disk file.

4. Boot the guest on KVM.

I have tested the above on RHEL 5.4 and Fedora 12.

Thank you Chris Tyler for suggesting this approach in your blog.

Fedora 13 is scheduled to have a Xen to KVM migration script, so we'll see if the above is still necessary in May 2011.

Tuesday, December 22, 2009

xenner

I have been using KVM successfully on Fedora 12 and RHEL 5.4. I have Xen guests which I would like to run on KVM (even if just in testing) so I considered using xenner, but I was not successful. My notes are below if anyone wants to point out what I might be missing.

On an existing system running KVM:

* yum install xenner
(1/3): xen-hypervisor-3.4.1-5.fc12.x86_64.rpm            | 2.8 MB     00:00     
(2/3): xen-runtime-3.4.1-5.fc12.x86_64.rpm               | 4.0 MB     00:00     
(3/3): xenner-0.47-3.fc12.x86_64.rpm                     | 191 kB     00:00     
* /etc/init.d/xenner start
I read an example in RedHat's bugzilla from the Xenner author:
Comment #7 From  Gerd Hoffmann  2008-07-03 03:45:15 EDT: 
"For a quick bootup test you don't need an image, you can grab xen
kernel and initrd from any fedora install dvd (images/xen/), then run
"xenner -kernel vmlinuz -initrd initrd.img -vnc 127.0.0.1:0".
Connecting with a vnc viewer to display :0 should show then the first
stage install screen (probably complaining it couldn't find a disk)."
I couldn't exactly find the files he was talking on a Fedora 12 DVD about so I used a Xen kernel and initrd from an installed RHEL5 system's /boot. I then did the following:
 sudo xenner \
 -kernel vmlinuz-2.6.18-164.6.1.el5xen \
 -initrd initrd-2.6.18-164.6.1.el5xen.img \
 -vnc 127.0.0.1:0 \
 -hda guest.img 
xenner-stats on another terminal as I ran the above reported that it couldn't parse the core file in /var/run/xenner. The results of running the xenner command above follow:
kvm capability clocksource: not enabled
kvm capability nop-iodelay: not enabled
kvm capability mmu-op: not enabled
domid: 14258
-videoram option does not work with cirrus vga device model. Videoram set to 4M.
frontend `/local/domain/14258/device/vbd/51712' devtype `vbd' expected backend `/local/domain/0/backend/tap/14258/51712' got `/local/domain/0/backend/blkbackd/14258/51712', ignoring
frontend `/local/domain/14258/device/vbd/51712' devtype `vbd' expected backend `/local/domain/0/backend/tap/14258/51712' got `/local/domain/0/backend/blkbackd/14258/51712', ignoring
Watching /local/domain/0/device-model/14258/logdirty/next-active
Watching /local/domain/0/device-model/14258/command
/builddir/build/BUILD/xen-3.4.1/tools/ioemu-dir/hw/xen_blktap.c:628: Init blktap pipes
Could not open /var/run/tap/qemu-read-14258
xs_read(): vncpasswd get error. /vm/b254f64e-b232-477c-9285-c693c34fd432/vncpasswd.
==================== setup ====================
xen_guest_parse: ----- parse kernel -----
[xenner,1] domain_builder: memory: emu 4 MB, m2p 4 MB, guest 120 MB
xen_emu_load: ----- load xen emu -----
[xenner,1] xen_load_emu_file: loading /usr/lib64/xenner/emu64.elf (190936 bytes)
xen_emu_setup: ----- memory info -----
xen_emu_setup: ----- emu pgd setup -----
xen_guest_setup: ----- memory setup -----
xen_guest_setup: ----- create start-of-day -----
xen_guest_setup: ----- setup xen hypercall page -----
xen_guest_setup: ----- setup vcpu context -----
domain_builder: ----- kvm: state setup -----
domain_builder: ----- all done -----
xen be: console-0: reading backend state failed
xen be: console-0: reading backend state failed
xen be: console-0: reading frontend path failed
calibrate tsc ... done, 3193 MHz, shift: -1, mul_frac: 2690089865
==================== boot ====================
[xenner,1] setup_regs: 64bit
[xenner,1] vcpu_thread/0: start
[emu] <0>this is emu64 (xenner 0.47), boot cpu #0
[emu] <1>emu64: configuration done
[emu] <1>cpu_alloc: cpu 0
[emu] <1>cpu_init: cpu 0
[emu] <1>pv_init: cpu 0, signature "KVMKVMKVM", features 0x00000000:
[emu] <1>emu64: boot cpu setup done
[emu] <1>emu64: paging setup done
[emu] <0>print_page_fault_info: [kernel-mode] preset read kernel reserved-bit, rip ffff8300000098a3, cr2 ffff820000000020, vcpu 0
[emu] <0>page table walk for va ffff820000000020, root_mfn 1905
[emu] <0>pgd   : ffff830001905000 +260  |  mfn   48  |   global dirty accessed user write present
[emu] <0> pud  : ffff830000048000 +  0  |  mfn   49  |   global dirty accessed user write present
[emu] <0>  pmd : ffff830000049000 +  0  |  mfn   4a  |   global dirty accessed user write present
[emu] <0>   pte: ffff83000004a000 +  0  |  mfn fee00  |   global dirty accessed write present
[emu] <0>panic: ring0 (emu) page fault
[emu] <0>printing registers
[emu] <0>  code   cs:rip e008:ffff8300000098a3
[emu] <0>  stack  ss:rsp e010:ffff83000002bea0
[emu] <0>  rax ffff820000000000 rbx ffff830000033000 rcx ffff830000000000 rdx 00000000fee00163
[emu] <0>  rsi 0000000000000000 rdi 0000000000001000 rsp ffff83000002bea0 rbp ffff830000033000
[emu] <0>  r8  ffff83000004a000 r9  ffff83000000e92a r10 ffff83000000e494 r11 000000000000000a
[emu] <0>  r12 000000000002a000 r13 00000000fee00900 r14 00000000fee00000 r15 0000000000000000
[emu] <0>  cs e008 ds e010 es e010 fs e010 gs e010 ss e010
[emu] <0>  cr0 80050033 cr2 ffff820000000020 cr3 01905000 cr4 000006b0 rflags 00010086
[emu] <0>  cr0: PE MP ET NE WP AM PG
[emu] <0>  cr4: PSE PAE PGE OSFXSR OSXMMEXCPT
[emu] <0>  rflags: ??? PF ??? RF
[emu] <0>printing stack ffff83000002bea0 - ffff83000002bff8
[emu] <0>  ffff83000002bea0: 0000000000000400
[emu] <0>  ffff83000002bea8: 0000000000000800
[emu] <0>  ffff83000002beb0: ffff800000000000
[emu] <0>  ffff83000002beb8: 00000000000001e7
[emu] <0>  ffff83000002bec0: 564b4d564b4d564b
[emu] <0>  ffff83000002bec8: ffff800000000000
[emu] <0>  ffff83000002bed0: 00000f6400000001
[emu] <0>  ffff83000002bed8: 0000e43500010800
[emu] <0>  ffff83000002bee0: ffff8300bfe9c3f1
[emu] <0>  ffff83000002bee8: ffff830000005b70
[emu] <0>  ffff83000002bef0: ffff83000002bf50
[emu] <0>  ffff83000002bef8: ffff830000033000
[emu] <0>  ffff83000002bf00: 000000000002a000
[emu] <0>  ffff83000002bf08: ffff830000028000
[emu] <0>  ffff83000002bf10: 0000000000000000
[emu] <0>  ffff83000002bf18: ffff8300000051cb
[emu] <0>  ffff83000002bf20: 0000000000000000
[emu] <0>  ffff83000002bf28: 0000000000000000
[emu] <0>  ffff83000002bf30: 0000000000000000
[emu] <0>  ffff83000002bf38: 0000000000000000
[emu] <0>  ffff83000002bf40: 0000000000000000
[emu] <0>  ffff83000002bf48: ffff83000000001d
[emu] <0>  ffff83000002bf50: 0000000000000000
[emu] <0>  ffff83000002bf58: 0000000000000000
[emu] <0>  ffff83000002bf60: 0000000000000000
[emu] <0>  ffff83000002bf68: 0000000000000000
[emu] <0>  ffff83000002bf70: 0000000000000000
[emu] <0>  ffff83000002bf78: 0000000000000000
[emu] <0>  ffff83000002bf80: 0000000000000000
[emu] <0>  ffff83000002bf88: 0000000000000000
[emu] <0>  ffff83000002bf90: 0000000000000000
[emu] <0>  ffff83000002bf98: 0000000000000000
[emu] <0>  ffff83000002bfa0: 0000000000000000
[emu] <0>  ffff83000002bfa8: 0000000000000000
[emu] <0>  ffff83000002bfb0: 0000000000000000
[emu] <0>  ffff83000002bfb8: 0000000000000000
[emu] <0>  ffff83000002bfc0: 0000000000000000
[emu] <0>  ffff83000002bfc8: 0000000000000000
[emu] <0>  ffff83000002bfd0: 0000000000000000
[emu] <0>  ffff83000002bfd8: 0000000000000000
[emu] <0>  ffff83000002bfe0: 0000000000000000
[emu] <0>  ffff83000002bfe8: 0000000000000000
[emu] <0>  ffff83000002bff0: 0000000000000000
[emu] <0>  ffff83000002bff8: 0000000000000000
guest requests shutdown, exiting.
xenner_cleanup: ----- statistics -----
hypercalls             :      total     diff
emu faults             :      total     diff
  page fault           :          1        0
  cr3 load             :          2        0
event channels         :      total     diff
xenner_cleanup: ----- cleaning up -----

Friday, December 11, 2009

KVM Ubuntu 2

After installing the basic KVM package as described earlier, I installed:
 apt-get install virt-manager
I was then able to do an install like this to install a Fedora VM:
sudo virt-install \
--accelerate \
--hvm \
--connect qemu:///system \
--network network:default \
--name fedora12 \
--ram 512 \
--file=/var/lib/libvirt/images/fedora12.img \
--vcpus=1 \
--nonsparse \
--check-cpu \
--vnc \
--file-size=6 \
--cdrom=/mnt/isos/datastore1/fedora12_x86_64/Fedora-12-x86_64-DVD.iso

Wednesday, December 9, 2009

Thunderbird 3

I just started using PPA for Ubuntu Mozilla Daily Build Team to upgrade to Thunderbird 3.0 while running Ubuntu 9.10. It's indexing a lot and eating 100% of a CPU. I'll let it crunch away and report if it's actually faster tomorrow.

Update: Thunderbird 3 is working well. Nice and snappy.

Friday, December 4, 2009

KVM virtual network forward options

If you are using KVM and virsh to net-create a virtual network and want to know what forward options there are, the answer is: "none", "nat", "route".

Details:

If you're editing a virtual network xml definition file that might be contained in /etc/libvirt/qemu/networks on RHEL 5.4:

# cat dev.xml 
<network>
  <name>dev</name>
  <uuid>fa07c9c6-e755-71f0-4312-4db325355c24</uuid>
  <forward mode='nat'/>
  <bridge name='virbr1' stp='on' forwardDelay='0' />
  <ip address='123.456.7.89' netmask='255.255.255.0'>
  </ip>
</network>
# 
and want to know what forward modes there are besides the default nat as shown above, it doesn't seem to be found in the documentation. I was able to get it by looking at the source.

 yum provides "*/virsh"
the above returned libvirt. Which do I have?
# rpm -qa | grep libvirt
libvirt-0.6.3-20.1.el5_4
libvirt-python-0.6.3-20.1.el5_4
libvirt-0.6.3-20.1.el5_4
# 
Note the first result. Downloaded the src.rpm from RHN:
* rpm -iv libvirt-0.6.3-20.1.el5_4.src.rpm
* cd /usr/src/redhat/SOURCES/
* tar xzf libvirt-0.6.3.tar.gz
* cd libvirt-0.6.3/src
* grep -i forward *
Eventually I found the following on line 51 of network_conf.c:
VIR_ENUM_IMPL(virNetworkForward,
              VIR_NETWORK_FORWARD_LAST,
              "none", "nat", "route" )
So, I'm pretty sure the answer is: "none", "nat", "route"

Benford's law

A non-*nix post. I just learned about Benford's law. This reminds me of learning that Fibonacci Numbers occur in Nature. A friend told me that Benford was tipped off about this law when he was looking through the old log books and saw that the pages near the beginning (that start with one) were more worn. Would this law have not been discovered if he already had a computer?

Tuesday, December 1, 2009

Snow Leopard Upgrade in the Dark

While upgrading my wife's 13" MacBook Pro to Snow Leopard what happened to the first poster in this forum happened to me. I couldn't believe it, but I was able to see and keep clicking "next" while I held a flash light to the screen. I was able to finish the install and it is working again. Strange.