Convert test driver to new domain XML apis

This commit is contained in:
Daniel P. Berrange 2008-07-11 16:41:27 +00:00
parent c422fd1240
commit d78c0a6800
6 changed files with 513 additions and 631 deletions

View File

@ -1,3 +1,10 @@
Fri Jul 11 17:39:59 BST 2008 Daniel P. Berrange <berrange@redhat.com>
* src/test.c, src/test.h: Convert to the new domain XML apis
* docs/testdomfc4.xml: Update for new syntax
* docs/testnodeinline.xml: Demo of inline domain & network XML
* tests/read-non-seekable: Update to have OS block
Fri Jul 11 17:37:59 BST 2008 Daniel P. Berrange <berrange@redhat.com>
* src/test.c: Convert to the new network XML apis

View File

@ -2,7 +2,7 @@
<name>fc4</name>
<uuid>EF86180145B911CB88E3AFBFE5370493</uuid>
<os>
<type>linux</type>
<type>xen</type>
<kernel>/boot/vmlinuz-2.6.15-1.43_FC5guest</kernel>
<initrd>/boot/initrd-2.6.15-1.43_FC5guest.img</initrd>
<root>/dev/sda1</root>

110
docs/testnodeinline.xml Normal file
View File

@ -0,0 +1,110 @@
<?xml version="1.0"?>
<node>
<!-- This file gives an example config for the mock 'test' backend
driver to libvirt. This is intended to allow relible unit testing
of applications using libvirt. To use this with virsh, run something
like:
virsh -connect test:////path/to/this/dir/testnode.xml nodeinfo
-->
<domain type="test">
<name>fv0</name>
<uuid>4dea22b31d52d8f32516782e98ab3fa0</uuid>
<os>
<type>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev="hd"/>
</os>
<memory>524288</memory>
<maxMemory>1524288</maxMemory>
<vcpu>4</vcpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<features>
<pae/>
<acpi/>
<apic/>
</features>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<interface type="bridge">
<source bridge="xenbr0"/>
<mac address="00:16:3e:5d:c7:9e"/>
<script path="vif-bridge"/>
</interface>
<disk type="file">
<source file="/root/fv0"/>
<target dev="hda"/>
</disk>
<disk type="file" device="cdrom">
<source file="/root/fc5-x86_64-boot.iso"/>
<target dev="hdc"/>
<readonly/>
</disk>
<disk type="file" device="floppy">
<source file="/root/fd.img"/>
<target dev="fda"/>
</disk>
<graphics type="vnc" port="5904"/>
</devices>
</domain>
<domain type="test">
<name>fc4</name>
<uuid>EF86180145B911CB88E3AFBFE5370493</uuid>
<os>
<type>xen</type>
<kernel>/boot/vmlinuz-2.6.15-1.43_FC5guest</kernel>
<initrd>/boot/initrd-2.6.15-1.43_FC5guest.img</initrd>
<root>/dev/sda1</root>
<cmdline> ro selinux=0 3</cmdline>
</os>
<memory>261072</memory>
<currentMemory>131072</currentMemory>
<vcpu>1</vcpu>
<devices>
<disk type="file">
<source file="/u/fc4.img"/>
<target dev="sda1"/>
</disk>
<interface type="bridge">
<source bridge="xenbr0"/>
<mac address="aa:00:00:00:00:11"/>
<script path="/etc/xen/scripts/vif-bridge"/>
</interface>
<console tty="/dev/pts/5"/>
</devices>
</domain>
<network>
<name>private</name>
<uuid>004b22212d78c30f5aa5f03c87d21e69</uuid>
<bridge name="brpriv"/>
<ip address="192.168.124.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.124.128" end="192.168.124.253"/>
</dhcp>
</ip>
</network>
<network>
<name>default</name>
<uuid>004b96e12d78c30f5aa5f03c87d21e69</uuid>
<bridge name="brdefault"/>
<forward dev="eth0"/>
<ip address="192.168.122.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.122.128" end="192.168.122.253"/>
</dhcp>
</ip>
</network>
<cpu>
<mhz>6000</mhz>
<model>i986</model>
<active>50</active>
<nodes>4</nodes>
<sockets>4</sockets>
<cores>4</cores>
<threads>2</threads>
</cpu>
<memory>8192000</memory>
</node>

1020
src/test.c

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@
#ifndef __VIR_TEST_INTERNAL_H__
#define __VIR_TEST_INTERNAL_H__
#include "libvirt/virterror.h"
#include "internal.h"
#ifdef __cplusplus
extern "C" {

View File

@ -31,6 +31,9 @@ cat <<\EOF > dom
<uuid>004b96e1-2d78-c30f-5aa5-000000000000</uuid>
<memory>8388608</memory>
<vcpu>2</vcpu>
<os>
<type>xen</type>
</os>
<on_reboot>restart</on_reboot>
<on_poweroff>destroy</on_poweroff>
<on_crash>restart</on_crash>