Merge "Fixes Hyper-V resize down exception"
This commit is contained in:
commit
20991d38b2
@ -1513,7 +1513,7 @@ class HyperVAPITestCase(HyperVAPIBaseTestCase,
|
|||||||
(instance, fake_dest_ip, network_info, flavor) = args
|
(instance, fake_dest_ip, network_info, flavor) = args
|
||||||
|
|
||||||
self._mox.ReplayAll()
|
self._mox.ReplayAll()
|
||||||
self.assertRaises(vmutils.VHDResizeException,
|
self.assertRaises(exception.InstanceFaultRollback,
|
||||||
self._conn.migrate_disk_and_power_off,
|
self._conn.migrate_disk_and_power_off,
|
||||||
self._context, instance, fake_dest_ip,
|
self._context, instance, fake_dest_ip,
|
||||||
flavor, network_info)
|
flavor, network_info)
|
||||||
|
@ -18,6 +18,7 @@ Management class for migration / resize operations.
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from nova import exception
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
from nova.openstack.common import excutils
|
from nova.openstack.common import excutils
|
||||||
from nova.openstack.common import log as logging
|
from nova.openstack.common import log as logging
|
||||||
@ -102,11 +103,13 @@ class MigrationOps(object):
|
|||||||
curr_root_gb = instance['root_gb']
|
curr_root_gb = instance['root_gb']
|
||||||
|
|
||||||
if new_root_gb < curr_root_gb:
|
if new_root_gb < curr_root_gb:
|
||||||
raise vmutils.VHDResizeException(
|
raise exception.InstanceFaultRollback(
|
||||||
_("Cannot resize the root disk to a smaller size. Current "
|
vmutils.VHDResizeException(
|
||||||
"size: %(curr_root_gb)s GB. Requested size: "
|
_("Cannot resize the root disk to a smaller size. "
|
||||||
"%(new_root_gb)s GB") %
|
"Current size: %(curr_root_gb)s GB. Requested size: "
|
||||||
{'curr_root_gb': curr_root_gb, 'new_root_gb': new_root_gb})
|
"%(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,
|
def migrate_disk_and_power_off(self, context, instance, dest,
|
||||||
flavor, network_info,
|
flavor, network_info,
|
||||||
|
Loading…
Reference in New Issue
Block a user