The method will work fine in case of drivers not dependent
on volume properties like provider_location. It will fail to
restart in case of nfs drivers and also leave volume created as
result of clone_image functionality created in the
nfs share in dangling state after deletion as provider_location
is None. This fix requires dict of volume properties, cloned status
to be returned which facilitates passing back provider_location
in case of nfs drivers and hence resolves the issue.
bug
1200708
Change-Id: I590571e52d1c64b6dba7d7e76cd71badd74e51d1
afterwards.
"""
def fake_clone_image(volume, image_location):
- return True
+ return {'provider_location': None}, True
def fake_clone_error(volume, image_location):
raise exception.CinderException()
image service backend in use. The driver should use it
to determine whether cloning is possible.
- Returns a boolean indicating whether cloning occurred
+ Returns a dict of volume properties eg. provider_location,
+ boolean indicating whether cloning occurred
"""
- return False
+ return None, False
def backup_volume(self, context, backup, backup_service):
"""Create a new backup from an existing volume."""
self.delete_snapshot(temp_snapshot)
def clone_image(self, volume, image_location):
- return False
+ return None, False
def backup_volume(self, context, backup, backup_service):
"""Create a new backup from an existing volume."""
_, pool, image, snapshot = self._parse_location(image_location)
self._clone(volume, pool, image, snapshot)
self._resize(volume)
- return True
+ return {'provider_location': None}, True
def _ensure_tmp_exists(self):
tmp_dir = self.configuration.volume_tmp_dir
image service backend in use. The driver should use it
to determine whether cloning is possible.
- Returns a boolean indicating whether cloning occurred
+ Returns a dict of volume properties eg. provider_location,
+ boolean indicating whether cloning occurred
"""
- return False
+ return None, False
{'bootable': True})
else:
# create the volume from an image
- cloned = self.driver.clone_image(volume_ref, image_location)
+ # NOTE (singn): two params need to be returned
+ # dict containing provider_location for cloned volume
+ # and clone status
+ model_update, cloned = self.driver.clone_image(
+ volume_ref, image_location)
if not cloned:
model_update = self.driver.create_volume(volume_ref)