riase correct exception if image prop not valid

we should raise nova exception so during build, nova
compute know it's a invalid image and stop retry

Change-Id: Id106d2c70fd12ffbd924ab20cd4022a3a9899f17
(cherry picked from commit b5831e1148)
This commit is contained in:
jichenjc 2016-11-27 22:15:44 +08:00
parent 8d749b4831
commit 07bc90daf2
2 changed files with 6 additions and 4 deletions

View File

@ -4248,10 +4248,11 @@ class ZVMImageOPTestCases(ZVMTestCase):
'os_name': 'name',
'provisioning_method': 'method'}
image_meta['id'] = '0'
exc = self.assertRaises(exception.ZVMImageError,
exc = self.assertRaises(nova_exception.ImageUnacceptable,
self.imageop.zimage_check, image_meta)
msg = ("Image error: The image 0 is not a valid zVM image, "
"property ['image_type_xcat', 'os_version'] are missing")
msg = ("Image 0 is unacceptable: The image 0 is not a valid zVM "
"image, property ['image_type_xcat', 'os_version'] "
"are missing")
self.assertEqual(msg, six.text_type(exc))

View File

@ -752,7 +752,8 @@ class ZVMImages(object):
"property %(prop)s are missing") % {'id': image_meta['id'],
'prop': missing_prop})
LOG.error(msg)
raise exception.ZVMImageError(msg=msg)
raise nova_exception.ImageUnacceptable(image_id=image_meta['id'],
reason=msg)
def cleanup_image_after_migration(self, inst_name):
"""Cleanup osimages in xCAT image repository while confirm migration