VNF cannot be started, and when looking at show 'virtual-network-function', it is in shutdown state.
VNF shows it is in shutdown state:
root@router> show virtual-network-functions ID Name State Liveliness ------------------------------------------------------ - Test-VNF Shutdown down 1 vjunos0 Running alive
When trying to start up the VNF manually, it gives an error regarding memory allocation:
root@router> request virtual-network-functions Test-VNF start Could not start VNF Test-VNF: internal error: process exited while connecting to monitor: 2020-04-02T22:07:15.270023Z kvm: cannot set up guest memory 'pc.ram': Cannot allocate memory
VNF config needs hugepage specified.
When a VNF is in shutdown state, it usually means there is not enough memory allocated, or there is no contiguous memory available to spin up the VNF. If hugepages is not configured for the VNF, there may not be contiguous memory available for the VNF to spin up.
set virtual-network-functions Test-VNF image /var/public/Test-VNF.qcow2 set virtual-network-functions Test-VNF image image-type qcow2 set virtual-network-functions Test-VNF virtual-cpu count 3 set virtual-network-functions Test-VNF virtual-cpu features hardware-virtualization set virtual-network-functions Test-VNF interfaces eth2 mapping vlan mode trunk set virtual-network-functions Test-VNF interfaces eth2 mapping vlan members vlan-10 set virtual-network-functions Test-VNF interfaces eth3 mapping vlan mode trunk set virtual-network-functions Test-VNF interfaces eth3 mapping vlan members vlan-20 set virtual-network-functions Test-VNF memory size 9961472
To resolve this, add hugepages to the VNF config.
root@router# set virtual-network-functions Test-VNF memory features hugepages page-size 1024 [edit] root@router# commit commit complete
[edit] root@router# run show virtual-network-functions ID Name State Liveliness ----------------------------------------------------------- 5 Test-VNF Running alive 1 vjunos0 Running alive
2020-11-04: Added note that reboot is required for the changes to take effect.