summaryrefslogtreecommitdiffstats
path: root/xci/playbooks/roles/create-vm-nodes/templates/vm.xml.j2
diff options
context:
space:
mode:
authorManuel Buil <mbuil@suse.com>2018-06-25 10:57:02 +0100
committerMarkos Chandras <mchandras@suse.de>2018-06-26 16:29:05 +0100
commit92fc2a3c43305532b885ef70201f363204b69a3b (patch)
tree721d8fdbfb21ed641c005f725bbd3eda5453ce24 /xci/playbooks/roles/create-vm-nodes/templates/vm.xml.j2
parentf6b2b8c16982b47570cadca36bce9c8906630776 (diff)
xci: roles: create-vm-nodes: Add role for creating XCI VM nodes
Add a new role based on the bifrost one to create nodes for the bifrost virtual deployments. This role will install and configure libvirt on the host, download a prebuilt OPNFV VM image and deploy the OPNFV VM using that image. Moreover, it will create the rest of the nodes for the virtual deployment which will be configured by bifrost later on. Change-Id: I9fbd084261351d3b53ae373060f43df046191c5e Co-Authored-by: Markos Chandras <mchandras@suse.de> Signed-off-by: Manuel Buil <mbuil@suse.com>
Diffstat (limited to 'xci/playbooks/roles/create-vm-nodes/templates/vm.xml.j2')
-rw-r--r--xci/playbooks/roles/create-vm-nodes/templates/vm.xml.j276
1 files changed, 76 insertions, 0 deletions
diff --git a/xci/playbooks/roles/create-vm-nodes/templates/vm.xml.j2 b/xci/playbooks/roles/create-vm-nodes/templates/vm.xml.j2
new file mode 100644
index 00000000..c44fa6aa
--- /dev/null
+++ b/xci/playbooks/roles/create-vm-nodes/templates/vm.xml.j2
@@ -0,0 +1,76 @@
+<domain type='{{ vm_domain_type }}'>
+ <name>{{ vm_name }}</name>
+ <memory unit='GiB'>{{ item.node.memory.rstrip('G') }}</memory>
+ <vcpu>{{ item.node.cpus }}</vcpu>
+ <os>
+ <type arch='{{ item.node.arch }}' machine='{{ item.node.model }}'>hvm</type>
+ {%- if 'opnfv' in vm_name -%}
+ <boot dev='hd'/>
+ {%- else -%}
+ <boot dev='network'/>
+ {% endif -%}
+ <bootmenu enable='no'/>
+ <bios useserial='yes' rebootTimeout='10000'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <cpu mode='{{ item.node.cpu_cflags }}'>
+ <model fallback='allow'/>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>{{ vm_emulator }}</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2' cache='{{ vm_disk_cache }}'/>
+ <source file='{{ vm_volume_path }}'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+ </disk>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ {% set native_interfaces = [] %}
+ {%- for interface in item.interfaces %}
+ {%- if 'native' in (interface.vlan | string) %}
+ {%- set _ = native_interfaces.append(interface) %}
+ {%- endif %}
+ {%- endfor %}
+ {%- for interface in native_interfaces -%}
+ <interface type='network'>
+ <source network='{{ vm_network }}'/>
+ <model type='{{ vm_nic }}'/>
+ <mac address='{{ interface.mac_address }}'/>
+ </interface>
+ {% endfor -%}
+ <input type='mouse' bus='ps2'/>
+ <graphics type='vnc' port='-1' autoport='yes'/>
+ <video>
+ <model type='cirrus' vram='9216' heads='1'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </video>
+ <serial type='file'>
+ <source path='{{ vm_log_file }}'/>
+ <target port='0'/>
+ <alias name='serial0'/>
+ </serial>
+ <serial type='pty'>
+ <source path='/dev/pts/49'/>
+ <target port='1'/>
+ <alias name='serial1'/>
+ </serial>
+ <console type='file'>
+ <source path='{{ vm_log_file }}'/>
+ <target type='serial' port='0'/>
+ <alias name='serial0'/>
+ </console>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>