Monthly Archives: September 2013

OSSTest Standalone Mode Step by Step

Xen has long history and many features. Sometimes even experienced developers cannot be sure whether their new code is regression-free. To make sure new code doesn’t cause regression, Ian Jackson developed a test framework called OSSTest. In order to make this framework usable for individual ad-hoc testing, standalone mode was introduced. Recently I played with it and found it useful to share my experience with the community.

Basic Requirements

To run OSSTest in standalone mode, you need to have at least two machines: one is controller, which runs OSSTest itself and various other services, the other is test host, which is used to run test jobs.

For the controller you need to have several services setup:

  • DNS / DHCP, use to translate IP < -> hostname
  • Webserver, provide test box accessible web space, OSSTest will expose configurations / overlays via HTTP and detect test host status via webserver’s access log.
  • PXEboot / Tftp, used to provide Debian installers to test host.
  • NTP, optional

For the test host you need to:

  • enable PXE boot
  • connect to PDU if necessary

Step by step setup

git clone OSSTest tree, master branch, we assume you run everything inside osstest.git directory.

Have a look at README / TODO which contains useful information. You can create a global config file in ~/.xen-osstest/config. In standalone mode you can also create standalone.config in osstest.git directory to override global configurations.

In the configuration you can specify DNS name, name server etc.

DnsDomain uk.xensource.com
NetNameservers 10.80.248.2 10.80.16.28 10.80.16.67
HostProp_DhcpWatchMethod leases dhcp3 dhcp.uk.xensource.com:5556
TftpPath /usr/groups/netboot/

DebianNonfreeFirmware firmware-bnx2
DebianSuite squeeze
DebianMirrorHost debian.uk.xensource.com
DebianPreseed= < <‘END’
d-i clock-setup/ntp-server string ntp.uk.xensource.com
END

Debian is the de-facto OS in OSSTest, you can find more info in Osstest/Debian.pm. Here we use Squeeze to build binaries and run test jobs, because there’s a bug in Wheezy’s Xen-tools which breaks xen-image-create, which eventually breaks ts-guest-start. Patches to fix that problem have been posted but not yet merged. Hopefully some day in near future we can use Wheezy to run build jobs and test jobs.

Configure test host in OSSTest config file. There can be multiple test hosts in the config file, but I only have one. Here is what I have:

TestHost kodo4
HostProp_kodo4_DIFrontend newt
HostProp_kodo4_PowerMethod xenuse
HostProp_kodo4_Build_Make_Flags -j16
HostFlags_kodo4 need-firmware-deb-firmware-bnx2

There is detailed explanation of what those paramters mean in README. An interesting one is PowerMethod, which in fact points to a module in OSSTest that controls power cycle of the test box. Have a look at Osstest/PDU for all supported modules. Use manual.pm if your test host is not capable of doing power cycle automatically.

Before actually running OSSTest, you need to make some directories yourself.

  • logs: used to store tarballs from build-* jobs
  • public_html: expose this directory via HTTP server to the test host
  • $TFTPROOT/osstest: OSSTest will write PXE boot information for test hosts here

Make sure test host is able to access contents in public_html, then you can have “WebspaceUrl http://YOUR.CONTROLLER/public_html” in your OSSTest config. Test host will try to fetch all sort of things from there.

Next step will be setting “WebspaceLog /PATCH/TO/WEBSERVER/ACCESS.LOG”. OSSTest watches webserver access log. When test host / guest go to fetch things via HTTP OSSTest gets to know their status. I use Apache2 so I’ve set WebspaceLog to /var/log/apache2/access.log which just works.

Have Debian PXE installers ready. Remember the “DebianSuite” option in your config file? In order to make OSSTest fully functional you will also need to place Debian PXE installers in the right place. You can grab Debian’s PXE installers from any of the Debian archives around the world. And put them under the TFTP you just set up. I would recommend having at least amd64 and i386 in place. Make sure installers are accessible from the test host before proceeding.

By now we’re all set! Next step:

./standalone-reset

This will reset everything in standalone mode and create standalone.db, which includes test jobs and runtime variables. You can peek what’s inside that database with sqlite3.

The first job to run should be a build-* job. That can: 1) verify your setup is correct; 2) generate a bunch of runtime variables for subsequent test-* jobs.

./sg-run-job build-amd64 # WARNING: this will wipe out your test box

If the job pass, you’re all set. You can play around with other jobs. The default setting of jobs is to wipe out test box on every run. If you don’t want that you need to specify OSSTEST_HOST_REUSE=1 as stated in README.

An example of what I run:

./sg-run-job build-amd64-pvops
OSSTEST_HOST_REUSE=1 ./sg-run-job test-amd64-amd64-xl

If you only want to run a specific testcase, you can try OSSTEST_JOB=$JOBNAME ./ts-XXX host=$TESTHOSTNAME.

Customized tree / revisions

By default OSSTest always fetches trees and revisions from Xenbits. You can easily override them with standalone.config.

Say if I want to test a specific revision of Xen, I have:

export REVISION_XEN=c5e9596cd095e3b96a090002d9e6629a980904eb

in my standalone.confg.

You can look at make-flight to know all the interesting environment variables. (Sorry, no document yet)

Writing new testcases

If you’re interested in writing new testcase, you can do that in two simple steps:

  1. write ts-my-test-case script, you can use any existing testcase as template (they are prefixed with “ts-“)
  2. modify sg-run-job, which has the information for which testcases to run for a specific job

Do have a look as osstest/TestSupport.pm, in which you can find lots of helpers to accomplish your task.

Writing new test job

The script responsible for making jobs is cs-job-create. When you run OSSTest in standalone mode, it is probably more useful to modify make-flight. You also need to modify sg-run-job to link your new job with testcases.

Hope the above information can help you get started with OSSTest. If you have any problem, do come to Xen-devel and ask.

Some readers may recall the recent announcement of open-sourcing XenRT, and wondering about the relationship between OSSTest and XenRT. Long-term, we expect that XenRT will mature as an open development project and eventually displace OSSTest. But that is not likely to happen for another six months to a year. Developing OSSTest has benefits for the current development, and we hope that getting people involved in writing test cases for OSSTest will be of service in helping people write test cases for XenRT when it becomes available. So we have decided to continue to develop OSSTest until XenRT is ready to replace it.

Have fun! :-)

Xen Project Alive and Well at LinuxCon/CloudOpen North America

The Xen Project was well represented at LinuxCon North America and CloudOpen North America.  Sponsored by the Linux Foundation, the two co-located conferences featured a number of Xen-related talks, as well as the first Xen Project User Summit (which will be discussed at length in a post to follow).

Lars Kurth gave a well-received talk about the lessons we’ve learned from the Xen Project over the years.  It included a number of insights from the past decade, and a practical tool called “The Community Funnel Model” which can be used to analyze activity within an Open Source community.

I gave a talk about securing a cloud using Xen.  It identified many of the advanced security features included in the Xen hypervisor.  Thanks to George Dunlap for assembling most of the material, and Stefano Stabellini for the ARM information.

The slide decks for these talks can be found on XenProject.org.  As the recordings for the sessions become available, we intend to post them there as well.

Lars (who in addition to being the Xen Project Community Manager is also the unofficial community photographer) shared a number of pictures on the Xen Project Google+ page.  Albums include the Mardi Gras-style party and pictures from the Xen Project User Summit.  See if you can pick out your friends (especially difficult if they happen to be wearing the festive Mardi Gras gear).

However, some of the most important outcomes of the event could be found in the press coverage.  ServerWatch produced a piece called, “How Xen Virtualization Got Its Zen Back: LinuxCon“.  Lars was featured in a Cloudcast focusing on the latest news from the Xen Project.  And when eWeek put together its slideshow of LinuxCon luminaries, Lars made the deck as well!

And stay tuned for a summary of the Xen Project User Summit in the next few days.  Slide decks from many of the talks are already on the XenProject.org website.

QEMU vs. qemu-traditional update

Here is an update about feature completeness of QEMU compared to the old qemu-traditional.

But first, what is the difference between QEMU and qemu-traditional?

QEMU is the software that can be found at qemu.org, we can also call it QEMU upstream. It’s where all new features are supposed to land.

What we call “qemu-traditional” is the fork of QEMU that has been used by Xen. It became harder and harder to maintain and to upgrade with recent version QEMU, so we could not benefit from some of the new features that have been developed in QEMU, and also any bug that we would have found in the fork can be hard to fix upstream because the code would be very different.

So, we took everything that was needed from qemu-traditional to run QEMU with Xen and integrate them in a modern QEMU. Up to now, few features were missing to be able to use QEMU, but now, all the main features are in and QEMU became the default for most usage.

So what’s new in 4.3?

An important feature to be able to live-migrate a guest is a way to be able to track memory that has been modified during a live-migration. The feature first appears in Xen 4.2.2.

We also added the support to CPU hotplug for HVM as it was one of the missing features to get QEMU closer to qemu-traditional and have it as default.

Missing feature?

We are still missing a few things with QEMU upstream, so far, the limited support for VGA passthrough has not been upstream. Another missing feature would be the use of QEMU in a stub-domain instead of using qemu-traditional as it is right now. This last one is planned to be fixed in hopefully 4.4.

There is also patchs to fix the suspend resume cycle of an HVM guest that should be applied soon.

Beside those missing features, there are more works going one to enhance the support of many QEMU features that are not usable right now with the tool stack libXL, like using USB redirection or USB passthrough or even one day supporting QXL.

Peek Preview : Xen Project Developer Summit, October 24-25, Edinburgh

xendevsummit

The CfP for the Xen Project Developer Summit finished on Friday. I wanted to thank our Program Management Committee for putting in the effort to put together our program in record time. This was no easy task: we had nearly 50 extremely high quality submissions this year. Despite restricting talks to 30 minutes, we still had to reject many excellent submissions. We have 31 talks in the program, from 14 different organizations.

Program Highlights

This year’s Xen Project Developer Summit program is exceptional: it shows that the Xen Project is gathering momentum outside its traditional use-cases of server virtualization, client virtualization and cloud. We have talks and demos showing Xen running on mobile devices, showing Xen as virtualization platform for In-Vehicle Infotainment systems and as basis for network appliances. Just take a look at some of the talks scheduled:

  • HVM Dom0: Any unmodified OS as Dom0 Xiantao Zhang of Intel
  • “Unlimited” Event Channels by David Vrabel of Citrix Systems
  • Test-as-a-Service and XenRT by Alex Brett of Citrix Systems
  • XenGT: A software based Intel Graphics Virtualization Solution by Haitao Shan of Intel
  • Dual-Android on Nexus 10 by Lovene Bhatia of Samsung
  • Enabling Fast, Dynamic Network Processing with ClickOS by Joao Martins of NEC
  • Continue reading

Xen 4.1.6.1 released

I am pleased to announce the release of Xen 4.1.6.1. This is available immediately from its git repository xenbits.xen.org (tag RELEASE-4.1.6.1) or from the Xen Project download pages.

Note that 4.1.6 did not get released, as a build issue was found late in the release process, when the 4.1.6 version number was already irreversibly applied.

Xen 4.1.6.1 is a maintenance release in the 4.1 series and contains: We recommend that all users of Xen 4.1.5 upgrade to Xen 4.1.6.1.

This release fixes the following critical vulnerabilities:

  • CVE-2013-1918 / XSA-45: Several long latency operations are not preemptible
  • CVE-2013-1952 / XSA-49: VT-d interrupt remapping source validation flaw for bridges
  • CVE-2013-2076 / XSA-52: Information leak on XSAVE/XRSTOR capable AMD CPUs
  • CVE-2013-2077 / XSA-53: Hypervisor crash due to missing exception recovery on XRSTOR

Continue reading

Xen 4.2.3 released

I am pleased to announce the release of Xen 4.2.3. This is available immediately from its git repository xenbits.xen.org (tag RELEASE-4.2.3) or from the Xen Project download pages.

This release fixes the following critical vulnerabilities:

  • CVE-2013-1918 / XSA-45: Several long latency operations are not preemptible
  • CVE-2013-1952 / XSA-49: VT-d interrupt remapping source validation flaw for bridges
  • CVE-2013-2076 / XSA-52: Information leak on XSAVE/XRSTOR capable AMD CPUs
  • CVE-2013-2077 / XSA-53: Hypervisor crash due to missing exception recovery on XRSTOR
    Continue reading