VCS integration with SystemD services or mounts

Article: 100051394
Last Published: 2022-01-11
Ratings: 3 0
Product(s): InfoScale & Storage Foundation

Problem

If there are VCS resources that require mounts that are not managed by VCS [ entries in /etc/fstab], it will be necessary to make VCS dependent on the mount within VCS. Doing so will ensure these units are started before the VCS service itself has started. 

Error Message

Issues may be encountered during startup or shutdown if scripts are located under a local filesystem as these systems may get started or shut down before VCS has finished its activities.

Cause

By default, SystemD attempts to start and stop services in parallel. To avoid this a system administrator needs to add drop-ins with dependencies on a service/mount.

Solution

There are two solutions:

  1. Use the VCS generator script, this attempts to automate everything at boot time.
  2. Use the vrts-systemd.sh / manual method for creating the necessary "conf" file

1. VCS generator script:

Please note that this has not been fully tested. Internally this has worked and returned the mappings. The generator script checks entries in the /etc/fstab and cross-checks if the mount point locations are defined in the VCS main.cf.

It is also possible to add mounts that are in the /etc/fstab ( but not configured in the main.cf ) by including these in the vcs_vols attribute which is located in the /etc/vx/systemd/system.conf.

If the system.conf is not there, it will need to be included in the VxVM/Systemd integration as per the following knowledge document: https://www.veritas.com/support/en_US/article.100034008.  Alternatively, if VxVM volumes are not being used in the /etc/fstab, the system.conf file can be created manually.

In both scenarios vcs_vols="" entry will need to be manually added to the /etc/vx/systemd.conf file as well as including the additional mount points.

Example:

vcs_vols="/home /test"

The generator scripts will work with LVM and VxVM devices that are listed in the /etc/fstab.

The script has been attached below.

The generator script  will need to be provided to the customer for them to copy to their system(s)

  1. cp systemd-fstab-vcs-generator.txt /etc/systemd/system-generators/systemd-fstab-vcs-generator
  2. chmod 755 /etc/systemd/system-generators/systemd-fstab-vcs-generator 
  3. systemctl daemon-reload

2. vrts-systemd.sh/manual method:

If the /etc/fstab file contains volumes that VCS resources may require, please apply the SystemD/VxVM integration script:

https://www.veritas.com/support/en_US/article.100034008

Once this has been applied the vrts-systemd.sh script can be run to help automate this.

The following options will need to be provided to vrts-systemd.sh

-e - enable a service integration

-c <service> - use this to set-up your own service along with -m to be dependent on the /dev/vx/dsk mounts

-m - use this with -c for the custom services. you pass in the necessary dependent mounts, use comma [,] as the separator

 

Example:

Running the script without the "-m" will bring up VxVM volumes that can be linked

# ./vrts-systemd.sh -ec vcs 

Veritas: enabled the vcs.service dependencies, please wait...

Please specify one or mount points belonging to  /dev/vx/dsk devices within you /etc/fstab that your: vcs.service

is dependent on to be mounted and set this using the -m with comma [,] as the separator.

These are the current /dev/vx/dsk devices within the /etc/fstab

Device                                                       Mount

/dev/vx/dsk/rawdg/vol1                                       /vol1

/dev/vx/dsk/rawdg/vol2                                       /vol2

If VCS resources requires /vol1 and /vol2 to be mounted then these can be both supplied to the -m line using comma-separator, please see: https://www.veritas.com/support/en_US/article.100043580

# ./vrts-systemd.sh -ec vcs  -m /vol1,/vol2

Veritas: enabled the vcs.service dependencies, please wait...

Once this has been applied, check the dependency listing

# systemctl list-dependencies vcs.service

vcs.service

├─CmdServer.service

├─system.slice

├─vol1.mount

├─vol2.mount

└─basic.target

A drop-in configuration file is now created as shown using "systemctl cat vcs.service:

 

# systemctl cat vcs.service

# /usr/lib/systemd/system/vcs.service

# $Copyright: Copyright (c) 2017 Veritas Technologies LLC.

# All rights reserved.

..

# /etc/systemd/system/vcs.service.d/order-after-vxvm.conf

[Unit]

Requires=vol1.mount vol2.mount

After=vol1.mount vol2.mount

 

If there are VCS resources that are dependent on LVM volumes, then the drop-in configuration file will need to be created manually.

# mkdir -p /etc/systemd/system/vcs.service.d/

# vi /etc/systemd/system/vcs.service.d/order-after-lvm.conf

Add the following three lines to this file [assuming /home is the required mount, please replace with the required mount]

[Unit]

Requires=home.mount 

After=home.mount

Note: the system daemon will need to be reloaded for the changes to be picked up.

# systemctl daemon-reload

# systemctl list-dependencies vcs.service

  │ ├─local-fs.target

  │ │ ├─-.mount

  │ │ ├─home.mount

 

Was this content helpful?