Fixing inappropriate warning log level usage 22/12522/2
authoraticig <gulsum.atici@canonical.com>
Sat, 3 Sep 2022 20:06:37 +0000 (23:06 +0300)
committeraticig <gulsum.atici@canonical.com>
Sat, 3 Sep 2022 20:17:38 +0000 (23:17 +0300)
This patch is correcting the log levels of some successful operations
as they were logged with warning level.

Change-Id: I5f572e0b9d31e32253f7fbd8d5d1da7a360e074e
Signed-off-by: aticig <gulsum.atici@canonical.com>
NG-RO/osm_ng_ro/ns.py
NG-RO/osm_ng_ro/ns_thread.py
releasenotes/notes/correcting_log_levels-ae17918a8379a4ce.yaml [new file with mode: 0644]

index 102a035..501ef03 100644 (file)
@@ -1707,7 +1707,7 @@ class Ns(object):
                     target_record_id += ".sdn"
 
                 kwargs = {}
-                self.logger.warning(
+                self.logger.debug(
                     "ns.calculate_diff_items target_item={}".format(target_item)
                 )
                 if process_params == Ns._process_flavor_params:
@@ -1716,14 +1716,12 @@ class Ns(object):
                             "db": self.db,
                         }
                     )
-                    self.logger.warning(
+                    self.logger.debug(
                         "calculate_diff_items for flavor kwargs={}".format(kwargs)
                     )
 
                 if process_params == Ns._process_vdu_params:
-                    self.logger.warning(
-                        "calculate_diff_items self.fs={}".format(self.fs)
-                    )
+                    self.logger.debug("calculate_diff_items self.fs={}".format(self.fs))
                     kwargs.update(
                         {
                             "vnfr_id": vnfr_id,
@@ -1737,7 +1735,7 @@ class Ns(object):
                             "ro_nsr_public_key": ro_nsr_public_key,
                         }
                     )
-                    self.logger.warning("calculate_diff_items kwargs={}".format(kwargs))
+                    self.logger.debug("calculate_diff_items kwargs={}".format(kwargs))
 
                 extra_dict = process_params(
                     target_item,
@@ -1875,7 +1873,7 @@ class Ns(object):
                 extra_dict=change.get("extra_dict", None),
             )
 
-            self.logger.warning("ns.define_all_tasks task={}".format(task))
+            self.logger.debug("ns.define_all_tasks task={}".format(task))
             tasks_by_target_record_id[change["target_record_id"]] = task
             db_new_tasks.append(task)
 
@@ -1959,7 +1957,7 @@ class Ns(object):
 
         for db_task in db_new_tasks:
             target_id = db_task.pop("target_id")
-            self.logger.warning("target_id={} db_task={}".format(target_id, db_task))
+            self.logger.debug("target_id={} db_task={}".format(target_id, db_task))
 
             action = db_task.get("action", None)
 
@@ -1980,7 +1978,7 @@ class Ns(object):
                 db_ro_task["vim_info"]["vim_id"] = db_task.get("vim_id", None)
 
             nb_ro_tasks += 1
-            self.logger.warning("upload_all_tasks db_ro_task={}".format(db_ro_task))
+            self.logger.debug("upload_all_tasks db_ro_task={}".format(db_ro_task))
             self.db.create("ro_tasks", db_ro_task)
 
         self.logger.debug(
index cb52d77..d1db698 100644 (file)
@@ -748,7 +748,7 @@ class VimInteractionFlavor(VimInteractionBase):
                     flavor_data = task["find_params"]["flavor_data"]
                     vim_flavor_id = target_vim.get_flavor_id_from_data(flavor_data)
                 except vimconn.VimConnNotFoundException:
-                    self.logger.exception("VimConnNotFoundException occured.")
+                    self.logger.warning("VimConnNotFoundException occured.")
 
             if not vim_flavor_id and task.get("params"):
                 # CREATE
@@ -2073,7 +2073,7 @@ class NsWorker(threading.Thread):
             "created_items", False
         )
 
-        self.logger.warning("Needed delete: {}".format(needed_delete))
+        self.logger.debug("Needed delete: {}".format(needed_delete))
         if my_task["status"] == "FAILED":
             return None, None  # TODO need to be retry??
 
@@ -2097,7 +2097,7 @@ class NsWorker(threading.Thread):
                     needed_delete = False
 
             if needed_delete:
-                self.logger.warning(
+                self.logger.debug(
                     "Deleting ro_task={} task_index={}".format(ro_task, task_index)
                 )
                 return self.item2class[my_task["item"]].delete(ro_task, task_index)
@@ -2202,7 +2202,7 @@ class NsWorker(threading.Thread):
                 fail_on_empty=False,
             )
 
-            self.logger.warning("ro_task_dependency={}".format(ro_task_dependency))
+            self.logger.debug("ro_task_dependency={}".format(ro_task_dependency))
             if ro_task_dependency:
                 for task_index, task in enumerate(ro_task_dependency["tasks"]):
                     if task["task_id"] == task_id:
@@ -2355,7 +2355,7 @@ class NsWorker(threading.Thread):
                                 dependency_task = dependency_ro_task["tasks"][
                                     dependency_task_index
                                 ]
-                                self.logger.warning(
+                                self.logger.debug(
                                     "dependency_ro_task={} dependency_task_index={}".format(
                                         dependency_ro_task, dependency_task_index
                                     )
@@ -2824,7 +2824,7 @@ class NsWorker(threading.Thread):
                 """
                 ro_task = self._get_db_task()
                 if ro_task:
-                    self.logger.warning("Task to process: {}".format(ro_task))
+                    self.logger.debug("Task to process: {}".format(ro_task))
                     time.sleep(1)
                     self._process_pending_tasks(ro_task)
                     busy = True
diff --git a/releasenotes/notes/correcting_log_levels-ae17918a8379a4ce.yaml b/releasenotes/notes/correcting_log_levels-ae17918a8379a4ce.yaml
new file mode 100644 (file)
index 0000000..2c5253c
--- /dev/null
@@ -0,0 +1,23 @@
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#######################################################################################
+---
+fixes:
+  - |
+    This patch is correcting the log levels of some successful operations
+    as they were logged with warning level.
+    
+