Add support for share backup/restore options

This introduces support for options used by share backup and restore
feature, which was introduced to manila recently.

This also adds support for NFS share backup driver.

Change-Id: Idf187458b62e81999874f9582f932d9707c0d8c1
This commit is contained in:
Takashi Kajinami
2023-10-06 12:30:55 +09:00
parent f319ebb145
commit 2c6e685768
7 changed files with 217 additions and 13 deletions

View File

@@ -20,17 +20,52 @@
# (Optional) Temporary path to create and mount shares during migration.
# Defaults to $facts['os_service_default'].
#
# [*backup_mount_tmp_location*]
# (Optional) Temporary path to create and mount shares during share backup.
# Defaults to $facts['os_service_default'].
#
# [*check_hash*]
# (Optional) Chooses whether hash of each file should be checked on data
# copying.
# Defaults to $facts['os_service_default'].
#
# [*backup_continue_update_interval*]
# (Optional) Interval to poll to perform the next steps of backup.
# Defaults to $facts['os_service_default'].
#
# [*restore_continue_update_interval*]
# (Optional) Interval to poll to perform the next steps of restore.
# Defaults to $facts['os_service_default'].
#
# [*backup_driver*]
# (Optional) Driver to use for backups
# Defaults to $facts['os_service_default'].
#
# [*backup_share_mount_template*]
# (Optional) The template for mounting shares during backup.
# Defaults to $facts['os_service_default'].
#
# [*backup_share_unmount_template*]
# (Optional) The template for unmounting shares during backup.
# Defaults to $facts['os_service_default'].
#
# [*backup_ignore_files*]
# (Optional) List of files and folders to be ignored when backing up shares.
# Defaults to $facts['os_service_default'].
#
class manila::data (
$package_ensure = 'present',
Boolean $enabled = true,
Boolean $manage_service = true,
$mount_tmp_location = $facts['os_service_default'],
$check_hash = $facts['os_service_default'],
$package_ensure = 'present',
Boolean $enabled = true,
Boolean $manage_service = true,
$mount_tmp_location = $facts['os_service_default'],
$backup_mount_tmp_location = $facts['os_service_default'],
$check_hash = $facts['os_service_default'],
$backup_continue_update_interval = $facts['os_service_default'],
$restore_continue_update_interval = $facts['os_service_default'],
$backup_driver = $facts['os_service_default'],
$backup_share_mount_template = $facts['os_service_default'],
$backup_share_unmount_template = $facts['os_service_default'],
$backup_ignore_files = $facts['os_service_default'],
) {
include manila::deps
@@ -45,8 +80,15 @@ class manila::data (
}
manila_config {
'DEFAULT/mount_tmp_location': value => $mount_tmp_location;
'DEFAULT/check_hash': value => $check_hash;
'DEFAULT/mount_tmp_location': value => $mount_tmp_location;
'DEFAULT/backup_mount_tmp_location': value => $backup_mount_tmp_location;
'DEFAULT/check_hash': value => $check_hash;
'DEFAULT/backup_continue_update_interval': value => $backup_continue_update_interval;
'DEFAULT/restore_continue_update_interval': value => $restore_continue_update_interval;
'DEFAULT/backup_driver': value => $backup_driver;
'DEFAULT/backup_share_mount_template': value => $backup_share_mount_template;
'DEFAULT/backup_share_unmount_template': value => $backup_share_unmount_template;
'DEFAULT/backup_ignore_files': value => join(any2array($backup_ignore_files), ',');
}
if $manage_service {

View File

@@ -0,0 +1,55 @@
# == Class: manila::data::backup::nfs
#
# Setup Manila to backup shares into NFS
#
# === Parameters
#
# [*backup_mount_export*]
# (Required) NFS backup export location.
# Defaults to $facts['os_service_default']
#
# [*backup_mount_template*]
# (Optional) The template for mounting NFS shares.
# Defaults to $facts['os_service_default']
#
# [*backup_unmount_template*]
# (Optional) The template for unmounting NFS shares.
# Defaults to $facts['os_service_default']
#
# [*backup_mount_proto*]
# (Optional) Mount Protocol for mounting NFS shares.
# Defaults to $facts['os_service_default']
#
# [*backup_mount_options*]
# (Optional) Mount ptions passed to the NFS client.
# Defaults to $facts['os_service_default']
#
# [*package_ensure*]
# (optional) Ensure state for package. Defaults to 'present'.
#
class manila::data::backup::nfs (
String[1] $backup_mount_export,
$backup_mount_template = $facts['os_service_default'],
$backup_unmount_template = $facts['os_service_default'],
$backup_mount_proto = $facts['os_service_default'],
$backup_mount_options = $facts['os_service_default'],
$package_ensure = 'present',
) {
include manila::deps
include manila::params
manila_config {
'DEFAULT/backup_mount_template': value => $backup_mount_template;
'DEFAULT/backup_unmount_template': value => $backup_unmount_template;
'DEFAULT/backup_mount_export': value => $backup_mount_export;
'DEFAULT/backup_mount_proto': value => $backup_mount_proto;
'DEFAULT/backup_mount_options': value => $backup_mount_options;
}
ensure_packages('nfs-client', {
name => $::manila::params::nfs_client_package_name,
ensure => $package_ensure,
tag => 'manila-support-package',
})
}

View File

@@ -70,6 +70,14 @@
# roll back share state.
# Defaults to $facts['os_service_default'].
#
# [*driver_backup_continue_update_interval*]
# (Optional) Interval to poll to perform the next steps of backup.
# Defaults to $facts['os_service_default'].
#
# [*driver_restore_continue_update_interval*]
# (Optional) Interval to poll to perform the next steps of restore.
# Defaults to $facts['os_service_default'].
#
class manila::share (
$package_ensure = 'present',
Boolean $enabled = true,
@@ -86,6 +94,8 @@ class manila::share (
$share_service_inithost_offload = $facts['os_service_default'],
$check_for_expired_shares_in_recycle_bin_interval = $facts['os_service_default'],
$check_for_expired_transfers = $facts['os_service_default'],
$driver_backup_continue_update_interval = $facts['os_service_default'],
$driver_restore_continue_update_interval = $facts['os_service_default'],
) {
include manila::deps
@@ -112,6 +122,8 @@ class manila::share (
'DEFAULT/share_service_inithost_offload': value => $share_service_inithost_offload;
'DEFAULT/check_for_expired_shares_in_recycle_bin_interval': value => $check_for_expired_shares_in_recycle_bin_interval;
'DEFAULT/check_for_expired_transfers': value => $check_for_expired_transfers;
'DEFAULT/driver_backup_continue_update_interval': value => $driver_backup_continue_update_interval;
'DEFAULT/driver_restore_continue_update_interval': value => $driver_restore_continue_update_interval;
}
if $manage_service {