Raise InsufficientFreeMemory

Kind of fixes bug 851374 & bug 858679

Raises InsufficientFreeMemory if an instance can't
start because of that. This will cause the normal
instance failure recovery to catch this problem,
set the state, and log the error. This also
removes instance_set_state from db/api.py as that
was causing these exceptions in the first place.

Change-Id: I199aa6900890531b175e28c3b93d8dfb88e135d0
This commit is contained in:
Aaron Lee
2011-09-26 18:22:03 -05:00
parent 43e78edfdb
commit e47036efa1
2 changed files with 5 additions and 1 deletions

View File

@@ -818,3 +818,7 @@ class InstanceTypeMemoryTooSmall(NovaException):
class InstanceTypeDiskTooSmall(NovaException):
message = _("Instance type's disk is too small for requested image.")
class InsufficientFreeMemory(NovaException):
message = _("Insufficient free memory on compute node to start %(uuid)s.")

View File

@@ -413,7 +413,7 @@ class XenAPIVMTestCase(test.TestCase):
self.check_vm_params_for_linux()
def test_spawn_not_enough_memory(self):
self.assertRaises(Exception,
self.assertRaises(exception.InsufficientFreeMemory,
self._test_spawn,
1, 2, 3, "4") # m1.xlarge