[libvirt-ci PATCH 12/13] lcitool: Use the config install options rather than install facts

Erik Skultety posted 13 patches 5 years, 9 months ago
[libvirt-ci PATCH 12/13] lcitool: Use the config install options rather than install facts
Posted by Erik Skultety 5 years, 9 months ago
Now that we have the corresponding options available in the config,
let's start using them.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
---
 guests/lcitool | 30 +++++++++++-------------------
 1 file changed, 11 insertions(+), 19 deletions(-)

diff --git a/guests/lcitool b/guests/lcitool
index 36320ab..9a9256f 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -565,25 +565,17 @@ class Application:
 
     def _action_install(self, args):
         base = Util.get_base()
-
-        flavor = self._config.dict["install"]["flavor"]
+        cfg = self._config.dict["install"]
 
         for host in self._inventory.expand_pattern(args.hosts):
             facts = self._inventory.get_facts(host)
 
-            # Both memory size and disk size are stored as GiB in the
-            # inventory, but virt-install expects the disk size in GiB
-            # and the memory size in *MiB*, so perform conversion here
-            memory_arg = str(int(facts["install_memory_size"]) * 1024)
-
-            vcpus_arg = str(facts["install_vcpus"])
-
             disk_arg = "size={},pool={},bus=virtio".format(
-                facts["install_disk_size"],
-                facts["install_storage_pool"],
+                cfg["disk_size"],
+                cfg["storage_pool"],
             )
             network_arg = "network={},model=virtio".format(
-                facts["install_network"],
+                cfg["network"],
             )
 
             # Different operating systems require different configuration
@@ -643,12 +635,12 @@ class Application:
                 virt_install,
                 "--name", host,
                 "--location", facts["install_url"],
-                "--virt-type", facts["install_virt_type"],
-                "--arch", facts["install_arch"],
-                "--machine", facts["install_machine"],
-                "--cpu", facts["install_cpu_model"],
-                "--vcpus", vcpus_arg,
-                "--memory", memory_arg,
+                "--virt-type", cfg["virt_type"],
+                "--arch", cfg["arch"],
+                "--machine", cfg["machine"],
+                "--cpu", cfg["cpu_model"],
+                "--vcpus", str(cfg["vcpus"]),
+                "--memory", str(cfg["memory_size"] * 1024),
                 "--disk", disk_arg,
                 "--network", network_arg,
                 "--graphics", "none",
@@ -663,7 +655,7 @@ class Application:
                 cmd.append("--noautoconsole")
 
             # Only configure autostart for the guest for the jenkins flavor
-            if flavor == "jenkins":
+            if cfg["flavor"] == "jenkins":
                 cmd += ["--autostart"]
 
             try:
-- 
2.25.3

Re: [libvirt-ci PATCH 12/13] lcitool: Use the config install options rather than install facts
Posted by Andrea Bolognani 5 years, 9 months ago
On Wed, 2020-04-22 at 15:28 +0200, Erik Skultety wrote:
> Now that we have the corresponding options available in the config,
> let's start using them.
> 
> Signed-off-by: Erik Skultety <eskultet@redhat.com>
> ---
>  guests/lcitool | 30 +++++++++++-------------------
>  1 file changed, 11 insertions(+), 19 deletions(-)

At this point the file

  group_vars/all/install.yml

is no longer used and you should drop it. I also don't think it makes
sense to split this changes from the ones in 11/13, so please squash
the two patches together.

With that done,

  Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization