On Wed, Sep 12, 2007 at 12:17:58PM -0700, Evan Bigall wrote:
I'm having a problem using libvirt to manage "defined"
domains (ie:
domains for which it has XML, but are not running.)
I have tried several debugging scenarios, but the simplest one is this.
In a libvirt C program I define the following XML:
char domxml[]="<domain type='xen' id='99'>"
"<name>rhel5vm</name>"
"<uuid>f948d7f4f36c4bfae8053bca535183b3</uuid>"
"<os>"
"<type>linux</type>"
"<kernel>/var/lib/xen/boot/rhel5vm/vmlinuz-2.6.18-8.el5xen</kernel>"
"<initrd>/var/lib/xen/boot/rhel5vm/initrd-2.6.18-8.el5xen.img</initrd>"
"<root>/dev/xvda1</root>"
"</os>"
"<memory>512000</memory>"
"<vcpu>1</vcpu>"
"<on_poweroff>destroy</on_poweroff>"
"<on_reboot>restart</on_reboot>"
"<on_crash>restart</on_crash>"
"<devices>"
"<interface type='bridge'>"
"<source bridge='xenbr0'/>"
"<mac address='00:16:3e:09:ef:b0'/>"
"<script path='vif-bridge'/>"
"</interface>"
"<disk type='block' device='disk'>"
"<driver name='phy'/>"
"<source dev='/dev/sda3'/>"
"<target dev='xvda'/>"
"</disk>"
"<console tty='/dev/pts/2'/>"
"</devices>"
"</domain>";
(I've played with several values for the domain id).
The 'id' field is not needed when defining a new VM - it is automatically
allocated by the Xen HV. Including it is harmless though - it'll simply
be ignored when defining a VM.
What I find is that when I use virDomainDefineXML() to define the
domain,
for some reason it drops, the "root" element from the "os"
specification.
Because of this the domain then crashes when I try to start it.
Yes, this looks like a bug in the way libvirt handles the <root> element.
In fact I didn't even realize we had a 'root' element! The XML parser will
accept the root tag, but the code which converst from XenD -> XML does not
include the root element.
As a workaround, it should work if you use the alternate cmdline tag, eg
<cmdline>root=/dev/xvda1</cmdline>
Regards,
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules:
http://search.cpan.org/~danberr/ -=|
|=- Projects:
http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|