← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~paride/autopkgtest-cloud:flexible-flavor-names into autopkgtest-cloud:master

 

Paride Legovini has proposed merging ~paride/autopkgtest-cloud:flexible-flavor-names into autopkgtest-cloud:master.

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

For more details, see:
https://code.launchpad.net/~paride/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/466379
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~paride/autopkgtest-cloud:flexible-flavor-names into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-cloud-worker/config.yaml b/charms/focal/autopkgtest-cloud-worker/config.yaml
index 3719fad..797d74c 100644
--- a/charms/focal/autopkgtest-cloud-worker/config.yaml
+++ b/charms/focal/autopkgtest-cloud-worker/config.yaml
@@ -73,14 +73,12 @@ options:
     type: string
     description: "second autopkgtest --setup-command argument"
     default: ~
-  worker-default-flavor:
+  worker-flavor-config:
     type: string
-    description: "the default nova flavor to run tests under"
-    default: "m1.small"
-  worker-big-flavor:
-    type: string
-    description: "the flavor to run big-packages tests under"
-    default: "m1.large"
+    description: "yaml dict mapping region->arch->size to a flavor name"
+    default: |-
+      default: m1.small
+      big: m1.large
   worker-args:
     type: string
     description: "autopkgtest virt args"
diff --git a/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py b/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
index c8874c3..7f10aba 100644
--- a/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
+++ b/charms/focal/autopkgtest-cloud-worker/reactive/autopkgtest_cloud_worker.py
@@ -495,8 +495,7 @@ def write_swift_config():
 
 
 @when_any(
-    "config.changed.worker-default-flavor",
-    "config.changed.worker-big-flavor",
+    "config.changed.worker-flavor-config",
     "config.changed.worker-args",
     "config.changed.worker-setup-command",
     "config.changed.worker-setup-command2",
@@ -516,12 +515,14 @@ def write_worker_config():
 
     nworkers = config().get("n-workers") or ""
     lxdremotes = config().get("lxd-remotes") or ""
+    flavorconfig = config().get("worker-flavor-config") or ""
 
     if not nworkers and not lxdremotes:
         return
 
     nworkers_yaml = yaml.load(nworkers, Loader=yaml.CSafeLoader) or {}
     lxdremotes_yaml = yaml.load(lxdremotes, Loader=yaml.CSafeLoader) or {}
+    flavorconfig_yaml = yaml.load(flavorconfig, Loader=yaml.CSafeLoader) or {}
 
     conf = {
         "autopkgtest": {
@@ -535,8 +536,6 @@ def write_worker_config():
             ),
         },
         "virt": {
-            "package_size_default": config().get("worker-default-flavor"),
-            "package_size_big": config().get("worker-big-flavor"),
             "args": config().get("worker-args"),
         },
     }
@@ -583,21 +582,30 @@ def write_worker_config():
 
     for region in nworkers_yaml:
         for arch in nworkers_yaml[region]:
+            try:
+                flavor = flavorconfig_yaml[region][arch]["default"]
+            except KeyError:
+                # No explicit flavor set for this region+arch combination.
+                flavor = flavorconfig_yaml["default"]
+            conf["virt"]["package_size_default"] = flavor
+            try:
+                flavor = flavorconfig_yaml[region][arch]["big"]
+            except KeyError:
+                flavor = flavorconfig_yaml["big"]
+            conf["virt"]["package_size_big"] = flavor
             if arch == "amd64":
                 conf_file = os.path.join(
                     os.path.expanduser("~ubuntu"),
                     "worker-{}.conf".format(region),
                 )
                 conf["autopkgtest"]["architectures"] = "amd64 i386"
-                write(conf_file)
-                break
             else:
                 conf_file = os.path.join(
                     os.path.expanduser("~ubuntu"),
                     "worker-{}-{}.conf".format(region, arch),
                 )
                 conf["autopkgtest"]["architectures"] = arch
-                write(conf_file)
+            write(conf_file)
 
     for arch in lxdremotes_yaml:
         conf_file = os.path.join(
diff --git a/mojo/service-bundle b/mojo/service-bundle
index 2e90641..c839488 100644
--- a/mojo/service-bundle
+++ b/mojo/service-bundle
@@ -78,16 +78,23 @@ applications:
             worker-upstream-percentage: 33
 {%- if stage_name == "production" %}
             net-name: net_prod-proposed-migration
-            worker-default-flavor: autopkgtest
-            worker-big-flavor: autopkgtest-big
+            worker-flavor-config: |-
+              default: autopkgtest
+              big: autopkgtest-big
+              bos03:
+                ppc64el:
+                  default: autopkgtest-ppc64el
+                  big: autopkgtest-big-ppc64el
 {%- elif stage_name == "staging" %}
             net-name: net_stg-proposed-migration-environment
-            worker-default-flavor: stag-cpu2-ram4-disk20
-            worker-big-flavor: stag-cpu4-ram16-disk50
+            worker-flavor-config: |-
+              default: stag-cpu2-ram4-disk20
+              big: stag-cpu4-ram16-disk50
 {%- elif stage_name == "devel" %}
             net-name: net_instances
-            worker-default-flavor: cpu2-ram4-disk20
-            worker-big-flavor: cpu4-ram16-disk50
+            worker-flavor-config: |-
+              default: stag-cpu2-ram4-disk20
+              big: stag-cpu4-ram16-disk50
 {%- endif %}
 {%- if stage_name == "production" or stage_name == "staging" %}
             mirror: http://ftpmaster.internal/ubuntu/

Follow ups