Merge "Fixes Hyper-V resize down exception"

This commit is contained in:
Jenkins 2014-08-20 22:22:19 +00:00 committed by Gerrit Code Review
commit 20991d38b2
2 changed files with 9 additions and 6 deletions

View File

@ -1513,7 +1513,7 @@ class HyperVAPITestCase(HyperVAPIBaseTestCase,
(instance, fake_dest_ip, network_info, flavor) = args
self._mox.ReplayAll()
self.assertRaises(vmutils.VHDResizeException,
self.assertRaises(exception.InstanceFaultRollback,
self._conn.migrate_disk_and_power_off,
self._context, instance, fake_dest_ip,
flavor, network_info)

View File

@ -18,6 +18,7 @@ Management class for migration / resize operations.
"""
import os
from nova import exception
from nova.i18n import _
from nova.openstack.common import excutils
from nova.openstack.common import log as logging
@ -102,11 +103,13 @@ class MigrationOps(object):
curr_root_gb = instance['root_gb']
if new_root_gb < curr_root_gb:
raise vmutils.VHDResizeException(
_("Cannot resize the root disk to a smaller size. Current "
"size: %(curr_root_gb)s GB. Requested size: "
"%(new_root_gb)s GB") %
{'curr_root_gb': curr_root_gb, 'new_root_gb': new_root_gb})
raise exception.InstanceFaultRollback(
vmutils.VHDResizeException(
_("Cannot resize the root disk to a smaller size. "
"Current size: %(curr_root_gb)s GB. Requested size: "
"%(new_root_gb)s GB") %
{'curr_root_gb': curr_root_gb,
'new_root_gb': new_root_gb}))
def migrate_disk_and_power_off(self, context, instance, dest,
flavor, network_info,