Error occurred while removing instance due to neutron api updated

This is a community nova change in: nova/network/neutronv2/api.py.
https://github.com/openstack/nova/commit/
65a4a6b0085f8639de2df2ccb5a17a5449d676ae
Need driver to change to db object to nova object before call the api

Change-Id: Ia783eec434f9d167b3386e5fa58496e952dbc7b4
Closes-Bug: 1379691
This commit is contained in:
Jerry Cai 2014-10-10 16:23:12 +08:00
parent 2b7cd8b1f7
commit 5ba0fc1546

View File

@ -31,6 +31,7 @@ from nova.openstack.common import timeutils
from nova.openstack.common import loopingcall
from nova.openstack.common.loopingcall import LoopingCallDone
from nova.openstack.common import jsonutils
from nova import objects
from nova.objects import instance as instance_obj
from nova.objects import base as obj_base
from powervc.nova.driver.compute import computes
@ -628,6 +629,13 @@ class PowerVCCloudManager(manager.Manager):
local_instance.get('name'))
# delete network resource
# transfer db object to nova instance obj to meet latest community
# change
if not isinstance(local_instance, obj_base.NovaObject):
local_instance = \
objects.Instance._from_db_object(ctx,
objects.Instance(),
local_instance)
self.network_api.deallocate_for_instance(ctx, local_instance)
# Send notification about instance deletion due to sync operation