<?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>CINAQ ~xiwen &#187; libvirt</title>
	<atom:link href="http://www.cinaq.com/wordpress/tag/libvirt/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cinaq.com/wordpress</link>
	<description>Whistles and bells</description>
	<lastBuildDate>Sat, 22 Aug 2009 21:51:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Add support for unix socket in gnu-netcat</title>
		<link>http://www.cinaq.com/wordpress/2009/08/add-support-for-unix-socket-in-gnu-netcat/</link>
		<comments>http://www.cinaq.com/wordpress/2009/08/add-support-for-unix-socket-in-gnu-netcat/#comments</comments>
		<pubDate>Sat, 22 Aug 2009 21:50:34 +0000</pubDate>
		<dc:creator>xiwen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arch linux]]></category>
		<category><![CDATA[kvm]]></category>
		<category><![CDATA[libvirt]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[nc]]></category>
		<category><![CDATA[netcat]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[virt-manager]]></category>
		<category><![CDATA[wrapper]]></category>

		<guid isPermaLink="false">http://www.cinaq.com/wordpress/?p=56</guid>
		<description><![CDATA[virsh from the libvirt package uses netcat to communicate with a remote server (in fact the command is executed locally on the remote server): command -p port [-l username] hostname netcat -U socket from: libvirt&#62; Remote support&#62; Extra parameters However, the server I&#8217;m testing with runs Arch Linux; virt-manager, libvirt and its dependencies were installed [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p><strong>virsh</strong> from the <strong>libvirt</strong> package uses netcat to communicate with a remote server (in fact the command is executed locally on the remote server):<br />
<em>command</em> -p <em>port</em> [-l <em>username</em>] <em>hostname</em> <em>netcat</em> -U <em>socket</em><br />
from: <a href="http://libvirt.org/remote.html" target="_blank">libvirt&gt; Remote support&gt; Extra parameters</a></p>
<p><span id="more-56"></span></p>
<p>However, the server I&#8217;m testing with runs Arch Linux; virt-manager, libvirt and its dependencies were installed through AUR; In the list of dependencies the OpenBSD implementation of netcat wasn&#8217;t listed. I&#8217;m aware Debian has ported it. The special feature in this netcat re-write is support for UNIX socket. As libvirt uses UNIX socket to communicate, the gnu-netcat cannot be used; it doesn&#8217;t understand the <strong>-U</strong> flag. The error happens when you try to connect to a remote server through a SSH tunnel:<br />
<em>virsh -d 5 -c qemu+ssh://somehost/system list</em></p>
<p>If the netcat binary on the remote host doesn&#8217;t understand -U, it will fail.</p>
<p>A quick dirty fix, more like a workaround, is to use a wrapper. <strong>socat</strong>&#8216;s speciality is socket. We can use it like this:</p>
<ul>
<li>rename original netcat: mv /usr/bin/netcat /usr/bin/netcat.orig</li>
<li>create the wrapper /usr/bin/netcat with as content:</li>
<pre>	#!/bin/sh
	if [ "$1" == "-U" ]; then socat - unix-client:$2
	else netcat.orig $@
	fi</pre>
<li>chmod 755 /usr/bin/netcat</li>
</ul>
<p>And you&#8217;re ready to rock <img src='http://www.cinaq.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><em>On the long run libvirt shouldn&#8217;t rely on the OpenBSD implementation of netcat. As there&#8217;s only a few Linux distributions out there that adopted this rewrite. Perhaps give the user the freedom to choose which socket-tool to use in the configuration file?</em></p>
<p><em><br />
</em></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.cinaq.com/wordpress/2009/08/add-support-for-unix-socket-in-gnu-netcat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
