← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] autopkgtest-cloud:lxd-container into autopkgtest-cloud:master

 

Brian Murray has proposed merging autopkgtest-cloud:lxd-container into autopkgtest-cloud:master.

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)

For more details, see:
https://code.launchpad.net/~ubuntu-release/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/468815

Early in the oracular development cycle we had some tests that were supposed to run on oracular (armhf) but ended up running in noble containers. I modified stats.py to collect the container on which the test ran and this seems like it might (but hopefully not!) be useful in the future.
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of autopkgtest-cloud:lxd-container into autopkgtest-cloud:master.
diff --git a/dev-tools/stats.py b/dev-tools/stats.py
index 1f251c7..0aa701e 100755
--- a/dev-tools/stats.py
+++ b/dev-tools/stats.py
@@ -37,6 +37,7 @@ class Run:
         self.log_lines = None
         self.host = None
         self.datacenter = None
+        self.lxd_container = None
         self.first_boot_time = None
         self.boot_attempts = None
 
@@ -52,6 +53,7 @@ class Run:
             "boot_attempts": self.boot_attempts,
             "host": self.host,
             "datacenter": self.datacenter,
+            "lxd_container": self.lxd_container,
         }
 
     def log_url(self):
@@ -90,6 +92,7 @@ class Run:
         - number of reboots
         - number of nova retries
         - datacenter
+        - lxd_container if running on armhf
         """
         self.download_log()
         self.extract_host()
@@ -116,7 +119,9 @@ class Run:
             logging.debug(e)
 
     datacenter_pattern = re.compile(r"@(.*)\.secgroup ")
-    lxd_remote_pattern = re.compile(r"lxd-armhf-(\d*\.\d*\.\d*\.\d*):")
+    lxd_remote_and_container_pattern = re.compile(
+        r"lxd-armhf-(\d*\.\d*\.\d*\.\d*):(.*)"
+    )
 
     def extract_datacenter(self):
         try:
@@ -127,9 +132,10 @@ class Run:
                 in l
             ]
             if self.arch == "armhf":
-                m = self.lxd_remote_pattern.search(lines[0])
+                m = self.lxd_remote_and_container_pattern.search(lines[0])
                 if m:
                     self.datacenter = m.group(1)
+                    self.lxd_container = m.group(2)
             else:
                 m = self.datacenter_pattern.search(lines[0])
                 if m:
@@ -174,6 +180,7 @@ def get_stats(db_con, since_days_ago, until_days_ago, limit):
             "  first_boot_time INTEGER, "
             "  boot_attempts INTEGER, "
             "  datacenter CHAR[10],"
+            "  lxd_container CHAR[10],"
             "  host CHAR[10],"
             "  PRIMARY KEY(uuid))"
         )
@@ -220,14 +227,16 @@ def get_stats(db_con, since_days_ago, until_days_ago, limit):
                             first_boot_time,
                             boot_attempts,
                             host,
-                            datacenter
+                            datacenter,
+                            lxd_container
                         )
                         VALUES (
                             :uuid,
                             :first_boot_time,
                             :boot_attempts,
                             :host,
-                            :datacenter
+                            :datacenter,
+                            :lxd_container
                         )""",
                     r.as_row_dict(),
                 )