Merge "Host aggregate configuration throws exception"

This commit is contained in:
Jenkins
2013-10-04 22:35:29 +00:00
committed by Gerrit Code Review
5 changed files with 6 additions and 54 deletions

View File

@@ -5003,6 +5003,9 @@ class ComputeManager(manager.SchedulerDependentManager):
try:
self.driver.add_to_aggregate(context, aggregate, host,
slave_info=slave_info)
except NotImplementedError:
LOG.debug(_('Hypervisor driver does not support '
'add_aggregate_host'))
except exception.AggregateError:
with excutils.save_and_reraise_exception():
self.driver.undo_aggregate_operation(
@@ -5020,6 +5023,9 @@ class ComputeManager(manager.SchedulerDependentManager):
try:
self.driver.remove_from_aggregate(context, aggregate, host,
slave_info=slave_info)
except NotImplementedError:
LOG.debug(_('Hypervisor driver does not support '
'remove_aggregate_host'))
except (exception.AggregateError,
exception.InvalidAggregateAction) as e:
with excutils.save_and_reraise_exception():

View File

@@ -797,27 +797,6 @@ class PowerVMDriverTestCase(test.TestCase):
uptime = self.powervm_connection.get_host_uptime(None)
self.assertEquals(output[0], uptime)
def test_add_to_aggregate(self):
# Simple test to make sure the unimplemented method passes.
self.powervm_connection.add_to_aggregate(context.get_admin_context(),
aggregate={'name': 'foo'},
host='fake')
def test_remove_from_aggregate(self):
# Simple test to make sure the unimplemented method passes.
self.powervm_connection.remove_from_aggregate(
context.get_admin_context(), aggregate={'name': 'foo'},
host='fake')
def test_undo_aggregate_operation(self):
# Simple test to make sure the unimplemented method passes.
def fake_operation(*args, **kwargs):
pass
self.powervm_connection.undo_aggregate_operation(
context.get_admin_context(), op=fake_operation,
aggregate={'name': 'foo'}, host='fake')
def test_plug_vifs(self):
# Check to make sure the method raises NotImplementedError.
self.assertRaises(NotImplementedError,

View File

@@ -438,12 +438,6 @@ class FakeDriver(driver.ComputeDriver):
def get_disk_available_least(self):
pass
def add_to_aggregate(self, context, aggregate, host, **kwargs):
pass
def remove_from_aggregate(self, context, aggregate, host, **kwargs):
pass
def get_volume_connector(self, instance):
return {'ip': '127.0.0.1', 'initiator': 'fake', 'host': 'fakehost'}

View File

@@ -4666,20 +4666,6 @@ class LibvirtDriver(driver.ComputeDriver):
pass
return output
def add_to_aggregate(self, context, aggregate, host, **kwargs):
"""Add a compute host to an aggregate."""
#NOTE(jogo) Currently only used for XenAPI-Pool
pass
def remove_from_aggregate(self, context, aggregate, host, **kwargs):
"""Remove a compute host from an aggregate."""
pass
def undo_aggregate_operation(self, context, op, aggregate,
host, set_error=True):
"""only used for Resource Pools."""
pass
def instance_on_disk(self, instance):
# ensure directories exist and are writable
instance_path = libvirt_utils.get_instance_path(instance)

View File

@@ -337,16 +337,3 @@ class PowerVMDriver(driver.ComputeDriver):
if power_on:
self._powervm.power_on(instance['name'])
def add_to_aggregate(self, context, aggregate, host, **kwargs):
"""Add a compute host to an aggregate."""
pass
def remove_from_aggregate(self, context, aggregate, host, **kwargs):
"""Remove a compute host from an aggregate."""
pass
def undo_aggregate_operation(self, context, op, aggregate,
host, set_error=True):
"""Undo for Resource Pools."""
pass