]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Added custom version to get more verbose
authorfrancisco.garcia <francisco.garcia@baculasystems.com>
Tue, 23 Jan 2024 11:09:50 +0000 (12:09 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 21 Mar 2024 16:13:34 +0000 (17:13 +0100)
bacula/src/plugins/fd/kubernetes-backend/baculak8s/io/log.py
bacula/src/plugins/fd/kubernetes-backend/baculak8s/plugins/k8sbackend/pods.py
bacula/src/plugins/fd/kubernetes-backend/baculak8s/plugins/k8sbackend/pvcdata.py
bacula/src/plugins/fd/kubernetes-backend/baculak8s/plugins/kubernetes_plugin.py

index 30f418c24a2e21d6fd67566d5884df7c5a8a171d..8a7a6f03c4d6d1c43bc1391a17b3b61ae03fe07e 100644 (file)
@@ -116,4 +116,4 @@ class Log:
 
     @staticmethod
     def save_exception(e):
-        logging.debug(e)
+        logging.exception(e)
index 2aff8aa2a32655c7456b26a5dc8257358528aa7b..3f88b37d767bd81fd480d697bd45a1bd75817c0d 100644 (file)
@@ -42,6 +42,7 @@ def pods_read_namespaced(corev1api, namespace, name):
 def pods_namespaced_specs(corev1api, namespace, labels=""):
     podslist = []
     pods = corev1api.list_namespaced_pod(namespace=namespace, watch=False, label_selector=labels)
+    logging.debug('[CUSTOM] Get items of pods: {}'.format(pods.items))
     for pod in pods.items:
         podslist.append(pod)
     # logging.debug("pods_namespaced_specs:{}".format(podslist))
index 71a29b58dab640435fa7014653bc06563f89b1a9..17780d99f180fd7cef31b1755ae4357c458e29c9 100644 (file)
@@ -49,7 +49,12 @@ def pvcdata_list_update_node_names(corev1api, namespace, pvcdatalist):
     """
     # here we collect node_names for proper backup pod deployment
     pods = pods_namespaced_specs(corev1api, namespace=namespace)
+    logging.debug('[CUSTOM] Get pods:{}'.format(pods))
     for pod in pods:
+        logging.debug('[CUSTOM] Pod: {}'.format(pod))
+        logging.debug('[CUSTOM] Pod Specs: {}'.format(pod.spec))
+        if pod.spec is not None:
+            logging.debug('[CUSTOM] POD SPEC is None')
         for vol in pod.spec.volumes:
             if vol.persistent_volume_claim is not None:
                 pvcname = vol.persistent_volume_claim.claim_name
@@ -72,8 +77,12 @@ def pvcdata_get_namespaced(corev1api, namespace, pvcname, pvcalias=None):
         dict: pvc data dict
     """
     pvc = persistentvolumeclaims_read_namespaced(corev1api, namespace, pvcname)
+    logging.debug('[CUSTOM] Read PVC: ')
+    logging.debug(pvc)
+
     pvcspec = pvc.spec
     storageclassname = pvcspec.storage_class_name
+    logging.debug('[CUSTOM] Get size:' + str(pvcspec.resources))
     pvcsize = pvcspec.resources.requests.get('storage', '-1')
     pvcdata = {
         'name': pvcname,
@@ -87,6 +96,8 @@ def pvcdata_get_namespaced(corev1api, namespace, pvcname, pvcalias=None):
                           size=pvcsize),
     }
     pvcdatalist = pvcdata_list_update_node_names(corev1api, namespace, {pvcname: pvcdata})
+    logging.debug('[CUSTOM] Read persistent volume claim completed')
+
     return pvcdatalist.get(pvcname)
 
 
index d49d25c353201e2a419c18feb8d2d0b1da30d17f..cff02907b503770742543d9d83e7bb2c73ec7e87 100644 (file)
@@ -544,6 +544,8 @@ class KubernetesPlugin(Plugin):
 
     def check_pvc_compatiblity_with_vsnapshot(self, namespace, pvc_name):
         pvc = self.get_pvcdata_namespaced(namespace, pvc_name)
+        logging.debug('[CUSTOM] Check Compatibilidy with Snapshots. Name: {}'.format(pvc_name, pvc))
+        logging.debug('[CUSTOM] PVC: {}'.format(pvc))
         return self.check_storage_compatibility_with_vsnapshot(pvc.get('storage_class_name'))
 
     def _check_config_map(self, file_info):