Fix delete device bug
Device can not delete if delete instance by nova's command directly. So it's can not delete the device by neutron tacker's command, like 'neutron device-delete [id]'. I think that it is necessary to catch Instance Not Found exception and log it, finally, just return. Change-Id: I62f74056fd2b098be37eeee2804a66d2ba0accc4
This commit is contained in:
parent
28d089b00c
commit
542a52609d
@ -28,7 +28,7 @@ from keystoneclient import session as ks_session
|
||||
from oslo_config import cfg
|
||||
|
||||
from tacker.api.v1 import attributes
|
||||
from tacker.i18n import _LW
|
||||
from tacker.i18n import _LE, _LW
|
||||
from tacker.openstack.common import log as logging
|
||||
from tacker.vm.drivers import abstract_driver
|
||||
|
||||
@ -252,7 +252,12 @@ class DeviceNova(abstract_driver.DeviceAbstractDriver):
|
||||
|
||||
def delete(self, plugin, context, device_id):
|
||||
nova = self._nova_client()
|
||||
instance = nova.servers.get(device_id)
|
||||
try:
|
||||
instance = nova.servers.get(device_id)
|
||||
except self._novaclient.exceptions.NotFound:
|
||||
LOG.error(_LE("server %s is not found") %
|
||||
device_id)
|
||||
return
|
||||
instance.delete()
|
||||
|
||||
def delete_wait(self, plugin, context, device_id):
|
||||
|
Loading…
x
Reference in New Issue
Block a user