<?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>Groove Labo &#187; kickstart</title>
	<atom:link href="http://labo.opengroove.com/blog/category/kickstart/feed/" rel="self" type="application/rss+xml" />
	<link>http://labo.opengroove.com/blog</link>
	<description>株式会社オープングルーヴの開発者のブログ</description>
	<lastBuildDate>Tue, 28 Sep 2010 06:09:57 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>xenでDomUをvirt-installするときのquoteの問題</title>
		<link>http://labo.opengroove.com/blog/2008/06/02/xen%e3%81%a7domu%e3%82%92virt-install%e3%81%99%e3%82%8b%e3%81%a8%e3%81%8d%e3%81%aequote%e3%81%ae%e5%95%8f%e9%a1%8c/</link>
		<comments>http://labo.opengroove.com/blog/2008/06/02/xen%e3%81%a7domu%e3%82%92virt-install%e3%81%99%e3%82%8b%e3%81%a8%e3%81%8d%e3%81%aequote%e3%81%ae%e5%95%8f%e9%a1%8c/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 02:03:19 +0000</pubDate>
		<dc:creator>sugimoto</dc:creator>
				<category><![CDATA[Xen]]></category>
		<category><![CDATA[kickstart]]></category>

		<guid isPermaLink="false">http://labo.opengroove.com/blog/index.php/2008/06/02/xen%e3%81%a7domu%e3%82%92virt-install%e3%81%99%e3%82%8b%e3%81%a8%e3%81%8d%e3%81%aequote%e3%81%ae%e5%95%8f%e9%a1%8c/</guid>
		<description><![CDATA[CentOS 5.1にインストールしたxenでDomUをkickstartを使って自動的に作成する設定をしていたら、その問題が起きました。 >sudo /usr/sbin/virt-install --extra-args='ks=http://ks-server/kickstart.php?host=myhost&#038;ip=192.168.1.151&#038;mac=00:00:00:00:01:51' What is the name of your virtual machine? myhost How much RAM should be allocated (in megabytes)? 512 What would you like to use as the disk (path)? /var/xen/myhost.img How large would you like the disk (/var/xen/myhost.img) to be (in gigabytes)? 8 Would you like to enable graphics support? (yes [...]]]></description>
			<content:encoded><![CDATA[<p>
CentOS 5.1にインストールしたxenでDomUをkickstartを使って自動的に作成する設定をしていたら、その問題が起きました。
</p>

<pre>
>sudo /usr/sbin/virt-install
    --extra-args='ks=http://ks-server/kickstart.php?host=myhost&#038;ip=192.168.1.151&#038;mac=00:00:00:00:01:51'

What is the name of your virtual machine? myhost
 How much RAM should be allocated (in megabytes)? 512
 What would you like to use as the disk (path)? /var/xen/myhost.img
 How large would you like the disk (/var/xen/myhost.img) to be (in gigabytes)? 8
 Would you like to enable graphics support? (yes or no) no
 What is the install location? ftp://ftp.riken.jp/Linux/centos/4/os/i386/


Starting install...
Retrieving CentOS...                                             310 B 00:00
Retrieving vmlinuz...     100% |=========================| 1.0 MB    00:00
Retrieving initrd.img...  100% |=========================| 853 kB    00:00
Creating storage file...  100% |=========================| 8.0 GB    00:00
libvir: XML error : line 10: EntityRef: expecting ';'
libvir: XML error : line 10: EntityRef: expecting ';'
libvir: Xen Daemon error : XML description for domain is not well formed or invalid
Traceback (most recent call last):
  File "/usr/sbin/virt-install", line 633, in ?
    main()
  File "/usr/sbin/virt-install", line 578, in main
    dom = guest.start_install(conscb,progresscb)
  File "/usr/lib/python2.4/site-packages/virtinst/Guest.py", line 649, in start_install
    return self._do_install(consolecb, meter)
  File "/usr/lib/python2.4/site-packages/virtinst/Guest.py", line 666, in _do_install
    self.domain = self.conn.createLinux(install_xml, 0)
  File "/usr/lib/python2.4/site-packages/libvirt.py", line 503, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirt.libvirtError: virDomainCreateLinux() failed XML description for domain is not well formed or invalid
</pre>

<p>
virt-install では、extra-argsに&#8221;ks=&#8221;を設定して、kickstartの設定ファイルを読み込むことができます。
このとき、リモートの設定ファイルを変更することなく設定ファイルを読み込むために、設定ファイルをPHPにして、Query Stringで設定ファイルのパラメータを変更できるようにしていました。
</p>

<p>
この場合、host/ip/macを引数として渡しています。
</p>

<p>
Googleに聞いたところ、CentOS 5.1のlibvirtに問題があるようでした。
</p>

<ul class="normal">
  <li><a href="https://bugzilla.redhat.com/show_bug.cgi?id=417051" title="ドメインXMLでfilename内のspecial characterがエスケープされない問題">ドメインXMLでfilename内のspecial characterがエスケープされない問題</a></li>
</ul>

<p>
ここでは、install locationにシングルクォートが入っている場合を指摘していますが、設定全体でXMLのspecial characterのエスケープがされていないため、今回のようにextra-argsにアンパサンド(&amp;)が入っている場合も同様の問題が起こりました。
</p>

<p>
問題を回避するため、kickstartの設定をおいているサーバーのapacheの設定を修正し、kickstartの設定ファイルのURIを変更しました。
</p>

<p>
http://ks-server/kickstart/myhost/192.168.1.151/00:00:00:00:01:51 でkickstartの設定ファイルを取得する
</p>

<pre>
    RewriteLogLevel 9
    RewriteLog "/var/log/apache2/www-local-rewrite.log"
    RewriteRule ^/kickstart/(.*?)/(.*?)/(.*)$ /kickstart.php?host=$1&#038;ip=$2&#038;mac=$3 [L]
</pre>

<p>
これで自動インストールすることができました。
</p>

<p>
このバグはCentOS 5.2のlibvirtでは修正されているらしく、<a href="http://rhn.redhat.com/errata/RHEA-2008-0371.html">修正</a>もすでに公開されています。
</p>

<p>
参考
</p>

<ul>
  <li><a href="https://bugzilla.redhat.com/show_bug.cgi?id=417051" title="ドメインXMLでfilename内のspecial characterがエスケープされない問題">ドメインXMLでfilename内のspecial characterがエスケープされない問題</a></li>
  <li><a href="http://rhn.redhat.com/errata/RHEA-2008-0371.html">上の問題の修正</a></li>
  <li><a href="http://ken-etsu-tech.blogspot.com/2007/11/xen-domuanaconda-kickstart.html" title="検閲Tech: Xen DomUインストールでAnaconda Kickstartを使う">検閲Tech: Xen DomUインストールでAnaconda Kickstartを使う</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://labo.opengroove.com/blog/2008/06/02/xen%e3%81%a7domu%e3%82%92virt-install%e3%81%99%e3%82%8b%e3%81%a8%e3%81%8d%e3%81%aequote%e3%81%ae%e5%95%8f%e9%a1%8c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

