[libvirt-ci PATCH 11/13] config: Move the virt-install settings from install.yml to the config

Erik Skultety eskultet at redhat.com
Wed Apr 22 13:28:29 UTC 2020


Looking into the future where we're able to generate cloudinit images,
we'll need to configure some of the install options which is currently
not possible without editing the install.yml group vars file within the
repository. That is suboptimal, so let's move the install options to
the global config under the '[install]' section so that further tweaking
is possible (but explicitly discouraged at the same time).

Signed-off-by: Erik Skultety <eskultet at redhat.com>
---
 config.toml    | 17 +++++++++++++++++
 guests/lcitool | 27 +++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/config.toml b/config.toml
index 5bb3725..9bb1b7f 100644
--- a/config.toml
+++ b/config.toml
@@ -16,6 +16,23 @@
 # instead. (mandatory)
 #root_password = ""
 
+# Settings mapping to the virt-install options - see virt-install(1).
+# It is strongly recommended that you keep the following at their default
+# values to produce machines which conform to the upstream libvirt standard,
+# unless you have a reason to do otherwise.
+#
+# Sizes are expressed in GiB.
+#
+#virt_type = "kvm"
+#arch = "x86_64"
+#machine = "pc"
+#cpu_model = "host-passthrough"
+#vcpus = 2
+#memory_size = 2
+#disk_size = 15
+#storage_pool = "default"
+#network = "default"
+
 [gitlab]
 # GitLab runner agent registration options, applies only if flavor == 'gitlab'.
 
diff --git a/guests/lcitool b/guests/lcitool
index 4cb6e69..36320ab 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -175,6 +175,33 @@ class Config:
         flavor = cfg.get("install").get("flavor", "test")
         cfg["install"]["flavor"] = flavor
 
+        virt_type = cfg.get("install").get("virt_type", "kvm")
+        cfg["install"]["virt_type"] = virt_type
+
+        arch = cfg.get("install").get("arch", "x86_64")
+        cfg["install"]["arch"] = arch
+
+        machine = cfg.get("install").get("machine", "pc")
+        cfg["install"]["machine"] = machine
+
+        cpu_model = cfg.get("install").get("cpu_model", "host-passthrough")
+        cfg["install"]["cpu_model"] = cpu_model
+
+        vcpus = cfg.get("install").get("vcpus", 2)
+        cfg["install"]["vcpus"] = vcpus
+
+        memory_size = cfg.get("install").get("memory_size", 2)
+        cfg["install"]["memory_size"] = memory_size
+
+        disk_size = cfg.get("install").get("disk_size", 15)
+        cfg["install"]["disk_size"] = disk_size
+
+        storage_pool = cfg.get("install").get("storage_pool", "default")
+        cfg["install"]["storage_pool"] = storage_pool
+
+        network = cfg.get("install").get("network", "default")
+        cfg["install"]["network"] = network
+
         if flavor == "gitlab":
             url = cfg.get("gitlab").get("gitlab_url", "https://gitlab.com")
             cfg["gitlab"]["gitlab_url"] = url
-- 
2.25.3




More information about the libvir-list mailing list