Now that we have the corresponding options available in the config,
let's start using them.
Signed-off-by: Erik Skultety <eskultet(a)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