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 <arun.mani@in.ibm.com>
This commit is contained in:
Arun Mani 2019-03-13 05:29:04 -05:00
parent 4685d5fbc7
commit 6c2a535a22
1 changed files with 6 additions and 4 deletions

View File

@ -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