Combine multiple warning logs into one in create_ports

Change-Id: Icb2b000ce3f0f5db89e90c05cf1bc42e511fd36d
This commit is contained in:
Zhenguo Niu 2016-07-25 11:32:05 +08:00
parent d970bf56da
commit 7a2e1a248a
1 changed files with 5 additions and 2 deletions

View File

@ -227,12 +227,15 @@ class NodeInfo(object):
A warning is issued if port already exists on a node. A warning is issued if port already exists on a node.
""" """
existing_macs = []
for mac in macs: for mac in macs:
if mac not in self.ports(): if mac not in self.ports():
self._create_port(mac) self._create_port(mac)
else: else:
LOG.warning(_LW('Port %s already exists, skipping'), existing_macs.append(mac)
mac, node_info=self) if existing_macs:
LOG.warning(_LW('Did not create ports %s as they already exist'),
existing_macs, node_info=self)
def ports(self): def ports(self):
"""Get Ironic port objects associated with the cached node record. """Get Ironic port objects associated with the cached node record.