diff --git a/nova/tests/virt/powervm/test_powervm.py b/nova/tests/virt/powervm/test_powervm.py index 720a328dbb..249aa11bbb 100644 --- a/nova/tests/virt/powervm/test_powervm.py +++ b/nova/tests/virt/powervm/test_powervm.py @@ -811,6 +811,57 @@ class PowerVMDriverTestCase(test.TestCase): 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, + self.powervm_connection.plug_vifs, + instance=None, network_info=None) + + def test_reboot(self): + # Check to make sure the method raises NotImplementedError. + self.assertRaises(NotImplementedError, self.powervm_connection.reboot, + context=None, instance=None, network_info=None, + reboot_type='SOFT') + + def test_manage_image_cache(self): + # Check to make sure the method passes (does nothing) since + # it's not implemented in the powervm driver and it passes + # in the driver base class. + self.powervm_connection.manage_image_cache(context.get_admin_context(), + True) + + def test_init_host(self): + # Check to make sure the method passes (does nothing) since + # it simply passes in the powervm driver but it raises a + # NotImplementedError in the base driver class. + self.powervm_connection.init_host(host='fake') + + def test_pause(self): + # Check to make sure the method raises NotImplementedError. + self.assertRaises(NotImplementedError, self.powervm_connection.pause, + instance=None) + + def test_unpause(self): + # Check to make sure the method raises NotImplementedError. + self.assertRaises(NotImplementedError, self.powervm_connection.unpause, + instance=None) + + def test_suspend(self): + # Check to make sure the method raises NotImplementedError. + self.assertRaises(NotImplementedError, self.powervm_connection.suspend, + instance=None) + + def test_resume(self): + # Check to make sure the method raises NotImplementedError. + self.assertRaises(NotImplementedError, self.powervm_connection.resume, + instance=None, network_info=None) + + def test_host_power_action(self): + # Check to make sure the method raises NotImplementedError. + self.assertRaises(NotImplementedError, + self.powervm_connection.host_power_action, + host='fake', action='die!') + class PowerVMDriverLparTestCase(test.TestCase): """Unit tests for PowerVM connection calls.""" diff --git a/nova/virt/powervm/driver.py b/nova/virt/powervm/driver.py index 13a0f3c9f4..f1f1fb3b79 100755 --- a/nova/virt/powervm/driver.py +++ b/nova/virt/powervm/driver.py @@ -62,10 +62,6 @@ class PowerVMDriver(driver.ComputeDriver): super(PowerVMDriver, self).__init__(virtapi) self._powervm = operator.PowerVMOperator() - @property - def host_state(self): - pass - def init_host(self, host): """Initialize anything that is necessary for the driver to function, including catching up with currently running VM's on the given host. @@ -94,7 +90,9 @@ class PowerVMDriver(driver.ComputeDriver): return self._powervm.get_host_uptime(host) def plug_vifs(self, instance, network_info): - pass + """Plug VIFs into networks.""" + raise NotImplementedError(_("Network injection is not supported by the" + "PowerVM driver.")) def macs_for_instance(self, instance): return self._powervm.macs_for_instance(instance) @@ -121,7 +119,8 @@ class PowerVMDriver(driver.ComputeDriver): :param bad_volumes_callback: Function to handle any bad volumes encountered """ - pass + raise NotImplementedError(_("Reboot is not supported by the" + "PowerVM driver.")) def get_host_ip_addr(self): """Retrieves the IP address of the hypervisor host.""" @@ -186,11 +185,13 @@ class PowerVMDriver(driver.ComputeDriver): def suspend(self, instance): """suspend the specified instance.""" - pass + raise NotImplementedError(_("Suspend is not supported by the" + "PowerVM driver.")) def resume(self, instance, network_info, block_device_info=None): """resume the specified instance.""" - pass + raise NotImplementedError(_("Resume is not supported by the" + "PowerVM driver.")) def power_off(self, instance): """Power off the specified instance.""" @@ -207,7 +208,8 @@ class PowerVMDriver(driver.ComputeDriver): def host_power_action(self, host, action): """Reboots, shuts down or powers up the host.""" - pass + raise NotImplementedError(_("Host power action is not supported by the" + "PowerVM driver.")) def legacy_nwinfo(self): """ @@ -215,17 +217,6 @@ class PowerVMDriver(driver.ComputeDriver): """ return False - def manage_image_cache(self, context, all_instances): - """ - Manage the driver's local image cache. - - Some drivers chose to cache images for instances on disk. This method - is an opportunity to do management of that cache which isn't directly - related to other calls into the driver. The prime example is to clean - the cache and remove images which are no longer of interest. - """ - pass - def migrate_disk_and_power_off(self, context, instance, dest, instance_type, network_info, block_device_info=None):