Use primitive object while create nova client Server object

We need to use primitive object while create nova client Server object
instead of directly using nova.object.Instance object, because the
Server object construction will mess up the nova.object.Instance change
fields, that will result in the db updating operation will not update
the field like "updated_at".

Closes-Bug: #1365895
Change-Id: Ifc8e41c753b5fa2fa73d1eb1a4c02cdcec363460
(cherry picked from commit 4ca5fa32b1)
This commit is contained in:
Terry Yao 2014-09-05 16:29:06 +08:00
parent 5fd4a78833
commit b70a11f134
1 changed files with 3 additions and 2 deletions

View File

@ -21,6 +21,7 @@ from nova.openstack.common import excutils
from powervc.nova.driver.compute import task_states
from nova.compute import flavors
from novaclient.v1_1 import servers
from nova.objects import base as objects_base
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
@ -532,8 +533,8 @@ class PowerVCService(object):
This method handles converting a a hosting instance
into an powerVC instance for nova client use.
"""
server = servers.Server(self._manager, instance)
instance_primitive = objects_base.obj_to_primitive(instance)
server = servers.Server(self._manager, instance_primitive)
# Check whether we can get the metadata from instance
key = 'metadata'