blob: 3dfdbc466b701e068f7d2ae6855cc4aabf983ff5 [file] [log] [blame]
Richard Felkldc2ecf62018-03-23 13:09:41 +01001!/bin/bash -xe
2MIRROR_VM_MGM_BRIDGE_NAME=${MIRROR_VM_MGM_BRIDGE_NAME:-"br_mgm"}
3MIRROR_VM_MEM_KB=${MIRROR_VM_MEM_KB:-"4194304"}
4MIRROR_VM_CPUS=${MIRROR_VM_CPUS:-"4"}
5echo "<domain type='kvm'>
6 <name>$MIRROR_VM_NAME</name>
7 <memory unit='KiB'>$MIRROR_VM_MEM_KB</memory>
8 <currentMemory unit='KiB'>$MIRROR_VM_MEM_KB</currentMemory>
9 <vcpu placement='static'>$MIRROR_VM_CPUS</vcpu>
10 <resource>
11 <partition>/machine</partition>
12 </resource>
13 <os>
14 <type >hvm</type>
15 <boot dev='hd'/>
16 </os>
17 <features>
18 <acpi/>
19 <apic/>
20 </features>
21 <clock offset='utc'>
22 <timer name='rtc' tickpolicy='catchup'/>
23 <timer name='pit' tickpolicy='delay'/>
24 <timer name='hpet' present='no'/>
25 </clock>
26 <pm>
27 <suspend-to-mem enabled='no'/>
28 <suspend-to-disk enabled='no'/>
29 </pm>
30 <devices>
31 <emulator>/usr/bin/kvm-spice</emulator>
32 <disk type='file' device='disk'>
33 <driver name='qemu' type='qcow2' cache='none'/>
34 <source file='$MIRROR_VM_SOURCE_DISK'/>
35 <target dev='vda' bus='virtio'/>
36 <alias name='virtio-disk0'/>
37 <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
38 </disk>
39 <disk type='file' device='cdrom'>
40 <driver name='qemu' type='raw'/>
41 <source file='$MIRROR_VM_CONFIG_DISK'/>
42 <backingStore/>
43 <target dev='hda' bus='ide'/>
44 <readonly/>
45 <alias name='ide0-0-0'/>
46 <address type='drive' controller='0' bus='0' target='0' unit='0'/>
47 </disk>
48 <interface type='bridge'>
49 <source bridge='$MIRROR_VM_MGM_BRIDGE_NAME'/>
50 <target dev='vnet0'/>
51 <model type='virtio'/>
52 <alias name='net0'/>
53 <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
54 </interface>
55 <serial type='pty'>
56 <source path='/dev/pts/1'/>
57 <target port='0'/>
58 <alias name='serial0'/>
59 </serial>
60 <console type='pty' tty='/dev/pts/1'>
61 <source path='/dev/pts/1'/>
62 <target type='serial' port='0'/>
63 <alias name='serial0'/>
64 </console>
65 <graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1'>
66 <listen type='address' address='127.0.0.1'/>
67 </graphics>
68 </devices>
69</domain>" > $PWD/mirror-vm.xml
70virsh define $PWD/mirror-vm.xml