diff options
author | Lucas Alvares Gomes <lucasagomes@gmail.com> | 2014-06-27 14:38:00 +0100 |
---|---|---|
committer | Lucas Alvares Gomes <lucasagomes@gmail.com> | 2014-06-30 10:01:51 +0100 |
commit | 301af8d4003dfe7390c7939936c3bcb2169008c4 (patch) | |
tree | e8795b16a603e50c2dc4592947a2bd544567105e /ironic/nova | |
parent | 927cf6bcbff5a367b8c31afe87e55add8acb9fe4 (diff) | |
download | ironic-301af8d4003dfe7390c7939936c3bcb2169008c4.tar.gz |
Update Nova Ironic Driver destroy() method
* Add DocString
* Add a missing parameter 'destroy_disks', although not used by Ironic
we should keep the function signature consistent with the base class.
* When calling destroy() passing an non-existent instance log a warning
message instead of debug. As suggested on the base class:
"If the instance is not found (for example if networking failed), this
function should still succeed. It's probably a good idea to log a
warning in that case."
Change-Id: I0e7d9a9e5522606bafd5ef6d9dbe525ad39026d2
Diffstat (limited to 'ironic/nova')
-rw-r--r-- | ironic/nova/virt/ironic/driver.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/ironic/nova/virt/ironic/driver.py b/ironic/nova/virt/ironic/driver.py index 3bfaa8d45..7025167e6 100644 --- a/ironic/nova/virt/ironic/driver.py +++ b/ironic/nova/virt/ironic/driver.py @@ -34,7 +34,7 @@ from nova import exception from nova.objects import flavor as flavor_obj from nova.objects import instance as instance_obj from nova.openstack.common import excutils -from nova.openstack.common.gettextutils import _ +from nova.openstack.common.gettextutils import _, _LW from nova.openstack.common import jsonutils from nova.openstack.common import log as logging from nova.openstack.common import loopingcall @@ -543,13 +543,24 @@ class IronicDriver(virt_driver.ComputeDriver): timer.start(interval=CONF.ironic.api_retry_interval).wait() def destroy(self, context, instance, network_info, - block_device_info=None): + block_device_info=None, destroy_disks=True): + """Destroy the specified instance, if it can be found. + + :param context: The security context. + :param instance: The instance object. + :param network_info: Instance network information. + :param block_device_info: Instance block device + information. Ignored by this driver. + :param destroy_disks: Indicates if disks should be + destroyed. Ignored by this driver. + + """ icli = client_wrapper.IronicClientWrapper() try: node = validate_instance_and_node(icli, instance) except exception.InstanceNotFound: - LOG.debug("Destroy called on non-existing instance %s." - % instance['uuid']) + LOG.warning(_LW("Destroy called on non-existing instance %s."), + instance['uuid']) # NOTE(deva): if nova.compute.ComputeManager._delete_instance() # is called on a non-existing instance, the only way # to delete it is to return from this method |