From 83eff55604b40d9301320de663df53ba715f39d7 Mon Sep 17 00:00:00 2001 From: Saad Zaher Date: Thu, 15 Sep 2016 20:09:30 +0000 Subject: [PATCH] Fix Cinder Backups Change-Id: I48d8a8f91f8373f7e3b127ec0c4c686094642ccb dpeneds-on: Iea7f5fb0d0fb42d95e6c24d6d63693e272af3992 Closes-Bug: #1615461 --- freezer/mode/cinder.py | 37 +++++++++++++++++++++++++++++++++++++ freezer/mode/nova.py | 8 +------- freezer/openstack/backup.py | 3 ++- 3 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 freezer/mode/cinder.py diff --git a/freezer/mode/cinder.py b/freezer/mode/cinder.py new file mode 100644 index 00000000..b7b765ab --- /dev/null +++ b/freezer/mode/cinder.py @@ -0,0 +1,37 @@ +# (c) Copyright 2016 Hewlett-Packard Enterprise Development , L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from freezer.mode import mode + + +class CinderMode(mode.Mode): + """ + Execute a cinder backup + """ + def __init__(self, conf): + self.conf = conf + + @property + def name(self): + return "cinder" + + @property + def version(self): + return "1.0" + + def release(self): + pass + + def prepare(self): + pass diff --git a/freezer/mode/nova.py b/freezer/mode/nova.py index 37ea53df..6341f789 100644 --- a/freezer/mode/nova.py +++ b/freezer/mode/nova.py @@ -17,13 +17,7 @@ from freezer.mode import mode class NovaMode(mode.Mode): """ - Execute a MySQL DB backup. currently only backup with lvm snapshots - are supported. This mean, just before the lvm snap vol is created, - the db tables will be flushed and locked for read, then the lvm create - command will be executed and after that, the table will be unlocked and - the backup will be executed. It is important to have the available in - backup_args.mysql_conf the file where the database host, name, user, - password and port are set. + Execute a nova backup/restore """ def __init__(self, conf): self.conf = conf diff --git a/freezer/openstack/backup.py b/freezer/openstack/backup.py index be24c167..e199bb14 100644 --- a/freezer/openstack/backup.py +++ b/freezer/openstack/backup.py @@ -93,7 +93,8 @@ class BackupOs(object): LOG.debug("Creation temporary volume") copied_volume = client_manager.do_copy_volume(snapshot) LOG.debug("Creation temporary glance image") - image = client_manager.make_glance_image("name", copied_volume) + image = client_manager.make_glance_image(copied_volume.id, + copied_volume) LOG.debug("Download temporary glance image {0}".format(image.id)) stream = client_manager.download_image(image) package = "{0}/{1}".format(volume_id, utils.DateTime.now().timestamp)