From 6c2a535a22f2d3894bac99259dd1b355dbe3da88 Mon Sep 17 00:00:00 2001 From: Arun Mani Date: Wed, 13 Mar 2019 05:29:04 -0500 Subject: [PATCH] Fix flavorsync issue during nova-powervc startup During nova-powervc service startup, if the flavor sync fails for some reasons, the code is blowing up causing the service to get restarted abruptly. This fix is to handle the same. Change-Id: I3ce98153d0d3c0e184fd5ae44d7f0e54c19cebe2 Closes-Bug: #1819873 Signed-off-by: Arun Mani --- .../nova/driver/virt/powervc/sync/flavorsync.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nova-powervc/powervc/nova/driver/virt/powervc/sync/flavorsync.py b/nova-powervc/powervc/nova/driver/virt/powervc/sync/flavorsync.py index 88538d1..3b720b3 100644 --- a/nova-powervc/powervc/nova/driver/virt/powervc/sync/flavorsync.py +++ b/nova-powervc/powervc/nova/driver/virt/powervc/sync/flavorsync.py @@ -1,4 +1,4 @@ -# Copyright 2013 IBM Corp. +# Copyright 2013, 2019 IBM Corp. import re from eventlet import greenthread @@ -168,7 +168,7 @@ class FlavorSync(): def _insert_pvc_flavor_extraspecs(self, context, flavor, extra_specs): """ Insert the flavor and extra specs if any """ flavor_created = self._create_flavor(context, flavor) - if extra_specs: + if flavor_created and extra_specs: self._update_flavor_extraspecs(context, flavor_created.get('flavorid'), extra_specs) @@ -202,5 +202,7 @@ class FlavorSync(): flavorid=flavorid, swap=swap, rxtx_factor=rxtx_factor, is_public=is_public) - except exception.InstanceExists as err: - raise err + except Exception as exc: + LOG.error(_("Unable to sync flavor " + + str(name) + ". " + str(exc.format_message()))) + return None