mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Added support for non-bridged networking
This commit is contained in:
2
tests/sexpr2xmldata/sexpr2xml-net-bridged.sexpr
Normal file
2
tests/sexpr2xmldata/sexpr2xml-net-bridged.sexpr
Normal file
@@ -0,0 +1,2 @@
|
||||
(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w')))(device (vif (mac '00:11:22:33:44:55')(bridge 'xenbr2')(script 'vif-bridge'))))
|
||||
|
||||
27
tests/sexpr2xmldata/sexpr2xml-net-bridged.xml
Normal file
27
tests/sexpr2xmldata/sexpr2xml-net-bridged.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<domain type='xen' id='6'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='file'/>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
<interface type='bridge'>
|
||||
<source bridge='xenbr2'/>
|
||||
<mac address='00:11:22:33:44:55'/>
|
||||
<script path='vif-bridge'/>
|
||||
</interface>
|
||||
</devices>
|
||||
</domain>
|
||||
2
tests/sexpr2xmldata/sexpr2xml-net-routed.sexpr
Normal file
2
tests/sexpr2xmldata/sexpr2xml-net-routed.sexpr
Normal file
@@ -0,0 +1,2 @@
|
||||
(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w')))(device (vif (mac '00:11:22:33:44:55')(dev 'eth3')(script 'vif-routed')(ip '172.14.5.6')))
|
||||
|
||||
27
tests/sexpr2xmldata/sexpr2xml-net-routed.xml
Normal file
27
tests/sexpr2xmldata/sexpr2xml-net-routed.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<domain type='xen' id='6'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='file'/>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
<interface type='ethernet'>
|
||||
<mac address='00:11:22:33:44:55'/>
|
||||
<ip address='172.14.5.6'/>
|
||||
<script path='vif-routed'/>
|
||||
</interface>
|
||||
</devices>
|
||||
</domain>
|
||||
@@ -97,6 +97,19 @@ static int testCompareResizedMemory(void *data ATTRIBUTE_UNUSED) {
|
||||
}
|
||||
|
||||
|
||||
static int testCompareNetRouted(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-net-routed.xml",
|
||||
"sexpr2xmldata/sexpr2xml-net-routed.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareNetBridged(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-net-bridged.xml",
|
||||
"sexpr2xmldata/sexpr2xml-net-bridged.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@@ -145,5 +158,13 @@ main(int argc, char **argv)
|
||||
1, testCompareResizedMemory, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("SEXPR-2-XML net routed",
|
||||
1, testCompareNetRouted, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("SEXPR-2-XML net bridged",
|
||||
1, testCompareNetBridged, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
1
tests/xml2sexprdata/xml2sexpr-net-bridged.sexpr
Normal file
1
tests/xml2sexprdata/xml2sexpr-net-bridged.sexpr
Normal file
@@ -0,0 +1 @@
|
||||
(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w')))(device (vif (mac '00:11:22:33:44:55')(bridge 'xenbr2')(script 'vif-bridge'))))
|
||||
29
tests/xml2sexprdata/xml2sexpr-net-bridged.xml
Normal file
29
tests/xml2sexprdata/xml2sexpr-net-bridged.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<domain type='xen' id='15'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
<interface type="bridge">
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
<source bridge="xenbr2"/>
|
||||
<script path="vif-bridge"/>
|
||||
<target dev="vif4.0"/>
|
||||
</interface>
|
||||
<console tty='/dev/pts/4'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
||||
1
tests/xml2sexprdata/xml2sexpr-net-routed.sexpr
Normal file
1
tests/xml2sexprdata/xml2sexpr-net-routed.sexpr
Normal file
@@ -0,0 +1 @@
|
||||
(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w')))(device (vif (mac '00:11:22:33:44:55')(dev 'eth3')(script 'vif-routed')(ip '172.14.5.6'))))
|
||||
30
tests/xml2sexprdata/xml2sexpr-net-routed.xml
Normal file
30
tests/xml2sexprdata/xml2sexpr-net-routed.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<domain type='xen' id='15'>
|
||||
<name>pvtest</name>
|
||||
<uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
</os>
|
||||
<memory>430080</memory>
|
||||
<vcpu>2</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<source file='/root/some.img'/>
|
||||
<target dev='xvda'/>
|
||||
</disk>
|
||||
<interface type="ethernet">
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
<ip address="172.14.5.6"/>
|
||||
<source dev="eth3"/>
|
||||
<script path="vif-routed"/>
|
||||
<target dev="vif4.0"/>
|
||||
</interface>
|
||||
<console tty='/dev/pts/4'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
||||
@@ -138,6 +138,21 @@ static int testCompareMemoryResize(void *data ATTRIBUTE_UNUSED) {
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareNetRouted(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("xml2sexprdata/xml2sexpr-net-routed.xml",
|
||||
"xml2sexprdata/xml2sexpr-net-routed.sexpr",
|
||||
"pvtest",
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareNetBridged(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("xml2sexprdata/xml2sexpr-net-bridged.xml",
|
||||
"xml2sexprdata/xml2sexpr-net-bridged.sexpr",
|
||||
"pvtest",
|
||||
2);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@@ -202,6 +217,13 @@ main(int argc, char **argv)
|
||||
1, testCompareMemoryResize, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR Net Routed",
|
||||
1, testCompareNetRouted, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR Net Bridged",
|
||||
1, testCompareNetBridged, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user