Implementing Configuration

The files where you define behavior of your backup plugin are config.xmlplugin.rb, and hook-specific files. In this document, you can find an example of config.xml with a detailed description of its contents.

Create XML Configuration File


First essential component of your backup plugin is a config.xml file. This is a configuration file that controls many aspects of a backup plugin behavior. Below you can find an example of config.xml that you can refer to while creating your backup plugin. 

config.xml
<config>
  <agent>
    <xen>true</xen>
    <kvm>true</kvm>
    <vmware>true</vmware>
    <vcenter>true</vcenter>
  </agent>
  <plugin_capabilities>
    <pulling_interval>1800</pulling_interval>
    <full_machine recovery_mode='true'>true</full_machine>
    <per_vdisk>false</per_vdisk>
    <os_files_level>true</os_files_level>
  </plugin_capabilities>
  <auto_backup_presets>
    <schedule>
      <type>Hourly</type>
      <frequency>1</frequency>
      <max_recovery_points>7</max_recovery_points>
    </schedule>
  </auto_backup_presets>
  <configuration_parameters>
    <option>
      <name>Option 1</name>
      <unique_identifier>option_1</unique_identifier>
      <type>integer</type>
      <min>1</min>
      <max>10</max>
      <default>3</default>
    </option>
    <option>
      <name>Option 2</name>
      <unique_identifier>option_2</unique_identifier>
      <type>integer</type>
      <min>1</min>
      <max>10</max>
      <default>3</default>
    </option>
    <option>
      <name>Option 3</name>
      <unique_identifier>option_3</unique_identifier>
      <type>string</type>
      <regex_check>\d+</regex_check>
      <min>1</min>
      <max>10</max>
      <default>3</default>
    </option>
  </configuration_parameters>
  <scheduler_options max="1">
    <hourly max="1"/>
    <daily max="1">
      <frequency>true</frequency>
    </daily>
    <weekly max="1">
      <days_to_run>true</days_to_run>
    </weekly>
    <monthly max="1">
      <day_of_the_week_to_run>true</day_of_the_week_to_run>
      <week_of_the_month_to_run>true</week_of_the_month_to_run>
    </monthly>
    <yearly max="1"/>
  </scheduler_options>
</config>


In the following table, you can find details about configuration options that you can pass via config.xml.

Component

Element

Type

Required?

Description

agent

If at least one of
the agent elements
is set to true,
the install_agent and
uninstall_agent hooks
are required.



kvm

Boolean

Yes

The installation of a third-party agent is required on KVM-based compute resources.

xen

Boolean

Yes The installation of a third-party agent is required on Xen-based compute resources.
vmware

Boolean

Yes The installation of a third-party agent is required on VMware-based compute resources.
vcenter

Boolean

Yes

The installation of a third-party agent is required on vCenter-based compute resources.

plugin_capabilities

pulling_interval
Integer Yes

The time in seconds between pulling the status of backup jobs and the list of available recovery points.

full_machine
Boolean Yes

If a provider supports a full virtual server backup and recovery, set to true, otherwise, set to false.

Attributes:

Before restoration from a recovery point, virtual servers should be rebooted in recovery mode. For this, set the recovery_mode attribute to true for VSs to be rebooted in recovery mode. The reboot in recovery mode is currenly available for virtual servers that are built on KVM and Xen compute resources.

per_vdisk
Boolean Yes If a provider supports backup and recovery for each vDisk on a virtual server, set to true, otherwise, set to false.
os_files_level
Boolean Yes

If a provider supports backup and recovery at an OS file level, set to true, otherwise, set to false. When set to true, the os_files_level element requires the following hooks:

  • file_entries
  • restore_file_entries

auto_backup_presets

schedules
Array<schedule> Yes

The component allows setting default schedules for auto backup presets. The schedules included into auto_backup_presets are created automatically on a backup resource.

schedule

type 
String Yes

The type of a schedule that can be the following:

  • Hourly
  • Daily
  • Weekly

  • Monthly

  • Yearly

start_time
Integer Yes The start time for running backups specified using the military time, for example, 1600 that corresponds to 4:00 pm.
frequency
Integer No The frequency of how often to run daily backups. For example, set 1 to run backups every day, 2 - every second day, 3 - every third day, etc. 
days_to_run
Array<day> No The day or days of the week when to run weekly backups.
day_of_the_week_to_run
String No The days of the week when to run monthly backups (e.g. Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday).
week_of_the_month_to_run
String No The week of the month when to run monthly backups (e.g. First/Second/Third/Fourth).
max_recovery_points
Integer Yes The maximum number of recovery points for a particular schedule. The recovery point represents a point-in-time backup from which users can restore a virtual server. The max_recovery_points option is used to set a total amount of recovery points that can be created and kept for a particular backup job. When the maximum limit is reached, new recovery points overwrite the existing ones.

day

day
String Yes

The days of the week when to run weekly backups (e.g. Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday).

configuration_parameters

options
Array<option> No

The configuration_parameters component allows setting custom options for a global configuration of your backup plugin. The options that you can use here are software-specific and unique for a particular backup service. For example, you can provide an option to set a data retention period. The retention period determines the amount of time to store the historical data that can be used in data views and reports on the backup service side.

option

name
String Yes The name of the field that will be displayed in UI for this option.
unique_identifier
String Yes The unique identifier that will be used in the database to save this option when it is set.
type
String Yes

The following types can be used:

  • integer
  • string
regex_check
String No The RegExp check for values entered in a text box if the type is set to string. By default, it is blank that presupposes no check.
min
Integer No

The minimum value to be used for the slider if the type is set to integer. By default, it is '1'.

max
Integer No The maximum value to be used for the slide if the type is set to integer. By default, it is '100'.        
default
Integer No The default value to be set for the option. The value is converted to integer if the type is set to integer or to string that is shown in the text box if the type is set to string.

scheduler_options

Attributes:

You can use the max
attribute to determine
the total amount of
schedules that can be
created for a single
virtual server.
If the attribute is missing,
the amount of schedules
is unlimited.




daily
SchedulerOptionsDaily No

The daily schedule options that the backup system can handle.

Attributes:

You can use the max attribute to determine the total amount of daily schedules that can be created for a single virtual server. If the attribute is missing, the amount of schedules is unlimited.

weekly 
SchedulerOptionsWeekly No

The weekly schedule options that the backup system can handle.

Attributes:

You can use the max attribute to determine the total amount of weekly schedules that can be created for a single virtual server. If the attribute is missing, the amount of schedules is unlimited.

monthly 
SchedulerOptionsMonthly No

The monthly schedule options that the backup system can handle.

Attributes:

You can use the max attribute to determine the total amount of monthly schedules that can be created for a single virtual server. If the attribute is missing, the amount of schedules is unlimited.

daily

frequency 
Boolean No Set to true for the backup system to allow setting frequency for daily backups, otherwise, set to false.

weekly

days_to_run
Boolean No Set to true for the backup system to allow setting days of the week when to run weekly backups, otherwise, set to false.

monthly

day_of_the_week_to_run
Boolean No Set to true for the backup system to allow setting days of the week when to run monthly backups, otherwise, set to false.
week_of_the_month_to_run
Boolean No Set to true for the backup system to allow setting weeks of the month when to run monthly backups, otherwise, set to false.


What's Next?