Creating custom OS templates repository

From ISPWiki
Jump to: navigation, search

Hierarchy: VMmanager KVM -> OS templates section
VMmanager Cloud -> OS templates section

Current versions (after 5.57)

A repository directory on the server should contain the following files:

  • metadata.xml is the main file describing a repository. It is used for getting information about templates.
  • A file with tar.gz template archives. They also include the metainfo.xml template description file.
    Archives for VMmanager-OVZ should not contain description (this is a standard OpenVZ template, which can be located anywhere (specified in metadata.xml)

Contents of the metadata.xml file

This is an XML file with elem elements for every template. Every elem contains a simplified description from metainfo.xml from the template (except for VMmanager-OVZ templates)

VMmanager-OVZ templates - the create-metainfo="yes" attribute should be set for the elem element

Elements within the elem element:

  • The osname element - a template name
  • The support element - a group of elem elements with names of software products that can use this template
  • The tags element - template tags
  • The version element - version of the template API required for this template
  • The type element - a template type. Only for DCImanager. Possible values: ostemplate, diag, rescue, serversearch
  • The filename element - a template file name. Only for VMmanager and DCImanager
  • The externals element - Only for VMmanager-OVZ . The element with the elem element in its turn contains the url element. The url element contains a URL to archive in a standard OpenVZ format.
  • The utcmtime element - template modification time

An 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>

Old versions (before 5.57)

In order to add a custom repository, create a directory will the following files:

  • repo.info - defines if that URL is the OS templates repository; this file must contain only one record: "ISPsystem OSTemplate"
  • oslist - contains a list of available OS templates in the format "template_name date time", where
    • template_name - name of the file with xml description of the template (without extension)
    • date - datw YYYY-ММ-DD
    • time - time HH:ММ:SS

Note: A template name and data must be separated by the tab symbol; date and time must be space separated!

  • one or several files with xml description of the template,the name format: "template_name.xml"

Example of the direcoty's contents:

-rw-rw-r-- 1 root root 442 Aug 19 09:00 VEDebian-6-i386-minimal.xml
-rw-r--r-- 1 root root 892 Aug 21 05:05 oslist
-rw-rw-r-- 1 root root  21 Mar 14 12:17 repo.info

Contents of the repo.info file:

ISPsystem OSTemplate

Contents of the oslist file:

VEDebian-6-i386-minimal 2013-08-19 09:00:00

Contents of the VEDebian-6-i386-minimal.xml file:

 <?xml version="1.0"?>
 <doc>
        <osname>Debian-6.0-i386-minimal</osname>
        <support>
                <elem>VEmgr</elem>
        </support>
        <ignore-content>yes</ignore-content>
        <externals>
                <elem>
                        <url>http://example.com/templates/debian-6.0-i386-minimal.tar.gz</url>
                </elem>
        </externals>
 </doc>