tmp_vmdk_name = uuidutils.generate_uuid()
with self._temporary_file(suffix=".vmdk",
prefix=tmp_vmdk_name) as tmp_file_path:
- LOG.debug("Using temporary file: %(tmp_path)s for restoring "
- "backup: %(backup_id)s.",
- {'tmp_path': tmp_file_path,
- 'backup_id': backup['id']})
- with open(tmp_file_path, "wb") as tmp_file:
- LOG.debug("Calling backup service to restore backup: "
- "%(backup_id)s to file: %(tmp_path)s.",
- {'backup_id': backup['id'],
- 'tmp_path': tmp_file_path})
- backup_service.restore(backup, volume['id'], tmp_file)
- LOG.debug("Backup: %(backup_id)s restored to file: "
- "%(tmp_path)s.",
- {'backup_id': backup['id'],
- 'tmp_path': tmp_file_path})
- self._restore_backing(context, volume, backing, tmp_file_path,
- backup['size'] * units.Gi)
-
- if backup['size'] < volume['size']:
- # Current backing size is backup size.
- LOG.debug("Backup size: %(backup_size)d is less than "
- "volume size: %(vol_size)d; extending volume.",
- {'backup_size': backup['size'],
- 'vol_size': volume['size']})
- self.extend_volume(volume, volume['size'])
-
- LOG.debug("Backup: %(backup_id)s restored to volume: "
- "%(name)s.",
+ LOG.debug("Using temporary file: %(tmp_path)s for restoring "
+ "backup: %(backup_id)s.",
+ {'tmp_path': tmp_file_path,
+ 'backup_id': backup['id']})
+ with open(tmp_file_path, "wb") as tmp_file:
+ LOG.debug("Calling backup service to restore backup: "
+ "%(backup_id)s to file: %(tmp_path)s.",
{'backup_id': backup['id'],
- 'name': volume['name']})
+ 'tmp_path': tmp_file_path})
+ backup_service.restore(backup, volume['id'], tmp_file)
+ LOG.debug("Backup: %(backup_id)s restored to file: "
+ "%(tmp_path)s.",
+ {'backup_id': backup['id'],
+ 'tmp_path': tmp_file_path})
+ self._restore_backing(context, volume, backing, tmp_file_path,
+ backup['size'] * units.Gi)
+
+ if backup['size'] < volume['size']:
+ # Current backing size is backup size.
+ LOG.debug("Backup size: %(backup_size)d is less than "
+ "volume size: %(vol_size)d; extending volume.",
+ {'backup_size': backup['size'],
+ 'vol_size': volume['size']})
+ self.extend_volume(volume, volume['size'])
+
+ LOG.debug("Backup: %(backup_id)s restored to volume: "
+ "%(name)s.",
+ {'backup_id': backup['id'],
+ 'name': volume['name']})
-
- class VMwareVcVmdkDriver(VMwareEsxVmdkDriver):
- """Manage volumes on VMware vCenter server."""
-
- # Minimum supported vCenter version.
- MIN_SUPPORTED_VC_VERSION = dist_version.LooseVersion('5.1')
-
- # PBM is enabled only for vCenter versions 5.5 and above
- PBM_ENABLED_VC_VERSION = dist_version.LooseVersion('5.5')
-
- def _do_deprecation_warning(self):
- # no deprecation warning for vCenter vmdk driver
- pass
-
- def __init__(self, *args, **kwargs):
- super(VMwareVcVmdkDriver, self).__init__(*args, **kwargs)
- self._session = None
-
@property
def session(self):
if not self._session: