From c0a07b697e7321ea66ed5c46970bbee63899a8fb Mon Sep 17 00:00:00 2001
From: James McCarthy <james.m.mccarthy@oracle.com>
Date: Thu, 10 Nov 2016 15:21:37 +0000
Subject: [PATCH] Add more options for cinder-backup.

This commit brings necessary configuration and container start-up
options to use two popular backends for backup - nfs and swift.
Both drivers support incremental backups and should work with any
cinder volume backend.

Change-Id: Ieed29a895dc1b9faad196e160a88ea9d293f9c75
---
 ansible/group_vars/all.yml                    |  3 +++
 ansible/roles/cinder/templates/cinder.conf.j2 | 13 +++++++++++++
 etc/kolla/globals.yml                         |  5 +++--
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml
index ca2c0c5be..b510f9dca 100644
--- a/ansible/group_vars/all.yml
+++ b/ansible/group_vars/all.yml
@@ -370,6 +370,9 @@ gnocchi_backend_storage: "{{ 'ceph' if enable_ceph|bool else 'file' }}"
 #################################
 cinder_backend_ceph: "{{ enable_ceph }}"
 cinder_volume_group: "cinder-volumes"
+cinder_backup_driver: "nfs"
+cinder_backup_share: ""
+cinder_backup_mount_options_nfs: ""
 
 #######################
 # Cloudkitty options
diff --git a/ansible/roles/cinder/templates/cinder.conf.j2 b/ansible/roles/cinder/templates/cinder.conf.j2
index 16f07b976..a5bdbe8ae 100644
--- a/ansible/roles/cinder/templates/cinder.conf.j2
+++ b/ansible/roles/cinder/templates/cinder.conf.j2
@@ -32,6 +32,19 @@ backup_ceph_pool = {{ ceph_cinder_backup_pool_name }}
 backup_ceph_stripe_unit = 0
 backup_ceph_stripe_count = 0
 restore_discard_excess_bytes = true
+{% elif cinder_backup_driver == "nfs"%}
+backup_driver = cinder.backup.drivers.nfs
+backup_mount_options = {{ cinder_backup_mount_options_nfs }}
+backup_mount_point_base = /var/lib/cinder/backup
+backup_share = {{ cinder_backup_share }}
+backup_file_size = 327680000
+{% elif cinder_backup_driver == "swift"%}
+backup_driver = cinder.backup.drivers.swift
+backup_swift_url = http://{{ kolla_internal_vip_address }}:{{ swift_proxy_server_port }}/v1/AUTH_
+backup_swift_auth = per_user
+backup_swift_auth_version = 1
+backup_swift_user =
+backup_swift_key =
 {% endif %}
 
 osapi_volume_listen = {{ api_interface_address }}
diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml
index f5c9f2ada..3165c21c9 100644
--- a/etc/kolla/globals.yml
+++ b/etc/kolla/globals.yml
@@ -212,9 +212,10 @@ kolla_internal_vip_address: "10.10.10.254"
 #################################
 # Enable / disable Cinder backends
 #cinder_backend_ceph: "{{ enable_ceph }}"
-
 #cinder_volume_group: "cinder-volumes"
-
+#cinder_backup_driver: "nfs"
+#cinder_backup_share: ""
+#cinder_backup_mount_options_nfs: ""
 
 #########################
 # Nova - Compute Options
-- 
GitLab