Description

VNF cannot be started, and when looking at show 'virtual-network-function', it is in shutdown state.

Symptoms

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

Also, notice that there is no ID for the VNF.

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

Solution

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


This will require a reboot of the NFX, since the memory settings are being modified.  After the NFX has booted, you will see that the Test-VNF is now in a running state.

[edit]
root@router# run show virtual-network-functions    
ID       Name                        State      Liveliness
-----------------------------------------------------------
5        Test-VNF                    Running    alive
1        vjunos0                     Running    alive

Modification History

2020-11-04: Added note that reboot is required for the changes to take effect.

Related Information