Symptoms

In a very large Virtuozzo environments you may want to export templates via NFS to other nodes to avoid multiple cache updates when an EZ template update is being performed.

Requirements

It works only with ploop-based templates. Verify that you are using ploop:

# grep "VEFSTYPE" /etc/sysconfig/vz
VEFSTYPE="ext4"

Resolution

  1. Select one Virtuozzo 6.0 node which should be used to export templates, install NFS components on it

    # yum install rpcbind nfs-utils nfs-utils-lib
    
  2. Enable NFS-related services

    # chkconfig rpcbind on
    # chkconfig nfslock on
    # chkconfig nfs on
    
  3. Start services

    # service rpcbind start
    Starting rpcbind:                                          [  OK  ]
    # service nfslock start
    Starting NFS statd:                                        [  OK  ]
    # service nfs start
    Starting NFS services:                                     [  OK  ]
    Starting NFS mountd:                                       [  OK  ]
    Starting NFS daemon:                                       [  OK  ]
    Starting RPC idmapd:                                       [  OK  ]
    
  4. Export /vz/template directory

    Edit file /etc/exports to export the directory via NFS. Add following record:

    /vz/template <IP>/<SUBNET>(rw,sync,no_subtree_check)
    

    Note!: Replace <IP> and <SUBNET> with corresponding network settings (e.g. 192.168.1.0 and 255.255.255.0).

  5. Run following command to export the share

    # exportfs -a
    
  6. Modify permissions to allow NFS clients to write into this directory

    # chown -R nfsnobody:nfsnobody /vz/template
    

Now you can mount the NFS share on any other Virtuozzo node and cache template on any node. The template caching utility (vzpkg) is NFS-aware and will lock the template during caching operation which would prevent any conflicts.

Additional information

121721 - OS template cache creation fails if /vz is mounted on NFS

Internal content