Previous page

Next page

Locate page in Contents

Print this page

Customizing Container Reinstallation

The default reinstallation, as performed by the pctl reinstall command, creates a new private area for the broken Container as if it were created by the pctl create command and copies the private area of the broken Container to the /old directory in the new private area so that no file is lost. There is also a possibility of deleting the old private area altogether without copying or mounting it inside the new private area, which is done by means of the --skipbackup option. This way of reinstalling corrupted Containers might in certain cases not correspond exactly to your particular needs. It happens when you are accustomed to creating new Containers in some other way than just using the pctl create command. For example, you may install additional software licenses into new Containers, or anything else. In this case you would naturally like to perform reinstallation in such a way so that the broken Container is reverted to its original state as determined by you, and not by the default behavior of the pctl create command.

To customize reinstallation, you should write your own scripts determining what should be done with the Container when it is being reinstalled, and what should be configured inside the Container after it has been reinstalled. These scripts should be named vps.reinstall and vps.configure , respectively, and should be located in the /etc/vz/conf directory on the server. To facilitate your task of creating customized scripts, the Containers software is shipped with sample scripts that you may use as the basis of your own scripts.

When the pctl reinstall < CT_ID > command is called, it searches for the vps.reinstall and vps.configure scripts and launches them consecutively. When the vps.reinstall script is launched, the following parameters are passed to it:

--veid

The ID of the Container.

--ve_private_tmp

The path to the Container temporary private area. This path designates where a new private area is temporarily created for the Container. If the script runs successfully, this private area is mounted to the path of the original private area after the script has finished.

--ve_private

The path to the Container original private area.

You may use these parameters within your vps.reinstall script.

If the vps.reinstall script finishes successfully, the Container is started, and the vps.configure script is called. At this moment the old private area is mounted to the /old directory inside the new one irrespective of the --skipbackup option. This is done in order to let you use the necessary files from the old private area in your script, which is to be run inside the running Container. For example, you might want to copy some files from there to regular Container directories.

After the vps.configure script finishes, the old private area is either dismounted and deleted or remains mounted depending on whether the --skipbackup option was provided.

If you do not want to run these reinstallation scripts and want to stick to the default pctl reinstall behavior, you may do either of the following:

  1. Remove the vps.reinstall and vps.configure scripts from the /etc/vz/conf directory, or at least rename them;
  2. Modify the last line of the vps.reinstall script so that it would read

    exit 128

    instead of

    exit 0

The 128 exit code tells the utility not to run the scripts and to reinstall the Container with the default behavior.