From: Xavier Queralt Date: Fri, 22 Nov 2013 09:39:37 +0000 (+0100) Subject: Pass the size when fetching image in xenapi driver X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=c4db75abddbb72ac5f717f6a9266e078b69206a8;p=openstack-build%2Fcinder-build.git Pass the size when fetching image in xenapi driver In commit 6e287c0f2bb7d4994d50f1763f412277e4dac6f7 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 --- diff --git a/cinder/tests/test_xenapi_sm.py b/cinder/tests/test_xenapi_sm.py index d619d2570..ed01dbaa6 100644 --- a/cinder/tests/test_xenapi_sm.py +++ b/cinder/tests/test_xenapi_sm.py @@ -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( diff --git a/cinder/volume/drivers/xenapi/sm.py b/cinder/volume/drivers/xenapi/sm.py index c2f53777d..f19d48054 100644 --- a/cinder/volume/drivers/xenapi/sm.py +++ b/cinder/volume/drivers/xenapi/sm.py @@ -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):