devstack/lib/cinder_backups/swift
Hironori Shiina 01a84d2d03 Configure Cinder backup driver
This patch adds a new environment variable, CINDER_BACKUP_DRIVER for
configuring cinder backup driver used when c-bak service is enabled.
This gets cinder backup driver configurable with a similar pattern to
cinder backends. Although the current configurable backup drivers don't
need cleanup functions, the interface for cleanup is prepared for the
future.

The following backup drivers can be configured:
  swift:
  This is the default backup driver.
  ceph:
  This already can be configured if ceph backend driver is enabled. For
  backward compatibility, ceph backup driver is used if ceph backend
  driver is enabled and no backup driver is specified.
  s3_swift:
  The s3 backup driver gets configurable with this patch. By specifying
  's3_swift', the driver is configured for swift s3api.

In the future, lib/cinder_backups/s3 should be created separatedly for
external S3 compatible storage. This file will just set given parameters
such as a URL and credentials.

Change-Id: I356c224d938e1aa59c8589387a03682b3ec6e23d
2021-03-31 15:12:25 -04:00

39 lines
954 B
Bash

#!/bin/bash
#
# lib/cinder_backups/swift
# Configure the swift backup driver
# Enable with:
#
# CINDER_BACKUP_DRIVER=swift
# Dependencies:
#
# - ``functions`` file
# - ``cinder`` configurations
# Save trace setting
_XTRACE_CINDER_SWIFT=$(set +o | grep xtrace)
set +o xtrace
function configure_cinder_backup_swift {
# NOTE(mriedem): The default backup driver uses swift and if we're
# on a subnode we might not know if swift is enabled, but chances are
# good that it is on the controller so configure the backup service
# to use it.
iniset $CINDER_CONF DEFAULT backup_driver "cinder.backup.drivers.swift.SwiftBackupDriver"
iniset $CINDER_CONF DEFAULT backup_swift_url "$SWIFT_SERVICE_PROTOCOL://$SERVICE_HOST:$SWIFT_DEFAULT_BIND_PORT/v1/AUTH_"
}
# init_cinder_backup_swift: nothing to do
# cleanup_cinder_backup_swift: nothing to do
# Restore xtrace
$_XTRACE_CINDER_SWIFT
# Local variables:
# mode: shell-script
# End: