Pass the size when fetching image in xenapi driver

In commit 6e287c0f2b the fetch_to_raw
method was changed to accept the volume size so it can fail when the
image doesn't fit in the destination volume. In this commit we also
updated all the volume drivers to pass the volume size to that method so
it could perform the check. The xenapi driver missed that change.

This commit updates the xenapi driver to pass the volume size when
fetching the image to enable the introduced check.

Change-Id: I89bc4b3b1c1e6b06f5c529166cf9ffa1fe600c96
Related-Bug: #1235358
This commit is contained in:
Xavier Queralt 2013-11-22 10:39:37 +01:00
parent 653c403b04
commit c4db75abdd
2 changed files with 4 additions and 3 deletions

View File

@ -392,7 +392,7 @@ class DriverTestCase(test.TestCase):
mock, drv = self._setup_mock_driver(
'server', 'serverpath', '/var/run/sr-mount')
volume = dict(provider_location='sr-uuid/vdi-uuid')
volume = dict(provider_location='sr-uuid/vdi-uuid', size=1)
context = MockContext('token')
mock.StubOutWithMock(driver.image_utils, 'fetch_to_raw')
@ -402,7 +402,7 @@ class DriverTestCase(test.TestCase):
simple_context('device'))
driver.image_utils.fetch_to_raw(
context, 'image_service', 'image_id', 'device')
context, 'image_service', 'image_id', 'device', size=1)
mock.ReplayAll()
drv._use_image_utils_to_pipe_bytes_to_volume(

View File

@ -175,7 +175,8 @@ class XenAPINFSDriver(driver.VolumeDriver):
image_utils.fetch_to_raw(context,
image_service,
image_id,
device)
device,
size=volume['size'])
def _use_glance_plugin_to_copy_image_to_volume(self, context, volume,
image_service, image_id):