Code review comment for ~jfguedez/charm-telegraf:feature/intel-cmt-cat

Revision history for this message
Joe Guo (guoqiao) wrote :

Hi Jose:

I am doing some testing with this patch in a lxd container (for conditions unmet case), I noticed the `kernel.modprobe` will raise exception: https://pastebin.canonical.com/p/xYBJXsSqZH/

Instead of creating a new patch, I am wondering could you apply following change to your code and re-push, so we can keep the review history here, please ?

diff --git a/src/reactive/telegraf.py b/src/reactive/telegraf.py
index 0b1e71d..8bfd801 100644
--- a/src/reactive/telegraf.py
+++ b/src/reactive/telegraf.py
@@ -807,7 +807,14 @@ def configure_telegraf(): # noqa: C901
     if config["collect_intel_rdt_metrics"]:
         hookenv.log("Intel RDT enabled, enabling module and running checks")
         # load and persist the required module
- kernel.modprobe(RDT_KERNEL_MODULE_NAME, persist=True)
+ try:
+ kernel.modprobe(RDT_KERNEL_MODULE_NAME, persist=True)
+ except subprocess.CalledProcessError:
+ error_msg = "modprobe {} failed".format(RDT_KERNEL_MODULE_NAME)
+ hookenv.log(error_msg, level=hookenv.ERROR)
+ hookenv.status_set("blocked", error_msg)
+ return
+
         try:
             check_valid_intel_rdt_configuration()
         except InvalidIntelRDTConfiguration as e:

review: Needs Fixing

« Back to merge proposal