virt: Fix AttributeError for raw image format

Nova compute raises AttributeError on creating a new instance with raw
image format leading instance to go in to error state. This bug is
introduced by commit I34e2f29e1f068636036226a7745d88640f724d93 which
added image.file in disk api instead of image.path.

Changed image.file to image.path to fix this issue.

Closes-Bug: 1470356
Change-Id: I4a12263a992eaf8abf2e90089591051d5aa57585
This commit is contained in:
ankitagrawal 2015-07-02 03:14:57 -07:00
parent 49873d8f6d
commit 3f6df2d7c1
2 changed files with 2 additions and 3 deletions

View File

@ -168,12 +168,11 @@ class APITestCase(test.NoDBTestCase):
self.mox.StubOutWithMock(api, 'can_resize_image')
self.mox.StubOutWithMock(utils, 'execute')
self.mox.StubOutWithMock(api, 'is_image_extendable')
self.mox.StubOutWithMock(api, 'resize2fs')
api.can_resize_image(imgfile, imgsize).AndReturn(True)
utils.execute('qemu-img', 'resize', imgfile, imgsize)
api.is_image_extendable(image).AndReturn(True)
utils.execute('e2label', image.path)
api.resize2fs(imgfile, run_as_root=False, check_exit_code=[0])
self.mox.ReplayAll()

View File

@ -269,7 +269,7 @@ def is_image_extendable(image):
else:
# For raw, we can directly inspect the file system
try:
utils.execute('e2label', image.file)
utils.execute('e2label', image.path)
except processutils.ProcessExecutionError as e:
LOG.debug('Unable to determine label for image %(image)s with '
'error %(error)s. Cannot resize.',