Sheepdog: fix clone failure

In the case that Cinder and Glance use same Sheepdog cluster as
their backend, a image is clonable without data copying.

When image A will be cloned to volume B, the Sheepdog's internal
mecanism is following:

1. Make a snapshot C of image A using dog command.
2. Clone snapshot C to Volume B using qemu-img command.

The name of snapshot C is [image A's UUID]-temp-snapshot
So it sometimes starts with a number.
But qemu-img cannot accept such a name.

Change-Id: I20bf1dca058fef31b9f244a4fcc3800b62eadf15
Closes-Bug: #1625530
This commit is contained in:
YAMADA Hideki 2016-09-20 09:28:04 +00:00
parent 82d9b02d16
commit cc123d5ed6
2 changed files with 3 additions and 3 deletions

View File

@ -1262,7 +1262,7 @@ class SheepdogDriverTestCase(test.TestCase):
cloned_vol = self.test_data.TEST_CLONED_VOLUME
self.driver.create_cloned_volume(cloned_vol, src_vol)
snapshot_name = src_vol.name + '-temp-snapshot'
snapshot_name = 'tmp-snap-%s' % src_vol.name
fake_create_snapshot.assert_called_once_with(src_vol.name,
snapshot_name)
fake_clone.assert_called_once_with(src_vol.name, snapshot_name,
@ -1279,7 +1279,7 @@ class SheepdogDriverTestCase(test.TestCase):
fake_clone, fake_create_snapshot):
src_vol = self.test_data.TEST_VOLUME
cloned_vol = self.test_data.TEST_CLONED_VOLUME
snapshot_name = src_vol.name + '-temp-snapshot'
snapshot_name = 'tmp-snap-%s' % src_vol.name
fake_clone.side_effect = exception.SheepdogCmdError(
cmd='dummy', exit_code=1, stdout='dummy', stderr='dummy')

View File

@ -506,7 +506,7 @@ class SheepdogDriver(driver.VolumeDriver):
def create_cloned_volume(self, volume, src_vref):
"""Clone a sheepdog volume from another volume."""
snapshot_name = src_vref['name'] + '-temp-snapshot'
snapshot_name = 'tmp-snap-%s' % src_vref['name']
snapshot = {
'name': snapshot_name,
'volume_name': src_vref['name'],