How to implement time synchronisation between CHARON-AXP Host OS and Guest OS (sync_to_host)

Table of contents

Description

This document will explain how to implement the time synchronization feature using the "sync_to_host" parameter in the configuration file. This parameter allows to keep TOY time always synchronized with the host's time and disable undesirable updates to the TOY from guest OS.

Restrictions: Minimum product versions/builds required:

  • Windows:
    • Charon-AXP V4.4 Build 148-02 with patch 148-09 installed
    • Charon-AXP V4.6 Build 166-03 and later
    • Note: Charon-AXP V4.5 Build 153-03 and 153-05 (patched) are not supported
  • Linux:
    • Charon-AXP V4.6 Build 168-03 and later

Step-by-step guide

Configuration file settings

Update the configuration file with the following settings:

Syntax:

set TOY sync_to_host = "{as_vms | as_tru64 | as_is}[, nowrite]"

(warning) If "sync_to_host" parameter is specified there is no need to specify "container" parameter in addition.

where:

ParameterDescription
as_vmsIf the guest OS is OpenVMS/AXP and its date and time must be set to the host's date and time each time it boots.
as_tru64If the guest OS is Tru64 UNIX and its date and time must be set to the host's date and time each time it boots.
as_isIf the TOY date and time must be set to the host's UTC date and time
nowrite

Forbid updates to the TOY from the guest OS

(info) If you want guest to synchronize itself using DTSS or NTP for example, remove "nowrite"

Example:

set TOY sync_to_host = "as_vms, nowrite"


To synchronize the guest OS with TOY, use the following commands (from "SYSTEM"/"root" account):

On OpenVMS/AXPOn Tru64 UNIX

$ set time

# date -u `consvar -g date | cut -f 3 -d ' '`

The default value is "not specified" - it means that by default Charon does not synchronize its guest OS time with the Charon host time but collects date and time from the file specified with "container" parameter.

(warning) If "sync_to_host" parameter is specified there is no need to specify "container" parameter in addition.

(info) The Charon virtual machine must be restarted in order to take the new parameter into account

Virtual machine operating system settings

The commands mentioned above used to synchronize the guest OS with TOY are effective only when they are executed. To avoid time difference, these commands must be executed at specified intervals.

You will find below examples on how to implement scripts to perform time synchronization for OpenVMS and Tru64 UNIX.

(lightbulb) If you have NTP running on your OpenVMS or Tru64 UNIX system, you can keep it running even if sync_to_host is enabled

On OpenVMS/AXP

You need first to perform a manual synchronization between the Charon server and the Charon virtual machine using the SET TIME= command:

$ SET TIME=12:30:00

You can use either a batch queue or a detached process to synchronize time. The two methods are described below.

Using a batch queue

Create a simple script containing the following lines. The example below will sync time every hour:

(info) In our example, we will create the script in the SYS$MANAGER folder and name it CHARON_SYNCTIME.COM. The OS version used is OpenVMS 7.3-2. Its content is:

$ SET NOON
$ SET VERIFY
$LOOP:
$ SHOW TIME
$ SET TIME
$ SHOW TIME
$ WAIT 01:00:00
$ GOTO LOOP

(info) The "$ SET VERIFY" line is optional, just used for verifying commands are correctly executed


.A batch queue will be required to create the job:

  • Find an available batch queue or create a new one
  • Execute the following command to view available batch queues (refer to OpenVMS documentation)

    $ SHOW QUEUE /ALL /BATCH

    If the command returns the following error message: "%JBC-E-JOBQUEDIS, system job queue manager is not running", you will need to initialize the queue manager:

    $ START /QUEUE /MANAGER /NEW
    %%%%%%%%%%%  OPCOM  29-MAY-2015 12:30:07.36  %%%%%%%%%%%
    Message from user SYSTEM on VMS732
    %JBC-I-CREATED, SYS$COMMON:[SYSEXE]QMAN$MASTER.DAT; created

    .

  • Create a dedicated batch queue for the synchronization job (recommended):

    $ INIT /QUEUE /BATCH /START SYS$SYNCTIME /JOB_LIMIT=1
    $ SHOW QUEUE SYS$SYNCTIME /FULL
    Batch queue SYS$SYNCTIME, idle, on VMS732::
      /BASE_PRIORITY=4 /JOB_LIMIT=1 /OWNER=[SYSTEM] /PROTECTION=(S:M,O:D,G:R,W:S)

    .

  • Submit the job:

    $ SUBMIT /QUEUE=SYS$SYNCTIME SYS$MANAGER:CHARON_SYNCTIME
    Job CHARON_SYNCTIME (queue SYS$SYNCTIME, entry 1) started on SYS$SYNCTIME

    . 

  • Update the systartup script (SYS$STARTUP:SYSTARTUP_VMS.COM) to start the SYS$SYNCTIME queue and the job at system boot. The two following lines will have to be added at the very end of the script (for example):

    ...
    $ START /QUEUE SYS$SYNCTIME
    $ SUBMIT /QUEUE=SYS$SYNCTIME SYS$MANAGER:CHARON_SYNCTIME
    $
    $ EXIT

    (info) For OpenVMS version 5, the systartup script will be named: SYS$STARTUP:SYSTARTUP_V5.COM


Using a detached process

Create a simple script containing the following lines. The example below will sync time every hour
(info) In our example, we will create the script in the SYS$MANAGER folder and name it CHARON_SYNCTIME.COM. The OS version used is OpenVMS 7.3-2. Its content is:

$ SET NOON
$ SET VERIFY
$LOOP:
$ SHOW TIME
$ SET TIME
$ SHOW TIME
$ WAIT 01:00:00
$ GOTO LOOP

(info) The "$ SET VERIFY" line is optional, just used for verifying commands are correctly executed. If you let it active, please replace the "NL:" device above by a log file name


Update the systartup script (SYS$STARTUP:SYSTARTUP_VMS.COM) to start the detached process at system boot. The following lines will have to be added at the very end of the script (for example):

...
$ RUN SYS$SYSTEM:LOGINOUT /AUTHORIZE /DETACH /UIC=[SYSTEM] -
            /PROCESS_NAME="TIME SYNC" /OUTPUT=NL: /ERROR=NL: -
            /INPUT=SYS$MANAGER:CHARON_SYNCTIME.COM
$
$ EXIT


(lightbulb) To start the job manually without a reboot, just execute the line above from an interactive session.


Considerations using DECnet-Plus software

(warning) If you have DECnet-Plus software installed, you will have to disable DTSS before setting time in order to avoid errors like:

%SET-E-NOTSET, error modifying time
-SYSTEM-E-TIMENOTSET, time service enabled; enter a time service command to update the time


(lightbulb) To disable DTSS, you will have to update the CHARON_SYNCTIME.COM script:

$ SET NOON
$! SET VERIFY
$LOOP:
$ SHOW TIME
$ RUN SYS$SYSTEM:NCL
DISABLE DTSS
DELETE DTSS
EXIT
$ SET TIME
$ SHOW TIME
$ @SYS$STARTUP:DTSS$STARTUP
$ WAIT 01:00:00
$ GOTO LOOP

(lightbulb) It is recommended here not to use "SET VERIFY"


On Tru64 UNIX

Restrictions: The synchronization requires the "consvar" command to be available on the Tru64 operating system thus Tru64 UNIX version 4.0F minimum is required


You need first to perform a manual synchronization between the Charon server and the Charon virtual machine using the date command. Example:

# date -u 05291724

.

Create an entry in the root's crontab file using "crontab -e" as shown below:

...
# CHARON time sync_to_host
00 * * * * /sbin/date -u `/sbin/consvar -g date | cut -f 3 -d ' '`

(warning) Full path to date and consvar commands must be specified

(lightbulb) The above command will be executed at minute 0 of every hour. If you want to execute this every 15 minutes for example, use the following line instead:

00/15 * * * * /sbin/date -u `/sbin/consvar -g date | cut -f 3 -d ' '`

(info) More information at Wikipedia.org - Cron

Related articles



© Stromasys, 1999-2024  - All the information is provided on the best effort basis, and might be changed anytime without notice. Information provided does not mean Stromasys commitment to any features described.