From 49ed480765178fee601a9bfa40d14d1b4535435c Mon Sep 17 00:00:00 2001 From: terryyao Date: Mon, 26 Jan 2015 14:58:34 +0800 Subject: [PATCH] Remove configuration_data from instance.system_metadata before save For Activation Engine, instance would have a configuration_data in its system metadata, powervc driver does not need this and before save nova instance, we need to remove this system metdata. Otherwise db will not throw exception. Closes-Bug: #1410649 Change-Id: I3fef4ae8c2d99dc103164fa346a2424185e773f5 (cherry picked from commit a717ce4cec06bfb43c7b67b3b6de76924c450a31) --- nova-powervc/powervc/nova/driver/virt/powervc/driver.py | 2 ++ nova-powervc/powervc/nova/driver/virt/powervc/service.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/nova-powervc/powervc/nova/driver/virt/powervc/driver.py b/nova-powervc/powervc/nova/driver/virt/powervc/driver.py index 7949eea..e899e12 100644 --- a/nova-powervc/powervc/nova/driver/virt/powervc/driver.py +++ b/nova-powervc/powervc/nova/driver/virt/powervc/driver.py @@ -324,6 +324,8 @@ class PowerVCDriver(driver.ComputeDriver): if constants.PVC_ID in meta.keys(): del(meta[constants.PVC_ID]) instance['metadata'] = meta + # remove activation engine configuration_data as db is not allowed + instance.system_metadata.pop('configuration_data', None) instance.save() LOG.debug('Saved instance with clearing pvc_id in metadata during' 'spawn failure: %s', instance) diff --git a/nova-powervc/powervc/nova/driver/virt/powervc/service.py b/nova-powervc/powervc/nova/driver/virt/powervc/service.py index 532f77c..8fb9055 100644 --- a/nova-powervc/powervc/nova/driver/virt/powervc/service.py +++ b/nova-powervc/powervc/nova/driver/virt/powervc/service.py @@ -638,6 +638,8 @@ class PowerVCService(object): orig_instance['architecture'] = constants.PPC64 orig_instance['power_state'] = powerstate orig_instance['metadata'] = meta + # remove activation engine configuration data as db is not allowed + orig_instance.system_metadata.pop('configuration_data', None) orig_instance.save() LOG.debug('Saved instance after created PowerVC instance: %s', orig_instance)