Browse Source

Reduce info level logging output

This change reduces info level logging such that it only produces
logs when CVX state needs to be updated. Internal accounting has
been changed to DEBUG level.

Network create before change at INFO level:

31521 Arista Sync time 1590625762.4879267 last sync 1590625762.2405837 timeout 0.7526607513427734
31521 Processing create network ID: e7af8f41-89ef-4a9c-b0bf-619056e5112f
31521 create network with id e7af8f41-89ef-4a9c-b0bf-619056e5112f
31521 Requesting create Networks resource e7af8f41-89ef-4a9c-b0bf-619056e5112f
31521 Resource Networks e7af8f41-89ef-4a9c-b0bf-619056e5112f found, creating
31521 Networks resource e7af8f41-89ef-4a9c-b0bf-619056e5112f added locally
31521 create requisite tenant with id tid
31521 Requesting create Tenants resource tid
31521 Resource Tenants tid found, creating
31521 Tenants resource tid added locally
31521 Tenants resource tid requires update
31521 create requisite segment with id 253f985d-4708-4980-a298-e99489cb6a74
31521 Requesting create Segments resource 253f985d-4708-4980-a298-e99489cb6a74
31521 Resource Segments 253f985d-4708-4980-a298-e99489cb6a74 found, creating
31521 Segments resource 253f985d-4708-4980-a298-e99489cb6a74 added locally
31521 Getting PortBindings from CVX
31521 No PortBindings resources to delete
31521 Getting BaremetalPorts from CVX
31521 No BaremetalPorts resources to delete
31521 Getting VmPorts from CVX
31521 No VmPorts resources to delete
31521 Getting RouterPorts from CVX
31521 No RouterPorts resources to delete
31521 Getting DhcpPorts from CVX
31521 No DhcpPorts resources to delete
31521 Getting Baremetals from CVX
31521 No Baremetals resources to delete
31521 Getting Vms from CVX
31521 No Vms resources to delete
31521 Getting Routers from CVX
31521 No Routers resources to delete
31521 Getting Dhcps from CVX
31521 No Dhcps resources to delete
31521 Getting Segments from CVX
31521 No Segments resources to delete
31521 Getting Networks from CVX
31521 No Networks resources to delete
31521 Getting Tenants from CVX
31521 No Tenants resources to delete
31521 Getting Tenants from CVX
31521 Getting Tenants from neutron
31521 Creating Tenants resources with ids tid on CVX
31521 Tenants resources with ids tid created on CVX
31521 Getting Networks from CVX
31521 Getting Networks from neutron
31521 Creating Networks resources with ids e7af8f41-89ef-4a9c-b0bf-619056e5112f on CVX
31521 Networks resources with ids e7af8f41-89ef-4a9c-b0bf-619056e5112f created on CVX
31521 Getting Segments from CVX
31521 Getting Segments from neutron
31521 Creating Segments resources with ids 253f985d-4708-4980-a298-e99489cb6a74 on CVX
31521 Segments resources with ids 253f985d-4708-4980-a298-e99489cb6a74 created on CVX
31521 Getting Dhcps from CVX
31521 Getting Dhcps from neutron
31521 No Dhcps resources to create
31521 Getting Routers from CVX
31521 Getting Routers from neutron
31521 No Routers resources to create
31521 Getting Vms from CVX
31521 Getting Vms from neutron
31521 No Vms resources to create
31521 Getting Baremetals from CVX
31521 Getting Baremetals from neutron
31521 No Baremetals resources to create
31521 Getting DhcpPorts from CVX
31521 Getting DhcpPorts from neutron
31521 No DhcpPorts resources to create
31521 Getting RouterPorts from CVX
31521 Getting RouterPorts from neutron
31521 No RouterPorts resources to create
31521 Getting VmPorts from CVX
31521 Getting VmPorts from neutron
31521 No VmPorts resources to create
31521 Getting BaremetalPorts from CVX
31521 Getting BaremetalPorts from neutron
31521 No BaremetalPorts resources to create
31521 Getting PortBindings from CVX
31521 Getting PortBindings from neutron
31521 No PortBindings resources to create

After:

32632 Arista Sync time 1590625370.1938148 last sync 1590625369.7015142 timeout 0.5077025890350342
32632 Processing create network ID: db232697-ba88-43c0-85e2-7957cf675aca
32632 Creating Tenants resources with ids tid on CVX
32632 Tenants resources with ids tid created on CVX
32632 Creating Networks resources with ids db232697-ba88-43c0-85e2-7957cf675aca on CVX
32632 Networks resources with ids db232697-ba88-43c0-85e2-7957cf675aca created on CVX
32632 Creating Segments resources with ids 978ae7ed-718f-4d43-8c4c-f227656278fa on CVX
32632 Segments resources with ids 978ae7ed-718f-4d43-8c4c-f227656278fa created on CVX

Change-Id: I77c569870f9c1a09e4d4956c87943ebd77d7a62f
(cherry picked from commit c35fef5129)
tags/2019.1.9^0
Mitchell Jameson 1 month ago
parent
commit
6b38442e83
2 changed files with 43 additions and 43 deletions
  1. +33
    -33
      networking_arista/ml2/arista_resources.py
  2. +10
    -10
      networking_arista/ml2/arista_sync.py

+ 33
- 33
networking_arista/ml2/arista_resources.py View File

@@ -100,9 +100,9 @@ class AristaResourcesBase(object):
self.clear_neutron_data()

def update_neutron_resource(self, id, action):
LOG.info("%(pid)s Requesting %(action)s %(class)s resource %(id)s",
{'action': action, 'class': self.__class__.__name__, 'id': id,
'pid': os.getpid()})
LOG.debug("%(pid)s Requesting %(action)s %(class)s resource %(id)s",
{'action': action, 'class': self.__class__.__name__,
'id': id, 'pid': os.getpid()})
resource = self.get_db_resources(id)
if action == a_const.FULL_SYNC:
self.clear_neutron_data()
@@ -118,30 +118,30 @@ class AristaResourcesBase(object):
# worker. We force this by removing the resource to our 'view' of
# cvx resources
self.force_resource_update(id)
LOG.info("%(pid)s Resource %(class)s %(id)s found, creating",
{'class': self.__class__.__name__, 'id': id,
'pid': os.getpid()})
LOG.debug("%(pid)s Resource %(class)s %(id)s found, creating",
{'class': self.__class__.__name__, 'id': id,
'pid': os.getpid()})
self._add_neutron_resource(resource[0])
else:
LOG.info("%(pid)s Resource %(class)s %(id)s not found, deleting",
{'class': self.__class__.__name__, 'id': id,
'pid': os.getpid()})
LOG.debug("%(pid)s Resource %(class)s %(id)s not found, deleting",
{'class': self.__class__.__name__, 'id': id,
'pid': os.getpid()})
self._delete_neutron_resource(id)

def _add_neutron_resource(self, resource):
formatted_resource = self.format_for_create(resource)
resource_id = list(formatted_resource.keys())[0]
LOG.info("%(pid)s %(class)s resource %(id)s added locally",
{'class': self.__class__.__name__,
'id': resource_id,
'pid': os.getpid()})
LOG.debug("%(pid)s %(class)s resource %(id)s added locally",
{'class': self.__class__.__name__,
'id': resource_id,
'pid': os.getpid()})
# If the resource has changed, force a POST to CVX
old_resource = self.neutron_resources.get(resource_id)
if old_resource and old_resource != formatted_resource:
LOG.info("%(pid)s %(class)s resource %(id)s requires update",
{'class': self.__class__.__name__,
'id': resource_id,
'pid': os.getpid()})
if old_resource and old_resource != formatted_resource[resource_id]:
LOG.debug("%(pid)s %(class)s resource %(id)s requires update",
{'class': self.__class__.__name__,
'id': resource_id,
'pid': os.getpid()})
self.force_resource_update(resource_id)
self.neutron_resources.update(formatted_resource)

@@ -155,9 +155,9 @@ class AristaResourcesBase(object):
self.cvx_ids.add(id)
try:
del self.neutron_resources[id]
LOG.info("%(pid)s %(class)s resource %(id)s removed locally",
{'class': self.__class__.__name__, 'id': id,
'pid': os.getpid()})
LOG.debug("%(pid)s %(class)s resource %(id)s removed locally",
{'class': self.__class__.__name__, 'id': id,
'pid': os.getpid()})
except KeyError:
LOG.debug("Resource ID %(id)s already deleted locally", {'id': id})

@@ -169,10 +169,10 @@ class AristaResourcesBase(object):
return set([resource[cls.id_key]])

def get_cvx_ids(self):
LOG.info("%(pid)s Getting %(class)s from CVX",
{'class': self.__class__.__name__,
'pid': os.getpid()})
if self.cvx_data_stale:
LOG.info("%(pid)s Getting %(class)s from CVX",
{'class': self.__class__.__name__,
'pid': os.getpid()})
cvx_data = self.rpc.send_api_request(self.get_endpoint(), 'GET')
for resource in cvx_data:
self.cvx_ids |= self.get_resource_ids(resource)
@@ -189,10 +189,10 @@ class AristaResourcesBase(object):
return set(self.neutron_resources.keys())

def get_neutron_resources(self):
LOG.info("%(pid)s Getting %(class)s from neutron",
{'class': self.__class__.__name__,
'pid': os.getpid()})
if self.neutron_data_stale:
LOG.info("%(pid)s Getting %(class)s from neutron",
{'class': self.__class__.__name__,
'pid': os.getpid()})
for resource in self.get_db_resources():
self._add_neutron_resource(resource)
self.neutron_data_stale = False
@@ -239,9 +239,9 @@ class AristaResourcesBase(object):
'ids': ', '.join(str(r) for r in resource_ids_to_create),
'pid': os.getpid()})
else:
LOG.info("%(pid)s No %(class)s resources to create",
{'class': self.__class__.__name__,
'pid': os.getpid()})
LOG.debug("%(pid)s No %(class)s resources to create",
{'class': self.__class__.__name__,
'pid': os.getpid()})
return resources_to_create

def delete_cvx_resources(self):
@@ -267,9 +267,9 @@ class AristaResourcesBase(object):
'ids': ', '.join(str(r) for r in resource_ids_to_delete),
'pid': os.getpid()})
else:
LOG.info("%(pid)s No %(class)s resources to delete",
{'class': self.__class__.__name__,
'pid': os.getpid()})
LOG.debug("%(pid)s No %(class)s resources to delete",
{'class': self.__class__.__name__,
'pid': os.getpid()})
return resources_to_delete




+ 10
- 10
networking_arista/ml2/arista_sync.py View File

@@ -124,19 +124,19 @@ class AristaSyncWorker(worker.BaseWorker):
return class_map[resource_type]

def update_neutron_resource(self, resource):
LOG.info("%(pid)s %(action)s %(rtype)s with id %(id)s",
{'action': resource.action,
'rtype': resource.resource_type,
'id': resource.id,
'pid': os.getpid()})
LOG.debug("%(pid)s %(action)s %(rtype)s with id %(id)s",
{'action': resource.action,
'rtype': resource.resource_type,
'id': resource.id,
'pid': os.getpid()})
resource_class = self.get_resource_class(resource.resource_type)
resource_class.update_neutron_resource(resource.id, resource.action)
for resource_type, resource_id in resource.related_resources:
LOG.info("%(pid)s %(action)s requisite %(rtype)s with id %(id)s",
{'action': resource.action,
'rtype': resource_type,
'id': resource_id,
'pid': os.getpid()})
LOG.debug("%(pid)s %(action)s requisite %(rtype)s with id %(id)s",
{'action': resource.action,
'rtype': resource_type,
'id': resource_id,
'pid': os.getpid()})
resource_class = self.get_resource_class(resource_type)
resource_class.update_neutron_resource(resource_id,
resource.action)


Loading…
Cancel
Save