Symptoms
It is not possible to create an OS template cache for Centos 7:
~]# vzpkg create cache centos-7-x86_64
Creating OS template cache for centos-7-x86_64 template
Cleaning repos: base0 base1 base2 base3
0 metadata files removed
0 sqlite files removed
0 metadata files removed
base0 | 2.9 kB 00:00:00
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Name or service not known"
...
Cause
The issue appeared after the official repositories reached EOL: https://www.redhat.com/en/topics/linux/centos-linux-eol#
Resolution
To create the OS template cache for CentOS 7 or any previous version, it is necessary to specify the proper server to fetch packages from and update the list of repositories of the affected EZ OS template. In the example below, the EZ OS template is centos-7-x86_64.
1) Edit the template and disable the mirror list
~]# mv /vz/template/centos/7/x86_64/config/os/default/mirrorlist{,.obsolete}
2) Verify and add the necessary repository links
~]# cat /vz/template/centos/7/x86_64/config/os/default/repositories
https://repo.virtuozzo.com/ctpreset/rpm/
https://vault.centos.org/centos/7/os/x86_64/
https://vault.centos.org/centos/7/updates/x86_64/
3) Recreate the cache using the force (-f) flag.
~]# vzpkg create cache centos-7-x86_64 -f