Mailinglist Archive: opensuse-buildservice (216 mails)

< Previous Next >
[opensuse-buildservice] OBS: using KVM autosetup with OBS workers and osc build
  • From: Martin Mohring <martin.mohring@xxxxxxxxxxxx>
  • Date: Mon, 29 Mar 2010 00:15:50 +0200
  • Message-id: <4BAFD516.5090705@xxxxxxxxxxxx>
Hi,

Jan-Simon and me had been pushing some patches into Git tree to support
Autosetup of KVM in case you want to use Virtualization with OBS workers
or osc build.

To get it working, its now quite easy. It only requires:

1. An x86 machine with Hardware Virtualization. Boot the machine with
hardware virtualization enabled.
2. A openSUSE 11.2 with a 2.6.31 kernel or newer
3. Installation of the package "kvm" on the worker machine
4. Generation of an initrd file with virtio so KVM performs also well
wrt. to IO
5. Setting up of /etc/sysconfig/obs-worker appropriately


Step nr. 1 is hopefully quite clear. Step nr. hopefully also. Step nr. 3
is calling zypper or yast and install kvm.

Step nr. 4: become root, cd /boot. then type:
export rootfstype="ext4" mkinitrd -d /dev/null -m "ext4 binfmt_misc
virtio_pci virtio_blk" -k vmlinuz-2.6.31.12-0.1-default -i
initrd-2.6.31.12-0.1-default-obs_worker
If your kernel is vmlinuz-2.6.31.12-0.1-default. I could be that there
is also a newer kernel downloadable already. then replace it with that
kernel version number
Activating virtio is very strongly recommended, and using ext4 as the
filesystem also. ext4 tends to be ca. factor 2.5 or better wr. to
performance compared to ext3

Step nr. 5: setting up /etc/sysconfig/obs-worker
There are new environment variables for setting up the virtual machine
for KVM (XEN could also work, we have not tested it). They are in the
template file in the Git tree.
Some useful settings for them are:

# This enables KVM if available. values are "auto" | "xen" | "kvm" | "none"
OBS_VM_TYPE="auto"

# if your default kernel you boot is
/boot/vmlinuz-2.6.31.12-0.1-default, then type this into the variable
OBS_VM_KERNEL="/boot/vmlinuz-2.6.31.12-0.1-default"

# A fitting initrd, with KVM virtio enabled
OBS_VM_INITRD="/boot/initrd-2.6.31.12-0.1-default-obs_worker"

# This activates generation of root fs and swapspace for the virtual
machines, as always, under /tmp/root_<workerid>, if you have nothing
else configured
OBS_VM_DISK_AUTOSETUP="yes"

# This is the size of root fs in MB. Note: it is a sparse file, which
grows when accessed. It helps to have some buffer for free memory in the
rootfs, without actually allocating the space on disk.
OBS_VM_DISK_AUTOSETUP_ROOT_FILESIZE="4096"

# Dito, for the Swapspace. If you have very much memory on the machine,
and lots of memory left, then swapspace can be small. Size in MB.
OBS_VM_DISK_AUTOSETUP_SWAP_FILESIZE="1024"

# The filesystem type used as root filesystem. Make sure the kernel
module for this filesystem is in your initrd for KVM
OBS_VM_DISK_AUTOSETUP_FILESYSTEM="ext4"

# The size of memory the KVM gets, also in MB
OBS_INSTANCE_MEMORY="1024"

Once you have installed the code in the OBS backend and in the workers,
have fun with this. Code is in the current Git master.

There are also .oscrc variables to setup the same for "osc build", so
you can use KVM then also for local build. ARM support should still be
working fine, thats why your initrd has to contain "binfmt" loadable
module. I will post another mail for the osc variant of this next.

Have Fun

Martin

--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >