Stop nova driver delete failure on already deleted

The nova compute driver currently raises an exception if the
instance has already been deleted.

This patch logs a warning, but does not raise an exception when
the instance being deleted is not found.

Change-Id: I72e54297b925c5c6ce0dd711a33e19afc74ba37d
Partial-Bug: #1509706
This commit is contained in:
Michael Johnson 2015-11-19 00:50:28 +00:00
parent b7f1dbc03e
commit 5a9835ccb7

View File

@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from novaclient import exceptions as nova_exceptions
from oslo_config import cfg
from oslo_log import log as logging
@ -20,7 +21,7 @@ from octavia.common import constants
from octavia.common import data_models as models
from octavia.common import exceptions
from octavia.compute import compute_base
from octavia.i18n import _LE
from octavia.i18n import _LE, _LW
LOG = logging.getLogger(__name__)
@ -93,6 +94,9 @@ class VirtualMachineManager(compute_base.ComputeBase):
'''
try:
self.manager.delete(server=compute_id)
except nova_exceptions.NotFound:
LOG.warn(_LW("Nova instance with id: %s not found. "
"Assuming already deleted."), compute_id)
except Exception:
LOG.exception(_LE("Error deleting nova virtual machine."))
raise exceptions.ComputeDeleteException()