From a717ce4cec06bfb43c7b67b3b6de76924c450a31 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 --- 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 a1a39b1..272b28b 100644 --- a/nova-powervc/powervc/nova/driver/virt/powervc/driver.py +++ b/nova-powervc/powervc/nova/driver/virt/powervc/driver.py @@ -326,6 +326,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 352f838..0537c7d 100644 --- a/nova-powervc/powervc/nova/driver/virt/powervc/service.py +++ b/nova-powervc/powervc/nova/driver/virt/powervc/service.py @@ -606,6 +606,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)