Added some validations loggs for site model

During drydock node deployments, sometimes MaaS node deployment for
some nodes fails when the node tries to pull the node bootaction
files, using drydock api.
Drydock api call fails with `500 Internal Server Error`, when
drydock tries to create the booaction files for the node. The logs,
however do no provide any additional clues on what caused drydock to
fail. This issue does not happen always, and subsequent site updates
will most of the deploy the failed nodes.

The additional checks and logs are added to help pinpoint the root cause
of the 500 return code, if/when this issue heppens again.

This ps also, uplifted `MarkupSafe` pip library from 1.0 to 1.1.1 to
address the issue with MarkupSafe and latest version of setuptools
described here: https://github.com/pallets/markupsafe/issues/116

Change-Id: I08a088d9690d8d9dd1f771dc5e84d1eb02fbd39f
This commit is contained in:
Mahmoudi, Ahmad (am495p) 2020-07-21 18:58:06 +00:00
parent 63f7783da2
commit 5063769796
2 changed files with 52 additions and 32 deletions

View File

@ -642,35 +642,55 @@ class Orchestrator(object):
:param site_design: a populated instance of objects.SiteDesign
"""
self.logger.info("Rendering routes for network route domains.")
if site_design.networks is not None:
routedomains = dict()
for n in site_design.networks:
if n.routedomain is not None:
if n.routedomain not in routedomains:
self.logger.debug("Adding routedomain %s to render map."
% n.routedomain)
routedomains[n.routedomain] = list()
routedomains[n.routedomain].append(n)
for rd, nl in routedomains.items():
rd_cidrs = [n.cidr for n in nl]
self.logger.debug("Target CIDRs for routedomain %s: %s" %
(rd, ','.join(rd_cidrs)))
if 'networks' in site_design:
if site_design.networks is not None:
routedomains = dict()
for n in site_design.networks:
gw = None
metric = None
for r in n.routes:
if 'routedomain' in r and r.get('routedomain',
None) == rd:
gw = r.get('gateway')
metric = r.get('metric')
self.logger.debug(
"Use gateway %s for routedomain %s on network %s."
% (gw, rd, n.get_name()))
break
if gw is not None and metric is not None:
for cidr in rd_cidrs:
if cidr != n.cidr:
n.routes.append(
dict(
subnet=cidr, gateway=gw,
metric=metric))
if 'routedomain' in n:
if n.routedomain is not None:
if n.routedomain not in routedomains:
self.logger.debug(
"Adding routedomain %s to render "
"map." % n.routedomain)
routedomains[n.routedomain] = list()
routedomains[n.routedomain].append(n)
else:
msg = "Invalid network model: {}. Cannot find "\
"routedomain field in network: {}.".format(
n.name, n.url)
raise errors.OrchestratorError(msg)
for rd, nl in routedomains.items():
rd_cidrs = [n.cidr for n in nl]
self.logger.debug("Target CIDRs for routedomain "
"%s: %s" % (rd, ','.join(rd_cidrs)))
for n in site_design.networks:
gw = None
metric = None
if 'routes' in n and n.routes is not None:
for r in n.routes:
if 'routedomain' in r and r.get('routedomain',
None) == rd:
gw = r.get('gateway')
metric = r.get('metric')
self.logger.debug(
"Use gateway %s for routedomain %s "
"on network %s." % (gw, rd,
n.get_name()))
break
if gw is not None and metric is not None:
for cidr in rd_cidrs:
if cidr != n.cidr:
n.routes.append(
dict(
subnet=cidr, gateway=gw,
metric=metric))
else:
msg = "Invalid network model: {}. Cannot find " \
"routes field in network with routedomain: " \
"{}.".format(n.name, n.url)
self.logger.error(msg)
else:
msg = "Invalid site_design model. Cannot find networks field in " \
"site_design."
self.logger.error(msg)

View File

@ -24,7 +24,7 @@ keystonemiddleware==4.9.1
kombu==4.2.1
libvirt-python==3.10.0
Mako==1.0.7
MarkupSafe==1.0
MarkupSafe~=1.1.1
monotonic==1.5
msgpack==0.5.6
netaddr==0.7.19