Description

This article provides an sample template to spin vSRX on KVM

Symptoms

Spin a vSRX using template

Solution

Below is a sample template to spin a vSRX on a KVM machine. Copy the below template to a text editor. The file extension should be .xml.

<domain type='kvm' id='1'>
  <name>ATT-VSRX-1</name>
  <memory unit='KiB'>8194304</memory>.                                              <<<Define Memory
  <currentMemory unit='KiB'>8194304</currentMemory>
  <vcpu placement='static'>5</vcpu>                                                        <<<Define CPU
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-xenial'>hvm</type>          <<<Define OS and boot device
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-model'>
    <model fallback='allow'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/kvm-spice</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/junos-vsrx3-x86-64-24.2R2.18.qcow2'/>.        <<<Copy the image to the /var/lib/ location 
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <interface type='direct'>.                                     <<<<<<Assign virtio interface for fxp0 
      <source dev='eno1' mode='bridge'/>
      <target dev='macvtap0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='bridge'>                                   <<<<<<Assign virtio intercae for ge-0/0/0
      <mac address='52:54:00:58:22:40'/> <source bridge='HSL'/>     <<<<<Assign custom created bridge>>>
      <target dev='vnet0'/>
      <model type='virtio'/> 
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> 
    </interface>
    <interface type='hostdev' managed='yes'>
     <driver name='vfio'/>
     <source>
     <address type='pci' domain='0x0000' bus='0x03' slot='0x10' function='0x0'/>
     </source>
     <alias name='hostdev0'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
     </interface>
    <interface type='hostdev' managed='yes'>
     <driver name='vfio'/>
     <source>
     <address type='pci' domain='0x0000' bus='0x03' slot='0x11' function='0x1'/>
     </source>
     <alias name='hostdev0'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </interface>
    <serial type='pty'>
      <source path='/dev/pts/10'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/10'>
      <source path='/dev/pts/10'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </memballoon>
  </devices>
</domain>

 

 

 

Modification History

v1