A template of an operating system is a set of disk images and installation scripts that consist of a distribution and other data for OS deployment. This article describes how to create a custom repository of OS templates.

The repository directory must contain the following files: 

  • the metadata.xml file is the main file describing a repository. It is used for getting information about templates.
  • A tar.gz file with template archives. the file also includes the metainfo.xml template description file.

metadata.xml — the XML-file with the elem elements for each template. Every elem contains a simplified description from metainfo.xml from the template.

The elements within the elem element:

  • osname — a template name ;
  • support —  a group of elem elements with names of software products that can use this template;
  • tags — template tags;
  • version — template API version required for this template;
  • filename —  a template file name;
  • utcmtime — template modification time.

Example of the metadata.xml file: 

<?xml version="1.0" encoding="utf-8"?>
<doc>
  <elem>
    <osname>FreeBSD-9-amd64</osname>
    <support>
      <elem>VMmgr</elem>
      <elem>DCImgr</elem>
    </support>
    <tags>freebsd,unix,freebsd9</tags>
    <version>5.57</version>
    <type>ostemplate</type>
    <filename>FreeBSD-9-amd64-5.57.tar.gz</filename>
    <utcmtime>2016-12-27 05:12:25</utcmtime>
  </elem>
  <elem create-metainfo="yes">
    <osname>Ubuntu-16.04-x86_64</osname>
    <support>
      <elem>VEmgr</elem>
    </support>
    <tags>ubuntu,linux,unix,ubuntu1604,xenial</tags>
    <version>5</version>
    <externals>
      <elem>
        <url>http://mirror.yandex.ru/mirrors/download.openvz.org/template/precreated/ubuntu-16.04-x86_64.tar.gz</url>
      </elem>
    </externals>
    <utcmtime>2016-11-27 05:08:59</utcmtime>
  </elem>
    <osname>Windows-Server-2008-R2</osname>
    <support>
      <elem>VMmgr</elem>
    </support>
    <tags>windows,windows2008r2</tags>
    <version>5</version>
    <type>ostemplate</type>
    <filename>Windows-Server-2008-R2-Web.tar.gz</filename>
    <utcmtime>2016-07-14 03:48:32</utcmtime>
  </elem>
  <elem>
    <osname>Windows Server 2012 R2 Clean</osname>
    <support>
      <elem>DCImgr</elem>
    </support>
    <tags>windows,windows2012r2</tags>
    <version>5</version>
    <type>ostemplate</type>
    <filename>WindowsServer-2012-R2-Clean.tar.gz</filename>
    <utcmtime>2016-08-23 04:58:23</utcmtime>
  </elem>
  <elem>
    <osname>CentOS-7-amd64</osname>
    <support>
      <elem>VMmgr</elem>
      <elem>DCImgr</elem>
    </support>
    <tags>centos,linux,unix,centos7</tags>
    <version>5.57</version>
    <type>ostemplate</type>
    <filename>CentOS-7-amd64-5.57.tar.gz</filename>
    <utcmtime>2016-12-27 06:44:33</utcmtime>
  </elem>
</doc>
BASH