Check for VM ERROR state rather than FAILED
Check for VM status of ERROR rather than FAILED in nova benchmark utils. Also a simple unit test to validate the status is detected. Closes-Bug: 1240093 Change-Id: Id1f9f66f6bfc9bb1e37a0b151d330193a20f225d
This commit is contained in:
@@ -30,7 +30,7 @@ def _resource_is(status):
|
||||
|
||||
def _get_from_manager(resource):
|
||||
resource = resource.manager.get(resource)
|
||||
if resource.status == "FAILED":
|
||||
if resource.status == "ERROR":
|
||||
raise rally_exceptions.GetResourceFailure()
|
||||
return resource
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# Copyright 2013: Mirantis Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
@@ -16,6 +15,7 @@
|
||||
import mock
|
||||
|
||||
from rally.benchmark.scenarios.nova import utils
|
||||
from rally import exceptions as rally_exceptions
|
||||
from rally import test
|
||||
|
||||
|
||||
@@ -43,6 +43,13 @@ class FakeServer(FakeResource):
|
||||
self.status = "SUSPENDED"
|
||||
|
||||
|
||||
class FakeFailedServer(FakeResource):
|
||||
|
||||
def __init__(self, manager=None):
|
||||
super(FakeFailedServer, self).__init__(manager)
|
||||
self.status = "ERROR"
|
||||
|
||||
|
||||
class FakeImage(FakeResource):
|
||||
pass
|
||||
|
||||
@@ -75,6 +82,12 @@ class FakeServerManager(FakeManager):
|
||||
pass
|
||||
|
||||
|
||||
class FakeFailedServerManager(FakeServerManager):
|
||||
|
||||
def create(self, name, image_id, flavor_id):
|
||||
return FakeFailedServer(self)
|
||||
|
||||
|
||||
class FakeImageManager(FakeManager):
|
||||
|
||||
def create(self):
|
||||
@@ -118,6 +131,12 @@ class NovaScenarioTestCase(test.NoDBTestCase):
|
||||
self.assertEqual(len(name), length)
|
||||
self.assertTrue(name.isalpha())
|
||||
|
||||
def test_failed_server_status(self):
|
||||
server_manager = FakeFailedServerManager()
|
||||
self.assertRaises(rally_exceptions.GetResourceFailure,
|
||||
utils._get_from_manager,
|
||||
server_manager.create('fails', '1', '2'))
|
||||
|
||||
def test_server_helper_methods(self):
|
||||
|
||||
rally_utils = "rally.benchmark.scenarios.nova.utils.utils"
|
||||
|
||||
Reference in New Issue
Block a user