Linux adaptations

For Linux systems, Google Cloud Migrate for Compute Engine (formerly Velostrata) includes some adaptation scripts in the Migrate for Compute Engine RPM installation. Rules for the Migrate for Compute Engine scripts are located here:

/opt/velostrata/actions/<PHASE>.rules

Linux system admins can also define custom scripts. The rules for these scripts are located here:

/etc/velostrata/actions/<PHASE>.rules

The rules are grouped by <PHASE>, which reflects the project phase of the VM when the script runs. <PHASE> can be one of the following values:

  • origin – The scripts run when the VM is on-premises.
  • velos – The scripts run when the VM is running in "cache on demand" mode.
  • detach – The scripts run after the detach operation.

Custom scripts are executed by the velostrata.init service on every boot. If a change needs to be made only once, the script should recognize that it has been executed previously and not perform the same change again.

Rules Definitions

Each phase applies certain rules. Rules define the actions that the service runs. Migrate for Compute Engine processes the rules in a defined order and executes each rule as provided.

Rule parameters

The following parameters for rules can be defined in each <PHASE>.rules file:

  • NAME: A unique rule name.
  • PLATFORM: Cloud or platform to run rule on (any).
  • TEST: A test for a file's existence. If a path is specified, the rule is only executed if the file and directory path exist. This parameter can also be used to check if the script was already run (by writing a file to indicate it).
  • ACTION: Bash script to run or an inline command
  • REQUIRES: Optional field for required services for rule to run (currently, only rc.local is supported).

Rule examples

# adjust network settings

NAME="fix-network-config", PLATFORM="any", TEST="", ACTION="/usr/sbin/velostrata-fix-network-config"