Skip to content

Commit

Permalink
Get database client under try/except
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardosdias committed Sep 22, 2016
1 parent 8ebd47e commit a03ffe7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions dbaas/backup/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,14 @@ def make_instance_snapshot_backup(instance, error):

snapshot.save()

databaseinfra = instance.databaseinfra
driver = databaseinfra.get_driver()
client = driver.get_client(instance)
cloudstack_hostattr = Cloudstack_HostAttr.objects.get(
host=instance.hostname)

try:

databaseinfra = instance.databaseinfra
driver = databaseinfra.get_driver()
client = driver.get_client(instance)
cloudstack_hostattr = Cloudstack_HostAttr.objects.get(
host=instance.hostname)

LOG.debug('Locking instance %s' % str(instance))
driver.lock_database(client)
LOG.debug('Instance %s is locked' % str(instance))
Expand Down

0 comments on commit a03ffe7

Please sign in to comment.