<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>olivetalks &#187; xen</title>
	<atom:link href="http://www.olivetalks.com/tag/xen/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.olivetalks.com</link>
	<description>The Olive has arrived and it has things to say…</description>
	<lastBuildDate>Tue, 20 Jul 2010 06:27:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Xen and CentOS 5.1 on PowerEdge 2950</title>
		<link>http://www.olivetalks.com/2008/04/14/xen-centos-pe2950/</link>
		<comments>http://www.olivetalks.com/2008/04/14/xen-centos-pe2950/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 06:41:06 +0000</pubDate>
		<dc:creator>ZoltarStark</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[cruisecontrol]]></category>
		<category><![CDATA[p2v]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.olivetalks.com/2008/04/14/xen-centos-pe2950/</guid>
		<description><![CDATA[I've installed CentOS 5.1 on PowerEdge 2950. The installation includes Xen 3.0.3. The new server is running multiple Xen guests.]]></description>
			<content:encoded><![CDATA[<p>A few months ago I got my hands on a new server at work. It&#8217;s a Dell PowerEdge 2950. I was going to post a link but it seems Dell is having some problems with their website and half of the links I find in Google do not work.</p>
<p>The server has a Quad Core Xeon CPU E5440 and 4 GB of RAM. The storage needs are covered by a MD1000 disk array connected to a Perc5/E controller. The controller supports different RAID configurations: 0, 1, 10 and 50. I&#8217;ve tried most of them plus different combinations of software raid and hardware plus software raid. In the end I&#8217;ve settled on RAID-5 on 3 disks.</p>
<p>As the operating system I&#8217;ve installed <a href="http://www.centos.org/">CentOS 5.1</a> which is basically a free copy of RHEL 5.1. It comes with Xen 3.0.3 and of course I&#8217;ve installed that too. I want to convert the existing servers we have at work to Xen guests and have them running on this new machine. This will let me update OS on all the servers to the same version without bringing the whole office to halt. And once the servers are virtualized it will be much easier to deal with maintenance of the physical servers. Maybe I will even set up some cluster to host all these Xen guests. I didn&#8217;t have time to fully explore this idea but it sounds like it could offer further advantages.</p>
<p>So far I was able to convert one physical server to a virtual one with rather short downtime. I followed the instructions described in my <a href="/2008/02/16/xen-p2v-conversion-in-seven-simple-steps/" title="Xen p2v conversion">Xen p2v</a> post. The virtual server has been running fine for several months already. In terms of performance there are no problems &#8211; it helps that the Xen host has more powerful hardware and this server doesn&#8217;t need much I/O.</p>
<p>Besides this P2V conversion I&#8217;ve also created a Xen guest with Fedora Core 8 to run our CruiseControl server. The previous installation was running on a Fedora Core 5 host. I&#8217;ve used the occasion and upgraded CruiseControl to the latest version. Installing CruiseControl took me a long time. Mostly because I couldn&#8217;t find proper instructions. I&#8217;ve tried few different ones from the <a href="http://cruisecontrol.sourceforge.net/gettingstartedsourcedist.html">CruiseControl</a> website, from <a href="http://www.ibm.com/developerworks/java/library/j-cc/">IBM</a> and some others. Unfortunately I just couldn&#8217;t get it to work. So in the end I&#8217;ve just duplicated the setup we had before. It&#8217;s not perfect but it works and I don&#8217;t want to spend a week on that.</p>
<p>Third Xen guest I&#8217;ve created is a very small installation of CentOS 5.1 running with only 64 MB of RAM. It serves as a license server for some applications we use. I&#8217;ve minimized the amount of the services running to reduce the memory footprint and the virtual machine uses only 41 MB of RAM.</p>
<p>So far all three guests are running nicely together. I&#8217;ll be adding more of them in the future.</p>
<h3>Related post(s)</h3><ul class="related_post"><li><a href="http://www.olivetalks.com/2008/02/16/xen-p2v-conversion-in-seven-simple-steps/" title="Xen p2v conversion in seven simple steps">Xen p2v conversion in seven simple steps (0)</a></li><li><a href="http://www.olivetalks.com/2008/01/24/usb-forwarding-on-xen/" title="USB forwarding on Xen">USB forwarding on Xen (0)</a></li><li><a href="http://www.olivetalks.com/2009/02/21/ups-on-centos-with-selinux-part-2/" title="Setting up UPS on CentOS 5.2 with SELinux, part 2">Setting up UPS on CentOS 5.2 with SELinux, part 2 (1)</a></li><li><a href="http://www.olivetalks.com/2009/02/19/ups-on-centos-with-selinux-part-1/" title="Setting up UPS on CentOS 5.2 with SELinux, part 1">Setting up UPS on CentOS 5.2 with SELinux, part 1 (0)</a></li><li><a href="http://www.olivetalks.com/2009/02/15/find-changes-with-rpm-verify/" title="What files did I change?">What files did I change? (2)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.olivetalks.com/2008/04/14/xen-centos-pe2950/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>USB in Xen &#8211; how to make it work</title>
		<link>http://www.olivetalks.com/2008/03/22/usb-in-xen-how-to-make-it-work/</link>
		<comments>http://www.olivetalks.com/2008/03/22/usb-in-xen-how-to-make-it-work/#comments</comments>
		<pubDate>Sat, 22 Mar 2008 10:12:42 +0000</pubDate>
		<dc:creator>ZoltarStark</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[USB over IP]]></category>
		<category><![CDATA[USB Server]]></category>
		<category><![CDATA[USB/IP]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.olivetalks.com/2008/03/22/usb-in-xen-how-to-make-it-work/</guid>
		<description><![CDATA[ZoltarStark is still looking for a method to access USB devices from Xen guests. After not finding great success with USB passthrough and PCI passthrough the time has come to try USB over IP solutions.]]></description>
			<content:encoded><![CDATA[<p>In my previous posts I described two approaches for setting up access to USB devices in Xen guest: <a href="/2008/01/24/usb-forwarding-on-xen/" title="Forwarding the whole USB controller">PCI forwarding</a>  and <a href="/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/" title="Forwarding a single USB device">USB forwarding</a>. The results were less than fantastic, I must admit. I&#8217;ve been checking different pages on the Internet looking for more advice. Unfortunately it looks like the conclusion is that at this point Xen does not support this feature. Hopefully this will get better in the future.</p>
<p>What can you do now? One suggested approach is to use some kind of USB over IP solution. That does involve spending some money though. USB over IP devices are about €300, a well known example are products from Digi International. Unfortunately I didn&#8217;t find any device of this type which would work with Linux clients so this looks like a bad direction to go even if it was cheaper. Another solution mentioned is using a software version of USB over IP. Again, they mostly support Windows clients. I was able to find only one that includes a Linux client &#8211; <a href="http://www.usb-server.com/downloads.html#usbserver" rel="external nofollow">USB Server</a>. At this point it&#8217;s in beta so it could be unstable &#8211; better test it before you use it on a production system. It includes a kernel driver (released under GPL 2) and binary only programs for the client and the server. It&#8217;s not a perfect solution since you still don&#8217;t know what&#8217;s inside of these binaries.</p>
<p>There are also people working on a similar solution in <a href="http://usbip.sourceforge.net/">USB/IP Project</a>. According to them &#8220;It is still at a *very* early development stage.&#8221; and is not stable.</p>
<p>I&#8217;ll try out these options and report here my findings. In the meantime if someone has experiences with any of these two solutions please comment and let us know.</p>
<hr align="left" width="20%" /> <a href="/category/computers/feed" title="rss feed to post"><img src="/wp-content/uploads/2008/01/feed-icon-14x14.png" alt="rss feed to post" /></a> Subscribe to the Computers posts of olivetalks, if you found this article interesting, thank you!</p>
<h3>Related post(s)</h3><ul class="related_post"><li><a href="http://www.olivetalks.com/2008/03/10/howto-xenify-office-servers/" title="How to Xenify office servers">How to Xenify office servers (0)</a></li><li><a href="http://www.olivetalks.com/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/" title="USB forwarding on Xen &#8211; it just does not work">USB forwarding on Xen &#8211; it just does not work (3)</a></li><li><a href="http://www.olivetalks.com/2008/01/24/usb-forwarding-on-xen/" title="USB forwarding on Xen">USB forwarding on Xen (0)</a></li><li><a href="http://www.olivetalks.com/2009/06/24/skype-40-for-windows-is-out-pros-and-cons-compared-with-linux-skype-20/" title="Skype 4.0 for Windows is out: Pros and cons (compared with Linux Skype 2.0) ">Skype 4.0 for Windows is out: Pros and cons (compared with Linux Skype 2.0)  (1)</a></li><li><a href="http://www.olivetalks.com/2009/02/21/ups-on-centos-with-selinux-part-2/" title="Setting up UPS on CentOS 5.2 with SELinux, part 2">Setting up UPS on CentOS 5.2 with SELinux, part 2 (1)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.olivetalks.com/2008/03/22/usb-in-xen-how-to-make-it-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Xenify office servers</title>
		<link>http://www.olivetalks.com/2008/03/10/howto-xenify-office-servers/</link>
		<comments>http://www.olivetalks.com/2008/03/10/howto-xenify-office-servers/#comments</comments>
		<pubDate>Mon, 10 Mar 2008 22:50:34 +0000</pubDate>
		<dc:creator>ZoltarStark</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[redundant]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.olivetalks.com/2008/03/10/howto-xenify-office-servers/</guid>
		<description><![CDATA[How to convert office servers into Xen guests in a middle sized office? Transferring services to Xen guests allows for easier maintenance of the physical servers and higher availability of services. The first thing to consider is a redundant file system.]]></description>
			<content:encoded><![CDATA[<p>In my company we&#8217;ve got a few Linux servers. They range from 3 year old machines with 1 GB of RAM to a fresh &#8220;monster&#8221; with 4 GB of RAM, Quad-Core CPU and external disk array. The servers provide multiple functions for about 20 people, mostly R&amp;D engineers. The current setup mostly works but there&#8217;s little redundancy in the system and taking even one server down for any long maintenance is impossible. Because of that the system has accumulated a bit of &#8220;cruft&#8221; over the years &#8211; mostly in the form of different versions of OS and applications &#8211; which makes future maintenance require even more effort. I want to Xenify this setup by transferring most or even all the services to Xen guests. The guests could then be migrated from one physical host to another as required. This way it would be possible to perform maintenance on any physical server without disturbing the availability of any service. Basically I&#8217;m looking for a way to employ Xen as a method to increase availability and simplify maintenance.</p>
<p>I think I should start with a redundant file system to be free from depending on the 100% availability of a file server. The redundant file system should possibly be clustered so extra redundancy can be provided for the services and load balancing where necessary.</p>
<p>I&#8217;m not sure how to go about it in an efficient way. I&#8217;d like to hear from anybody who&#8217;s done something like this before and is willing to share their experiences.</p>
<hr align="left" width="20%" /> <a href="/category/computers/feed" title="rss feed to post"><img src="/wp-content/uploads/2008/01/feed-icon-14x14.png" alt="rss feed to post" /></a> Subscribe to the Computers posts of olivetalks, if you found this article interesting, thank you!</p>
<h3>Related post(s)</h3><ul class="related_post"><li><a href="http://www.olivetalks.com/2008/03/22/usb-in-xen-how-to-make-it-work/" title="USB in Xen &#8211; how to make it work">USB in Xen &#8211; how to make it work (0)</a></li><li><a href="http://www.olivetalks.com/2009/06/24/skype-40-for-windows-is-out-pros-and-cons-compared-with-linux-skype-20/" title="Skype 4.0 for Windows is out: Pros and cons (compared with Linux Skype 2.0) ">Skype 4.0 for Windows is out: Pros and cons (compared with Linux Skype 2.0)  (1)</a></li><li><a href="http://www.olivetalks.com/2009/02/21/ups-on-centos-with-selinux-part-2/" title="Setting up UPS on CentOS 5.2 with SELinux, part 2">Setting up UPS on CentOS 5.2 with SELinux, part 2 (1)</a></li><li><a href="http://www.olivetalks.com/2009/02/19/ups-on-centos-with-selinux-part-1/" title="Setting up UPS on CentOS 5.2 with SELinux, part 1">Setting up UPS on CentOS 5.2 with SELinux, part 1 (0)</a></li><li><a href="http://www.olivetalks.com/2009/02/17/big-eee/" title="Eee PC 901 &#8211; aka Big Eee">Eee PC 901 &#8211; aka Big Eee (0)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.olivetalks.com/2008/03/10/howto-xenify-office-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xen p2v conversion in seven simple steps</title>
		<link>http://www.olivetalks.com/2008/02/16/xen-p2v-conversion-in-seven-simple-steps/</link>
		<comments>http://www.olivetalks.com/2008/02/16/xen-p2v-conversion-in-seven-simple-steps/#comments</comments>
		<pubDate>Sat, 16 Feb 2008 11:18:20 +0000</pubDate>
		<dc:creator>ZoltarStark</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[fully virtualized]]></category>
		<category><![CDATA[HVM]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[p2v]]></category>
		<category><![CDATA[RHEL]]></category>
		<category><![CDATA[SCSI]]></category>
		<category><![CDATA[xen]]></category>
		<category><![CDATA[Xen guest]]></category>

		<guid isPermaLink="false">http://www.olivetalks.com/2008/02/16/xen-p2v-conversion-in-seven-simple-steps/</guid>
		<description><![CDATA[Easily convert a physical Linux machine to a HVM guest running under Xen. Follow seven simple steps.]]></description>
			<content:encoded><![CDATA[<p>Xen is one of the currently available virtualization technologies. The commercially supported version is now owned by Cytrix while the Open Source community edition is available at<a href="http://xen.org/"> xen.org</a>. In this article I&#8217;ll be referring to the Open Source edition of Xen, version 3.0.3 which is available by default on CentOS 5.1.</p>
<p>I&#8217;ve recently performed two conversions of physical hosts to Xen guests running on CentOS 5.1 host. The physical hosts were running RHEL 3.7 and CentOS 4.6. It is important to know that after the conversion you end up with a fully virtualized guest &#8211; HVM. This has its effect on the performance, especially when it comes to I/O. It is a general limitation of fully virtualized Xen guests and not of this particular P2V method. I don&#8217;t recommend using it for virtualizing for example a file server. In such a case your only real choice is to create a new paravirtualized guest and migrate the services. This article won&#8217;t be describing that approach.</p>
<p>These instructions are based on the <a href="http://www.linuxjournal.com/article/9942">article</a> by Kyle Rankin. I&#8217;ve adapted it for Xen and added comments on those things which did cause me trouble. The instructions have been used to virtualize RHEL and CentOS servers to run as Xen guests on CentOS 5.1 but you should be able to use most of them for other distributions.</p>
<p><strong>First step</strong> in the conversion is to create LVM volume(s) in the Xen host to be used by the guest. To figure out how much space you need,   have a look at the physical server you want to virtualize. Each LVM volume will be visible in the guest as a separate hard disk. Note that HVM guests support only up to four disks. You will partition the disks from inside the guest in step two.</p>
<p><strong>Second step</strong> is to create a new HVM guest and boot it from a bootable rescue CD/DVD. You should use a rescue CD which matches the architecture of the physical host being virtualized. In step four you need to run <code>chroot</code> command on the guest and it won&#8217;t work if you try for example a 32 bit rescue CD on a 64 bit system. After you have already booted the guest from a rescue CD you need to create partitions to match the physical host. The easiest thing is to match exactly the number and sizes of partitions on the physical system. You can also put several file systems which were on separate partitions on the physical server on a single partition on the guest as long as you prepare enough space.</p>
<p><strong>Third step</strong> is to copy files from the physical server to the guest. This can take some time, so depending on whether you want to minimize the downtime you can do it either in one step or in two. Both methods use <code>rsync</code> command.  The second method is described by Kyle in his <a href="http://www.linuxjournal.com/article/9942">article</a>. The first method is basically the same but you only do the final synchronization. If you use a single transfer method you don&#8217;t need to use the <code>--delete</code> parameter for the final (and in this case the only) synchronization. The single transfer method is faster but it might not be available for you if you need to minimize the downtime.</p>
<p><strong>Fourth step</strong> is to adjust the boot settings in the guest. Without that the guest won&#8217;t boot. To do that make sure all the guest file systems are mounted and <code>chroot</code> into the guest root file system. From there you need to adjust the boot loader configuration. I use GRUB on my systems. For instructions on adjusting LILO you&#8217;ll have to look elsewhere.</p>
<p>First you need to change the file <code>/boot/grub/device.map</code>. If you see <code>/dev/sda</code> there you need to replace it with <code>/dev/hda</code>. This should represent your boot drive. Also verify that the guest boot partition is in <code>/etc/mtab</code>. After that you execute <code>grub-install /dev/hda</code>.</p>
<p>Another file which needs modifications is <code>/etc/grub.conf</code>. Pay attention to the lines starting with <code>boot=</code> and <code>splashimage=</code> as they probably need adjusting. The boot parameters need to be updated as appropriate. The important entries are <code>root (hd0,0)</code> and <code>root=</code> kernel parameter. Note that the first one selects the boot partition while the second selects the partition for the root file system. So for example if the boot partition is in <code>/dev/hda3</code> and root partition is <code>/dev/hda1</code> these entries should look <code>root (hd0,2)</code> (here the partitions are counted starting from zero) and <code>root=/dev/hda1</code> (here they are counted from one).</p>
<p><strong>Fifth step</strong> is to generate a new initrd file for the guest. First copy the existing initrd file somewhere in case you need it later. Then adjust the <code>/etc/modules.conf</code> or <code>/etc/modprobe.conf file</code> (only one will be present depending on the distribution and OS version). Remove all entries starting with <code>alias scsi_hostadapter</code>. After that you can run <code>mkinitrd</code> command. I recommend you use <code>-v</code> parameter for <code>mkinitrd</code>. This will list all the modules which will be included in the initrd. You will probably need at least libata and ata_piix &#8211; even if the physical server uses SCSI disks the HVM guest will use IDE. This depends on the OS of the physical machine you&#8217;re virtualizing because it was only important when I was converting the RHEL 3.7 server but not with CentOS 4.6. If they&#8217;re missing you can add them using <code>--with=</code> parameter. Another advice in case you need to verify the content of initrd file (probably because the guest doesn&#8217;t boot): take into account that older versions of <code>mkinitrd</code> produce just a gzipped ext2 filesystem while the newer ones create a gzipped cpio archive.</p>
<p><strong>Sixth step</strong> is to adjust the network settings and mount points for the guest. The configuration files you need to edit to change network settings are in <code>/etc/sysconfig/network-scripts</code>. Most likely you will have at least <code>ifcfg-eth0</code>. RHEL and CentOS usually specify the MAC address of the network adapter there so you need to change it to match with the MAC address of your guest. Otherwise when the guest boots the interface might not get activated. If you want to change the IP address of the guest you can also do it although I&#8217;d recommend to leave it for later when you already know the guest works. For the initial boot it should be easier if the guest runs with the same IP address as was used before by the physical server.</p>
<p>You also need to edit file <code>/etc/fstab</code> to match with the partition scheme defined for the guest.</p>
<p><strong>Seventh step</strong> is to boot the HVM guest which will be now able to replace the physical server. In order to avoid conflicts you should either power down the physical server, disconnect it from the network or change its IP address(es). After that you can reboot the Xen guest. If you followed the instructions and if the initrd file contains all required modules the system should boot and start all the configured services. If you&#8217;re using <code>kudzu</code> it will ask you a few questions about removed/added hardware. Kyle suggests to select &#8220;Keep Configuration&#8221; for any removed SCSI or network hardware, and select &#8220;Ignore&#8221; for any added SCSI or network hardware. If you are prompted about any removed video, sound, USB and similar hardware you can safely select &#8220;Remove Configuration&#8221;. When booting finishes verify that all required service are running and that you have network connectivity from within the guest.</p>
<p>That&#8217;s it. You should have now a fully virtualized guest running on the Xen host which has the same configuration as the physical server it replaces. It would be a good idea to perform this process first on a test physical server so you have more time to figure out solutions to any problems you may encounter.</p>
<hr align="left" width="20%" /> <a href="/category/computers/feed" title="rss feed to post"><img src="/wp-content/uploads/2008/01/feed-icon-14x14.png" alt="rss feed to post" /></a> Subscribe to the Computers posts of olivetalks, if you found this article interesting, thank you!</p>
<h3>Related post(s)</h3><ul class="related_post"><li><a href="http://www.olivetalks.com/2008/04/14/xen-centos-pe2950/" title="Xen and CentOS 5.1 on PowerEdge 2950">Xen and CentOS 5.1 on PowerEdge 2950 (2)</a></li><li><a href="http://www.olivetalks.com/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/" title="USB forwarding on Xen &#8211; it just does not work">USB forwarding on Xen &#8211; it just does not work (3)</a></li><li><a href="http://www.olivetalks.com/2008/01/24/usb-forwarding-on-xen/" title="USB forwarding on Xen">USB forwarding on Xen (0)</a></li><li><a href="http://www.olivetalks.com/2009/02/15/find-changes-with-rpm-verify/" title="What files did I change?">What files did I change? (2)</a></li><li><a href="http://www.olivetalks.com/2009/02/21/ups-on-centos-with-selinux-part-2/" title="Setting up UPS on CentOS 5.2 with SELinux, part 2">Setting up UPS on CentOS 5.2 with SELinux, part 2 (1)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.olivetalks.com/2008/02/16/xen-p2v-conversion-in-seven-simple-steps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>USB forwarding on Xen &#8211; it just does not work</title>
		<link>http://www.olivetalks.com/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/</link>
		<comments>http://www.olivetalks.com/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/#comments</comments>
		<pubDate>Sun, 03 Feb 2008 13:59:41 +0000</pubDate>
		<dc:creator>ZoltarStark</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[fully virtualized]]></category>
		<category><![CDATA[paravirtualized]]></category>
		<category><![CDATA[pci passthrough]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[USB export]]></category>
		<category><![CDATA[usb passthrough]]></category>
		<category><![CDATA[xen]]></category>
		<category><![CDATA[Xen guest]]></category>

		<guid isPermaLink="false">http://www.olivetalks.com/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/</guid>
		<description><![CDATA[Xen can forward individual USB devices to guest. Learn how to do it.]]></description>
			<content:encoded><![CDATA[<p>In <a href="/2008/01/24/usb-forwarding-on-xen/">one of my previous posts</a> I was writing about how I setup USB forwarding to a Xen guest by forwarding the whole USB controller. I used PCI pass-through method also known as PCI forwarding. I was able to see the USB controller and the USB device from the Xen guest.</p>
<p>Unfortunately the Xen guest was not stable. It would crash after half an hour, sometimes after two hours. I tried increasing the amount of RAM allocated to the guest, tried both paravirtualized and fully virtualized guests and the result was the same. The guest would crash.</p>
<p>I tried again to use <strong>USB forwarding</strong> and pass only a single USB device to the guest. After a few more attempts I noticed that I could &#8220;partially&#8221; forward the USB device itself to a fully virtualized guest (HVM) using this syntax:<br />
<code><br />
usb=1<br />
usbdevice="host:xxxx:yyyy"<br />
</code><br />
The values for xxxx and yyyy are the vendor ID and product ID for the USB device. They can be found out by using the <code>lsusb</code> command. For example on my laptop <code>lsusb</code> produces this output:<br />
<code><br />
Bus 007 Device 001: ID 0000:0000<br />
Bus 005 Device 003: ID 0b97:7772 O2 Micro, Inc.<br />
Bus 005 Device 002: ID 0b97:7761 O2 Micro, Inc.<br />
Bus 005 Device 001: ID 0000:0000<br />
Bus 004 Device 009: ID 062a:0000 Creative Labs<br />
Bus 004 Device 008: ID 413c:2002 Dell Computer Corp. SK-8125 Keyboard<br />
Bus 004 Device 007: ID 413c:1002 Dell Computer Corp. Keyboard Hub<br />
Bus 004 Device 001: ID 0000:0000<br />
Bus 003 Device 001: ID 0000:0000<br />
Bus 006 Device 001: ID 0000:0000<br />
Bus 002 Device 001: ID 0000:0000<br />
Bus 001 Device 001: ID 0000:0000<br />
</code><br />
So if I wanted to forward the device <em>Dell Computer Corp. SK-8125 Keyboard</em> I&#8217;d put the following in the Xen guest configuration file:<br />
<code><br />
usb=1<br />
usbdevice="host:413c:2002"<br />
</code></p>
<p>Ok, so in theory this should have let me see the USB device in Xen guest. Well it did, kind of. One thing I noticed was that I was only able to see some output when running <code>lsusb</code> on the guest when the guest was started from command line using the <code>xm create</code> command. When starting the guest from Virtual Machine Manager GUI I&#8217;d see absolutely no USB devices in the guest. Second, even when starting the guest from command line I&#8217;d see this kind of output from <code>lsusb</code>:<br />
<code><br />
Bus 001 Device 001: ID 0000:0000<br />
</code><br />
So it looks like something was being forwarded to the guest but it wasn&#8217;t the device I wanted to export. It looks like <strong>USB pass-through</strong> works on Xen only with some USB devices. That matches with what I&#8217;ve read at <a href="http://xgu.ru/wiki/USB_%D0%B2_Xen">xgu.ru</a>.</p>
<p>The final result &#8211; at the moment I&#8217;m using the USB device from the physical host. At least until I have time to look at it again.</p>
<hr align="left" width="20%" /> <a href="/category/computers/feed" title="rss feed to post"><img src="/wp-content/uploads/2008/01/feed-icon-14x14.png" alt="rss feed to post" /></a> Subscribe to the Computers posts of olivetalks, if you found this article interesting, thank you!</p>
<h3>Related post(s)</h3><ul class="related_post"><li><a href="http://www.olivetalks.com/2008/01/24/usb-forwarding-on-xen/" title="USB forwarding on Xen">USB forwarding on Xen (0)</a></li><li><a href="http://www.olivetalks.com/2008/02/16/xen-p2v-conversion-in-seven-simple-steps/" title="Xen p2v conversion in seven simple steps">Xen p2v conversion in seven simple steps (0)</a></li><li><a href="http://www.olivetalks.com/2008/03/22/usb-in-xen-how-to-make-it-work/" title="USB in Xen &#8211; how to make it work">USB in Xen &#8211; how to make it work (0)</a></li><li><a href="http://www.olivetalks.com/2008/04/14/xen-centos-pe2950/" title="Xen and CentOS 5.1 on PowerEdge 2950">Xen and CentOS 5.1 on PowerEdge 2950 (2)</a></li><li><a href="http://www.olivetalks.com/2008/03/10/howto-xenify-office-servers/" title="How to Xenify office servers">How to Xenify office servers (0)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.olivetalks.com/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>USB forwarding on Xen</title>
		<link>http://www.olivetalks.com/2008/01/24/usb-forwarding-on-xen/</link>
		<comments>http://www.olivetalks.com/2008/01/24/usb-forwarding-on-xen/#comments</comments>
		<pubDate>Thu, 24 Jan 2008 22:00:11 +0000</pubDate>
		<dc:creator>ZoltarStark</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[pci passthrough]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[USB export]]></category>
		<category><![CDATA[usb passthrough]]></category>
		<category><![CDATA[xen]]></category>
		<category><![CDATA[Xen guest]]></category>

		<guid isPermaLink="false">http://www.olivetalks.com/2008/01/24/usb-forwarding-on-xen/</guid>
		<description><![CDATA[Xen can forward USB ports to guest by PCI forwarding the whole controller. Learn how to do it.]]></description>
			<content:encoded><![CDATA[<p>Recently I was setting up a Xen guest which needed access to a USB port on a CentOS 5.1 host. I searched the Internet for instructions on how to use <strong>USB forwarding</strong> or <strong>USB pass-through</strong>  but I was not able to find anything which would work on the Xen 3.0.3 I&#8217;m using. I decided to set up <strong>PCI pass-through</strong> instead.</p>
<p>To set it up, I followed instructions written by Jón Fairbairn at <a href="http://wiki.xensource.com/xenwiki/Assign_hardware_to_DomU_with_PCIBack_as_module">xensource.com</a>. The <em>pciback</em> module in the CentOS 5.1 kernel doesn&#8217;t support the <em>hide</em> parameter so I left that out from my setup. It doesn&#8217;t seem to be necessary, anyway, for the driver for the USB controller in the host can be unbound from the PCI slot used by the controller.</p>
<p>To make sure the PCI slot is exported to Xen guests when the host system boots I created a <em>xenpciexport</em> script and placed it in the <em>/etc/init.d/</em> directory. You can download the code from here <a href="http://www.olivetalks.com/wp-content/uploads/2008/01/xenpciexport.txt" title="xenpciexport.txt">xenpciexport.txt</a></p>
<p>The script <em>xenpciexport</em> is set up to start before <em>xend</em> and <em>xendomains</em> to make sure the PCI forwarding is working before any guest is running. It stops after <em>xend</em> and <em>xendomains</em>. That&#8217;s controlled by the line:</p>
<p><code># chkconfig: 2345 97 02</code></p>
<p>you can see in the script header.</p>
<p>After copying the file to <em>/etc/init.d</em> you need to run</p>
<p><code>chkconfig --add xenpciexport</code></p>
<p>to create the appropriate links in the <em>/etc/rc*.d/</em> directories.</p>
<p>To find out the slot number for the USB controller use <em>lspci</em> and <em>lsusb</em> commands. If the script is set up correctly you can plug in the USB device and run</p>
<p><code>service xenpciexport stop</code></p>
<p>After that the results of <em>lsusb</em> should include the USB device you want to export. Then run</p>
<p><code>service xenpciexport start</code></p>
<p>and now <em>lsusb</em> won&#8217;t show this device anymore &#8211; it&#8217;s hidden from the host and visible to Xen guests.</p>
<p>Before you start the Xen guest which is supposed to have access to the exported device add this line to its configuration file:</p>
<p><code>pci = [ '0000:00:1d.1' ]</code></p>
<p>The number in quotes must be the same as the <em>SLOT</em> variable in the <em>xenpciexport</em> script.</p>
<p>After that you need to patch your Xen installation. The version installed in CentOS 5.1 contains a bug which makes it impossible to use PCI pass-through. The fix can be found at <a href="http://bugs.centos.org/view.php?id=2485">CentOS Bug Tracker</a>. Make sure you also fix the file <em>pciif.py</em> as specified in the note. In total there are three files which need to be edited: <em>iopif.py</em>, <em>irqif.py</em> and <em>pciif.py</em>.</p>
<p>Now you can finally start the Xen guest. When it finishes booting log into it and run <em>lsusb</em> there to confirm that the device is visible to the guest. <em>lspci</em> in the guest should also show you the USB controller. It is important to run the <em>xenpciexport</em> script before you start your guest, otherwise the USB device will not be visible to the guest OS.</p>
<p>The Xen guest has now full access to the USB device.</p>
<p>Here you can read more about <a href="http://www.wlug.org.nz/XenPciPassthrough" title="XenPciPassthrough">PCI passthrough on Xen</a>.</p>
<p><em><strong>Update:</strong></em><br />
It turns out that this setup was causing the Xen guest to crash. You can read more in a <a href="/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/">new post</a>.</p>
<hr align="left" width="20%" /> <a href="/category/computers/feed" title="rss feed to post"><img src="/wp-content/uploads/2008/01/feed-icon-14x14.png" alt="rss feed to post" /></a> Subscribe to the Computers posts of olivetalks, if you found this article interesting, thank you!</p>
<h3>Related post(s)</h3><ul class="related_post"><li><a href="http://www.olivetalks.com/2008/02/03/usb-forwarding-on-xen-it-just-does-not-work/" title="USB forwarding on Xen &#8211; it just does not work">USB forwarding on Xen &#8211; it just does not work (3)</a></li><li><a href="http://www.olivetalks.com/2008/02/16/xen-p2v-conversion-in-seven-simple-steps/" title="Xen p2v conversion in seven simple steps">Xen p2v conversion in seven simple steps (0)</a></li><li><a href="http://www.olivetalks.com/2008/04/14/xen-centos-pe2950/" title="Xen and CentOS 5.1 on PowerEdge 2950">Xen and CentOS 5.1 on PowerEdge 2950 (2)</a></li><li><a href="http://www.olivetalks.com/2008/03/22/usb-in-xen-how-to-make-it-work/" title="USB in Xen &#8211; how to make it work">USB in Xen &#8211; how to make it work (0)</a></li><li><a href="http://www.olivetalks.com/2009/02/21/ups-on-centos-with-selinux-part-2/" title="Setting up UPS on CentOS 5.2 with SELinux, part 2">Setting up UPS on CentOS 5.2 with SELinux, part 2 (1)</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.olivetalks.com/2008/01/24/usb-forwarding-on-xen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
