Monday, 16 March 2015

Concepts of VZ container[with templates]

EZ templates are part and parcel of the Parallels Virtuozzo Containers philosophy because they  provide a way of sharing resources among lots of Containers, thus enabling huge savings in terms of disk space and memory. For example, when you install and cache an OS template on the Hardware Node, Parallels Virtuozzo Containers creates the  /vz/template/<name_of_the_OS> directory containing all the OS files that can be shared among Containers. When a Container based on this template is created, it contains only symlinks
to the OS template files. These symlinks occupy very little space on the hard disk. They are situated in the so-called private area of the Container. The corresponding directory is /vz/private/<CT_ID>.
The private area of a Container contains not only symlinks to the necessary template files, but also the copy-on-write area of the Container (the area for storing the  information about those changes that the Container makes to the template files; this information  pertains only to the given directory) and all the private Container files. When the Container is started, this private area is mounted as Virtuozzo File System (VZFS) to the /vz/root/<CT_ID> directory. This directory is seen as the root directory from within the Container. And, which is the pivot of it all, thanks to the VZFS, the symlinks of the Container private area are seen as real files there.

Thus, the most important directories in the /vz partition are the following:
/vz/template - contains OS and application files shared among Containers;
/vz/private - contains VZFS symlinks to template files;
/vz/root - contains Container mounted symlinks and all other Container files.

The relation of these directories may be represented as below:
/vz/template (real files) --> /vz/private (symlinks) --> /vz/root (symlinks seen as real files in / for the Container).

 1 Any EZ template should be first installed on the Hardware Node. The vzpkg install template command enables you to install OS and application EZ templates on the Node.

2 The EZ template should be cached by using the vzpkg create cache command. This step is required for OS EZ templates only. As a result of the vzpkg create cache execution, the necessary packages included in the OS EZ template are downloaded from the network repository, installed in the /vz/template/<os_name>/<os_version> directory on the Hardware Node, and a gzipped tarball for the OS EZ template is created and put to the /vz/template/cache directory.

3 Either a new Container is created on the basis of the cached OS EZ template with the vzctl create command or an application EZ template is added to any number of Containers by using the vzpkg install command. In the latter case, the necessary application files are first downloaded from the network repository and installed on the Hardware Node and then the VZFS links to the installed files are created and added to the Container private area.

4 An obsolete EZ template applied to the corresponding Container can be updated by using the vzpkg update command.

5 Any EZ template excluding OS EZ templates can be removed from the Container with the vzpkg remove command.

 6 An EZ template that is not used by any Container may be completely removed from the Hardware Node with the vzpkg remove template command.

No comments:

Post a Comment