7.3. Updating Automatically¶
Starting from version 7.5, newly deployed Virtuozzo Hybrid Server nodes are configured to get updates automatically by default. Automatic updating requires a valid license to be installed. Manual updating remains possible and does not depend on license status.
Note the following, however:
Automatic updating is not enabled for nodes upgraded from older versions of Virtuozzo Hybrid Server. You can enable automatic updates for them as explained in Enabling Automatic Updates for Upgraded Nodes.
Automatic updating is disabled for Virtuozzo Storage clusters. For more information, see Updating Nodes in Virtuozzo Storage Clusters.
The following update policies are available:
fast, get updates immediately after release.
slow, get updates two weeks after release.
stable, get updates six weeks after release.
auto, a special policy that lets the Virtuozzo update server assign one of the other policies to a node.
Each node that requests updates automatically through the auto policy is registered by the Virtuozzo update server and assigned a regular update policy: fast, slow, or stable. To make automatic updating predictable, a policy is assigned to a node only once. You can change it manually, however, as explained in Changing Node Update Policy.
Each node is configured as follows during installation of Virtuozzo Hybrid Server:
The repository file
/etc/yum.repos.d/vz-auto-update.repo
is created. It lists node’s unique repositories for automatic updating. Such URLs contain a$hwid
variable that is replaced by node’s hardware ID during updates. The file also lists the static repositories for each update policy.The repositories in
/etc/yum.repos.d/vz-auto-update.repo
are disabled by default, while those in/etc/yum.repos.d/virtuozzo.repo
are enabled. This ensures that manual updating viayum update
works as usual.Note
Repositories in
/etc/yum.repos.d/virtuozzo.repo
are the same as those for the fast update policy. So runningyum update
delivers the latest updates as soon as they are released.The
vzautoupdate
tool for working with update policies is installed.The timer service
vzautoupdate.timer
is enabled and started. It will runvzautoupdate.service
daily to get updates. A schedule, i.e. the time of day to trigger an update at, is chosen randomly and written to/etc/systemd/system/vzautoupdate.timer.d/override.conf
.Automatic updating is enabled. An update policy is not assigned yet.
When the timer triggers an update, the following happens, given that node’s license is valid:
The repositories in
/etc/yum.repos.d/vz-auto-update.repo
are enabled, while those in/etc/yum.repos.d/virtuozzo.repo
are disabled.The
vzautoupdate
tool contacts the Virtuozzo update server at node’s HWID-based repository URLs.The update server checks node’s license. If an update policy has been assigned to the node, the HWID-based URL redirects to a static repository for that update policy. Otherwise, the update server registers the node and assigns a policy to it. Then the HWID-based URL redirects to a static repository for that update policy.
Note
If a license is not installed or has expired, the HWID-based repositories are skipped as unavailable and packages are not updated.
Packages are downloaded and installed as usual by
yum update
.The repositories in
/etc/yum.repos.d/vz-auto-update.repo
are disabled, while those in/etc/yum.repos.d/virtuozzo.repo
are enabled again.If an update contains a new kernel and a reboot is recommended, the tool attempts to notify the local administrator via sendmail (if it is running).
Note
The operation log is saved to /var/log/vz_auto_update.log
.
7.3.1. Enabling Automatic Updates for Upgraded Nodes¶
To enable automatic updates for a node that has been upgraded to Virtuozzo Hybrid Server 7.5, do the following:
Install the required package:
# yum install vzautoupdate
Doing so delivers the repository file
/etc/yum.repos.d/vz-auto-update.repo
and enables automatic updating.Enable and start the timer service:
# systemctl enable vzautoupdate.timer; systemctl start vzautoupdate.timer
The node will automatically request updates according to schedule. To see the schedule, run
# vzautoupdate get-schedule
You can also check /etc/systemd/system/vzautoupdate.timer.d/override.conf
.
7.3.2. Changing Node Update Policy¶
You can manually switch between automatic updating and specific update policies with vzautoupdate set-policy
.
Note
If you disable automatic updating for a node, the Virtuozzo update server will unregister that node and clear its update policy after some time.
Switching to a policy means that when you run the update tool, it will get packages from that policy’s repositories. For example, to change node update policy to stable, run
# vzautoupdate set-policy stable
If you need to check packages available for a policy, use vzautoupdate available-updates
. For example:
# vzautoupdate available-updates stable
To update packages from the selected repository, run
# vzautoupdate update
Note
Running yum update
will deliver packages from the repositories in /etc/yum.repos.d/virtuozzo.repo
. They are the same as those for the fast update policy.
To switch back to automatic updating, run
# vzautoupdate set-policy auto
If the node is still registered at the Virtuozzo update server, its update policy will be as previously assigned. Otherwise the node will get a policy according to the rules explained earlier.