Skip to content

Commit 88beb94

Browse files
committed
Install libvirt-python manually in kmt init
1 parent cf43dd6 commit 88beb94

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tasks/kernel_matrix_testing/init_kmt.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,31 @@ def init_kernel_matrix_testing_system(
127127

128128
get_compiler(ctx).start()
129129

130+
if not remote_setup_only:
131+
libvirt_version = get_libvirt_version(ctx)
132+
if libvirt_version is None:
133+
raise Exit(
134+
"libvirtd not found in $PATH, this should have been installed previously by the method kmt_os.init_local"
135+
)
136+
137+
info(f"[+] Installing libvirt-python=={libvirt_version} to match local libvirt version")
138+
ctx.run(f"{sys.executable} -m pip install libvirt-python=={libvirt_version}")
139+
130140
cm = ConfigManager()
131141
cm.config["setup"] = "remote" if remote_setup_only else "full"
132142
cm.save()
143+
144+
145+
def get_libvirt_version(ctx: Context) -> str | None:
146+
"""
147+
Returns the version of libvirt installed on the system. If the version is not found, returns None.
148+
"""
149+
res = ctx.run("libvirtd --version", warn=True)
150+
if res is None:
151+
return None
152+
153+
parts = res.stdout.strip().split()
154+
if len(parts) != 3:
155+
return None
156+
157+
return parts[2]

0 commit comments

Comments
 (0)