I have started to migrate one CentOS5 machine from xen to kvm. The stability of the machine is much better (too much crashes with xen). I was used to do a "xm list" to get a list of clients. On the KVM machine I need to do a "virsh list". What I miss in that overview is the memory size of clients. I found "virsh dominfo <client>" but that is for just that one client (and I have several running). The same question for "xm top". I found that there seems to exist virt-top, but I could not find this in a repository for Centos5.
virt-manager is a little overkill on this machine (it does work though but I like command line quick info).
Theo
What I miss in that overview is the memory size of clients. I found "virsh dominfo <client>" but that is for just that one client (and I have several running). The same question for "xm top". I found that there seems to exist virt-top, but I could not find this in a repository for Centos5.
For the memory thing off the top of my head I can't think of anything in a single command... but a quick virsh list | awk '$2 ~ /running/ {print $1}' | while read guest; do virsh dominfo $guest | grep memorything .... adapted slightly since that's untested and just quickly knocked out from rough memory shoudl help...
With regards to virt-top that's on CentOS 6 .... for the underlying hosts you really want to be on C6 rather than C5 at this point due to much improved libvirt/kvm features - things like ksm and transparent huge pages are new and help... and then things like the newer scheduler and kernel is a bonus...
Leave your guests on C5 or whatever they are on while you migrate sensibly... but there is no good reason for the hosts systems to be runnin C5 at this point... if you are only just starting to migrate form xen to kvm seriously get on C6 and do yourself a huge favour...
James
On 12/09/2011 01:18 PM, James Hogarth wrote:
What I miss in that overview is the memory size of clients. I found "virsh dominfo <client>" but that is for just that one client (and I have several running). The same question for "xm top". I found that there seems to exist virt-top, but I could not find this in a repository for Centos5.
For the memory thing off the top of my head I can't think of anything in a single command... but a quick virsh list | awk '$2 ~ /running/ {print $1}' | while read guest; do virsh dominfo $guest | grep memorything .... adapted slightly since that's untested and just quickly knocked out from rough memory shoudl help...
With regards to virt-top that's on CentOS 6 .... for the underlying hosts you really want to be on C6 rather than C5 at this point due to much improved libvirt/kvm features - things like ksm and transparent huge pages are new and help... and then things like the newer scheduler and kernel is a bonus...
Leave your guests on C5 or whatever they are on while you migrate sensibly... but there is no good reason for the hosts systems to be runnin C5 at this point... if you are only just starting to migrate form xen to kvm seriously get on C6 and do yourself a huge favour...
Funny I was thinking about a similar script line. Then I thought, this is silly I must have overlooked the obvious. Let's ask the list :-) The machine is dual bootable (Xen/Kvm). It serves as a backup for two other machines running Xen (centos5). That's basically the only reason I'm still on C5. I use drbd to mirror disks. The best approach for me is to take a new machine with C6 and migrate on there.
Theo
Funny I was thinking about a similar script line. Then I thought, this is silly I must have overlooked the obvious. Let's ask the list :-) The machine is dual bootable (Xen/Kvm). It serves as a backup for two other machines running Xen (centos5). That's basically the only reason I'm still on C5. I use drbd to mirror disks. The best approach for me is to take a new machine with C6 and migrate on there.
Funny thing I went through a similar thing a ways back - but for me was vmware esx 3.5 to centos 5.5 (or maybe 5.4 ... whichever was fully supported and not a tech preview) kvm servers in our development environment here.... and now those systems being migrated to new c6 hosts as part of a hardware refresh cycle....
The libvirt/virsh stuff is fairly interesting - a lot is scriptable... but for 'home grown' CLI stuff rather than using something like Archipel or oVirt to manage it you really need to make good use of awk, sed, etc etc to manipulate data as you want.
On Friday, December 09, 2011 07:39:54 AM James Hogarth wrote:
Funny thing I went through a similar thing a ways back - but for me was vmware esx 3.5 to centos 5.5
James, I'd be interested in knowing some of how you handled the ESX to KVM migration, and some caveats you might have found along the way.
James, I'd be interested in knowing some of how you handled the ESX to KVM migration, and some caveats you might have found along the way.
This is from our internal wiki from notes I wrote at the time - will be pretty busy here between now and christmas but happy to answer any specific issues... this should be fine for an initial start at conversion points.... Note that was last edited 11/8/2010 so v2v tools might be quicker from the non-existence they had back then ;)
James
Copy the disk image from vmware to kvm host
Stop the guest in VMware so that no data is being written to the disk image and the file is not locked by any processes. Rsync on the virtualserver from the ESX serevr to the local drive rsync -h --progress root@ostesx0[1-7]:'/vmfs/volumes/ost*/<guestname>/*-flat.vmdk' /var/lib/libvirt/images/ On the KVM host after the disk is copied over convert it to a RAW image. <something>.img should match the name of the disk that was defined in the XML previously. cd /var/lib/libvirt/images qemu-img convert <something>-flat.vmdk -O raw <something>.img Changes required in the guest
Boot with Centos Live CD - the template defined previously includes the Centos LiveCD and booting from the CD so just start the VM guest. Mount the disk in the live session As the root user: mkdir -p /media/guestdisk mount /dev/vda1 /media/guestdisk Chroot into the mounted disk mount -o bind /dev /media/guestdisk/dev mount -o bind /sys /media/guestdisk/sys mount -o bind /proc /media/guestdisk/proc chroot /media/guestdisk /bin/bash Rebuild initrd with the virtio modules mkinitrd -f --with=virtio_blk --with=virtio_pci /boot/initrd-<mostrecentkernel>.img <mostrecentkernel> You can get the most recent kernel version by:
ls -ltr /boot/vmlinuz* | tail -n 1 The output will look like:
-rw-r--r-- 1 root root 1954652 May 13 18:38 /boot/vmlinuz-2.6.18-194.3.1.el5 Where in the case given the kernel version would then be 2.6.18-194.3.1.el5
Remove VMwareTools rpm -e VMwareTools Check it is removed by:
rpm -qa | grep -i vmware Then remove the vmware auto configure trickery in /etc/rc.local
vi /etc/rc.local
remove this block of text:
rkernel=2.6.18-164.el5 if [ -e /etc/vmware-tools/not_configured ]; then echo vmware-tools not configured for running kernel echo running vmware-config-tools.pl /usr/bin/vmware-config-tools.pl -d echo vmware-tools now compiled for running kernel echo restarting system reboot fi Check for any /etc/fstab changes needed Change /boot/grub/devices.map vi /boot/grub/devices.map
change /dev/sda to /dev/vda Exit the chroot (exit or ctrl+D) Ensure grub installed correctly on disk image /media/guestdisk/sbin/grub-install --root-directory=/media/guestdisk /dev/vda Unmount the disk and poweroff umount /media/guestdisk/proc umount /media/guestdisk/dev umount /media/guestdisk/sys poweroff
Vreme: 12/09/2011 01:29 PM, Theo Band piše:
On 12/09/2011 01:18 PM, James Hogarth wrote:
What I miss in that overview is the memory size of clients. I found "virsh dominfo<client>" but that is for just that one client (and I have several running). The same question for "xm top". I found that there seems to exist virt-top, but I could not find this in a repository for Centos5.
For the memory thing off the top of my head I can't think of anything in a single command... but a quick virsh list | awk '$2 ~ /running/ {print $1}' | while read guest; do virsh dominfo $guest | grep memorything .... adapted slightly since that's untested and just quickly knocked out from rough memory shoudl help...
With regards to virt-top that's on CentOS 6 .... for the underlying hosts you really want to be on C6 rather than C5 at this point due to much improved libvirt/kvm features - things like ksm and transparent huge pages are new and help... and then things like the newer scheduler and kernel is a bonus...
Leave your guests on C5 or whatever they are on while you migrate sensibly... but there is no good reason for the hosts systems to be runnin C5 at this point... if you are only just starting to migrate form xen to kvm seriously get on C6 and do yourself a huge favour...
Funny I was thinking about a similar script line. Then I thought, this is silly I must have overlooked the obvious. Let's ask the list :-) The machine is dual bootable (Xen/Kvm). It serves as a backup for two other machines running Xen (centos5). That's basically the only reason I'm still on C5. I use drbd to mirror disks. The best approach for me is to take a new machine with C6 and migrate on there.
Theo
You can also connect to KVM server from other system, like Desktop via Virt-Manager.
But Going on CentOS 6.x would be best. 6.1 ISO should be available in next 24-48h.
On 12/09/2011 01:18 PM, James Hogarth wrote:
What I miss in that overview is the memory size of clients. I found "virsh dominfo<client>" but that is for just that one client (and I have several running). The same question for "xm top". I found that there seems to exist virt-top, but I could not find this in a repository for Centos5.
For the memory thing off the top of my head I can't think of anything in a single command... but a quick virsh list | awk '$2 ~ /running/ {print $1}' | while read guest; do virsh dominfo $guest | grep memorything .... adapted slightly since that's untested and just quickly knocked out from rough memory shoudl help...
With regards to virt-top that's on CentOS 6 .... for the underlying hosts you really want to be on C6 rather than C5 at this point due to much improved libvirt/kvm features - things like ksm and transparent huge pages are new and help... and then things like the newer scheduler and kernel is a bonus...
Are there any real-world numbers of ksm in action out there? Just like with disk de-duplication I'm really wondering how much this actually buys you.
Regards, Dennis