diff options
Diffstat (limited to 'recipes-example/virt-example')
6 files changed, 228 insertions, 0 deletions
diff --git a/recipes-example/virt-example/files/LICENSE b/recipes-example/virt-example/files/LICENSE new file mode 100644 index 0000000..22b249d --- /dev/null +++ b/recipes-example/virt-example/files/LICENSE | |||
@@ -0,0 +1,24 @@ | |||
1 | Copyright (c) 2014 by Enea Software AB | ||
2 | All rights reserved. | ||
3 | |||
4 | Redistribution and use in source and binary forms, with or without | ||
5 | modification, are permitted provided that the following conditions are met: | ||
6 | * Redistributions of source code must retain the above copyright | ||
7 | notice, this list of conditions and the following disclaimer. | ||
8 | * Redistributions in binary form must reproduce the above copyright | ||
9 | notice, this list of conditions and the following disclaimer in the | ||
10 | documentation and/or other materials provided with the distribution. | ||
11 | * Neither the name of Enea Software AB nor the | ||
12 | names of its contributors may be used to endorse or promote products | ||
13 | derived from this software without specific prior written permission. | ||
14 | |||
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
diff --git a/recipes-example/virt-example/files/example-container.conf b/recipes-example/virt-example/files/example-container.conf new file mode 100644 index 0000000..e2e8d5e --- /dev/null +++ b/recipes-example/virt-example/files/example-container.conf | |||
@@ -0,0 +1,50 @@ | |||
1 | #Copyright (c) 2014 by Enea Software AB | ||
2 | #All rights reserved. | ||
3 | # | ||
4 | #Redistribution and use in source and binary forms, with or without | ||
5 | #modification, are permitted provided that the following conditions are met: | ||
6 | # * Redistributions of source code must retain the above copyright | ||
7 | # notice, this list of conditions and the following disclaimer. | ||
8 | # * Redistributions in binary form must reproduce the above copyright | ||
9 | # notice, this list of conditions and the following disclaimer in the | ||
10 | # documentation and/or other materials provided with the distribution. | ||
11 | # * Neither the name of Enea Software AB nor the | ||
12 | # names of its contributors may be used to endorse or promote products | ||
13 | # derived from this software without specific prior written permission. | ||
14 | # | ||
15 | #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
16 | #ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | #WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | #DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
19 | #ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | #(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | #LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | #ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | #SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | |||
26 | lxc.tty = 2 | ||
27 | lxc.pts = 2 | ||
28 | lxc.rootfs = /container-images/example-container-rootfs/ | ||
29 | lxc.autodev = 1 | ||
30 | lxc.cgroup.cpuset.cpus = 3 | ||
31 | |||
32 | lxc.cgroup.devices.deny = a | ||
33 | # /dev/null and zero | ||
34 | lxc.cgroup.devices.allow = c 1:3 rwm | ||
35 | lxc.cgroup.devices.allow = c 1:5 rwm | ||
36 | # /dev/{,u}random | ||
37 | lxc.cgroup.devices.allow = c 1:9 rwm | ||
38 | lxc.cgroup.devices.allow = c 1:8 rwm | ||
39 | # pts consoles | ||
40 | lxc.cgroup.devices.allow = c 136:* rwm | ||
41 | lxc.cgroup.devices.allow = c 5:2 rwm | ||
42 | # rtc | ||
43 | lxc.cgroup.devices.allow = c 254:0 rwm | ||
44 | |||
45 | lxc.utsname = example-container | ||
46 | |||
47 | lxc.network.type = veth | ||
48 | lxc.network.link = example-bridge | ||
49 | lxc.network.veth.pair = example-veth | ||
50 | lxc.network.flags = up | ||
diff --git a/recipes-example/virt-example/files/example-guest-x86.xml b/recipes-example/virt-example/files/example-guest-x86.xml new file mode 100644 index 0000000..a3d4f6a --- /dev/null +++ b/recipes-example/virt-example/files/example-guest-x86.xml | |||
@@ -0,0 +1,71 @@ | |||
1 | <!-- | ||
2 | Copyright (c) 2014 by Enea Software AB | ||
3 | All rights reserved. | ||
4 | |||
5 | Redistribution and use in source and binary forms, with or without | ||
6 | modification, are permitted provided that the following conditions are met: | ||
7 | * Redistributions of source code must retain the above copyright | ||
8 | notice, this list of conditions and the following disclaimer. | ||
9 | * Redistributions in binary form must reproduce the above copyright | ||
10 | notice, this list of conditions and the following disclaimer in the | ||
11 | documentation and/or other materials provided with the distribution. | ||
12 | * Neither the name of Enea Software AB nor the | ||
13 | names of its contributors may be used to endorse or promote products | ||
14 | derived from this software without specific prior written permission. | ||
15 | |||
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | --> | ||
27 | |||
28 | <domain type='kvm'> | ||
29 | <name>kvm-example-guest</name> | ||
30 | <memory unit='KiB'>2000000</memory> | ||
31 | <vcpu>2</vcpu> | ||
32 | <os> | ||
33 | <type arch='x86_64'>hvm</type> | ||
34 | </os> | ||
35 | <clock offset='utc'/> | ||
36 | <on_poweroff>destroy</on_poweroff> | ||
37 | <on_reboot>restart</on_reboot> | ||
38 | <on_crash>destroy</on_crash> | ||
39 | <devices> | ||
40 | <emulator>/usr/bin/qemu-system-x86_64</emulator> | ||
41 | <!-- Bootable cd-rom drive that will only be used | ||
42 | if pxe boot is unavailable. --> | ||
43 | <disk type='file' device='cdrom'> | ||
44 | <source file='/usr/share/virt-example/enea-image-kvm-example-guest.iso'/> | ||
45 | <target dev='hdb' bus='ide'/> | ||
46 | <boot order="2"/> | ||
47 | </disk> | ||
48 | <!-- Shared folder that is accessible from both guest and host --> | ||
49 | <filesystem type='mount' accessmode='passthrough'> | ||
50 | <source dir='/mnt/guest-example'/> | ||
51 | <target dir='guest-example-shared-folder'/> | ||
52 | </filesystem> | ||
53 | <!-- Network that we use to pxe boot, MAC address is assigned | ||
54 | a specific ip in the example network definition --> | ||
55 | <interface type='network'> | ||
56 | <mac address='98:99:99:99:99:90'/> | ||
57 | <model type='virtio'/> | ||
58 | <source network='virt-example-net'/> | ||
59 | <boot order="1"/> | ||
60 | </interface> | ||
61 | <serial type='pty'> | ||
62 | <target port='0'/> | ||
63 | </serial> | ||
64 | <console type='pty' > | ||
65 | <target type='serial' port='0'/> | ||
66 | </console> | ||
67 | <memballoon model='virtio'> | ||
68 | </memballoon> | ||
69 | </devices> | ||
70 | </domain> | ||
71 | |||
diff --git a/recipes-example/virt-example/files/example-net.xml b/recipes-example/virt-example/files/example-net.xml new file mode 100644 index 0000000..c8cbca7 --- /dev/null +++ b/recipes-example/virt-example/files/example-net.xml | |||
@@ -0,0 +1,39 @@ | |||
1 | <!-- | ||
2 | Copyright (c) 2014 by Enea Software AB | ||
3 | All rights reserved. | ||
4 | |||
5 | Redistribution and use in source and binary forms, with or without | ||
6 | modification, are permitted provided that the following conditions are met: | ||
7 | * Redistributions of source code must retain the above copyright | ||
8 | notice, this list of conditions and the following disclaimer. | ||
9 | * Redistributions in binary form must reproduce the above copyright | ||
10 | notice, this list of conditions and the following disclaimer in the | ||
11 | documentation and/or other materials provided with the distribution. | ||
12 | * Neither the name of Enea Software AB nor the | ||
13 | names of its contributors may be used to endorse or promote products | ||
14 | derived from this software without specific prior written permission. | ||
15 | |||
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | --> | ||
27 | |||
28 | <network> | ||
29 | <name>virt-example-net</name> | ||
30 | <ip address='192.168.123.1' netmask='255.255.255.0'> | ||
31 | <tftp root='/usr/share/virt-example/pxe'/> | ||
32 | <dhcp> | ||
33 | <host mac="98:99:99:99:99:90" ip="192.168.123.2"/> | ||
34 | <range start='192.168.123.3' end='192.168.123.254'/> | ||
35 | <bootp file='pxelinux.0'/> | ||
36 | </dhcp> | ||
37 | </ip> | ||
38 | </network> | ||
39 | |||
diff --git a/recipes-example/virt-example/files/pxe/pxelinux.cfg/default b/recipes-example/virt-example/files/pxe/pxelinux.cfg/default new file mode 100755 index 0000000..753d6db --- /dev/null +++ b/recipes-example/virt-example/files/pxe/pxelinux.cfg/default | |||
@@ -0,0 +1,10 @@ | |||
1 | SERIAL 0 115200 0xab3 | ||
2 | |||
3 | DEFAULT kvm-example | ||
4 | |||
5 | LABEL kvm-example | ||
6 | kernel bzImage | ||
7 | append console=ttyS0,115200n8 initrd=enea-image-kvm-example-guest.cpio.gz | ||
8 | |||
9 | PROMPT 1 | ||
10 | TIMEOUT 0 | ||
diff --git a/recipes-example/virt-example/virt-example_1.0.0.bb b/recipes-example/virt-example/virt-example_1.0.0.bb new file mode 100644 index 0000000..1840d13 --- /dev/null +++ b/recipes-example/virt-example/virt-example_1.0.0.bb | |||
@@ -0,0 +1,34 @@ | |||
1 | DESCRIPTION = "KVM and libvirt examples" | ||
2 | |||
3 | FILESEXTRAPATHS_append := ":${THISDIR}/files" | ||
4 | |||
5 | SRC_URI = " \ | ||
6 | file://example-container.conf \ | ||
7 | file://example-guest-x86.xml \ | ||
8 | file://example-net.xml \ | ||
9 | file://LICENSE \ | ||
10 | file://pxe/pxelinux.cfg/default \ | ||
11 | " | ||
12 | |||
13 | LICENSE = "BSD" | ||
14 | LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=b52bab7a403562f36be803f11489f1a4" | ||
15 | |||
16 | S = "${WORKDIR}" | ||
17 | |||
18 | DESTDIR = "/usr/share/${PN}/" | ||
19 | |||
20 | FILES_${PN} = " \ | ||
21 | ${DESTDIR}example-container.conf \ | ||
22 | ${DESTDIR}example-guest-x86.xml \ | ||
23 | ${DESTDIR}example-net.xml \ | ||
24 | ${DESTDIR}pxe/pxelinux.cfg/default \ | ||
25 | " | ||
26 | |||
27 | do_install() { | ||
28 | install -d ${D}${DESTDIR} | ||
29 | install -d ${D}${DESTDIR}pxe/pxelinux.cfg/ | ||
30 | install ${WORKDIR}/pxe/pxelinux.cfg/default ${D}${DESTDIR}pxe/pxelinux.cfg/ | ||
31 | install ${WORKDIR}/example-container.conf ${D}${DESTDIR} | ||
32 | install ${WORKDIR}/example-guest-x86.xml ${D}${DESTDIR} | ||
33 | install ${WORKDIR}/example-net.xml ${D}${DESTDIR} | ||
34 | } | ||