Merge "Fix backup import"
This commit is contained in:
commit
b2579a406c
@ -3666,7 +3666,9 @@ def volume_glance_metadata_delete_by_snapshot(context, snapshot_id):
|
|||||||
|
|
||||||
@require_context
|
@require_context
|
||||||
def backup_get(context, backup_id, read_deleted=None, project_only=True):
|
def backup_get(context, backup_id, read_deleted=None, project_only=True):
|
||||||
return _backup_get(context, backup_id)
|
return _backup_get(context, backup_id,
|
||||||
|
read_deleted=read_deleted,
|
||||||
|
project_only=project_only)
|
||||||
|
|
||||||
|
|
||||||
def _backup_get(context, backup_id, session=None, read_deleted=None,
|
def _backup_get(context, backup_id, session=None, read_deleted=None,
|
||||||
|
@ -26,8 +26,10 @@ from cinder import context
|
|||||||
from cinder import db
|
from cinder import db
|
||||||
from cinder.db.sqlalchemy import api as sqlalchemy_api
|
from cinder.db.sqlalchemy import api as sqlalchemy_api
|
||||||
from cinder import exception
|
from cinder import exception
|
||||||
|
from cinder import objects
|
||||||
from cinder import quota
|
from cinder import quota
|
||||||
from cinder import test
|
from cinder import test
|
||||||
|
from cinder.tests.unit import fake_constants
|
||||||
|
|
||||||
THREE = 3
|
THREE = 3
|
||||||
THREE_HUNDREDS = 300
|
THREE_HUNDREDS = 300
|
||||||
@ -2010,6 +2012,18 @@ class DBAPIBackupTestCase(BaseTest):
|
|||||||
backup_get = db.backup_get(self.ctxt, backup['id'])
|
backup_get = db.backup_get(self.ctxt, backup['id'])
|
||||||
self._assertEqualObjects(backup, backup_get)
|
self._assertEqualObjects(backup, backup_get)
|
||||||
|
|
||||||
|
def test_backup_get_deleted(self):
|
||||||
|
backup_dic = {'user_id': 'user',
|
||||||
|
'project_id': 'project',
|
||||||
|
'volume_id': fake_constants.volume_id,
|
||||||
|
'size': 1,
|
||||||
|
'object_count': 1}
|
||||||
|
backup = objects.Backup(self.ctxt, **backup_dic)
|
||||||
|
backup.create()
|
||||||
|
backup.destroy()
|
||||||
|
backup_get = db.backup_get(self.ctxt, backup.id, read_deleted='yes')
|
||||||
|
self.assertEqual(backup.id, backup_get.id)
|
||||||
|
|
||||||
def tests_backup_get_all(self):
|
def tests_backup_get_all(self):
|
||||||
all_backups = db.backup_get_all(self.ctxt)
|
all_backups = db.backup_get_all(self.ctxt)
|
||||||
self._assertEqualListsOfObjects(self.created, all_backups)
|
self._assertEqualListsOfObjects(self.created, all_backups)
|
||||||
|
Loading…
Reference in New Issue
Block a user