Compare commits
No commits in common. "2b7e20493a9e707ebabe2b9cdd30ef26bca423d1" and "dc9dfa577979fc41ba16192cb181b8dfaa6ed9ab" have entirely different histories.
2b7e20493a
...
dc9dfa5779
1 changed files with 10 additions and 42 deletions
|
|
@ -219,28 +219,15 @@ def osinfo_known(short_id: str) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def osinfo_arg(osinfo: str, distro: str = "") -> str:
|
def osinfo_arg(osinfo: str) -> str:
|
||||||
"""Valeur --osinfo résiliente à un osinfo-db périmé. Si l'id est connu on
|
"""Valeur --osinfo résiliente à un osinfo-db périmé : si l'id est connu on
|
||||||
l'utilise ; sinon on retombe sur le DERNIER osinfo connu de la même distro
|
l'utilise ; sinon on bascule en détection best-effort au lieu d'échouer
|
||||||
(meilleures perfs que « generic », pas d'avertissement) ; en dernier
|
(utile pour une distro plus récente que la base locale, ex. ubuntu26.04,
|
||||||
recours, détection best-effort. Utile pour une version plus récente que la
|
fedora43+)."""
|
||||||
base locale (ex. ubuntu26.04, fedora43+)."""
|
|
||||||
if "=" in osinfo or "," in osinfo:
|
if "=" in osinfo or "," in osinfo:
|
||||||
return osinfo # forme avancée déjà fournie par l'utilisateur
|
return osinfo # forme avancée déjà fournie par l'utilisateur
|
||||||
if osinfo_known(osinfo):
|
if osinfo_known(osinfo):
|
||||||
return osinfo
|
return osinfo
|
||||||
# Repli 1 : dernier osinfo connu de la même distro (ordre de la table).
|
|
||||||
versions = DISTROS.get(distro, ({}, ""))[0]
|
|
||||||
known = [v[1] for v in versions.values() if osinfo_known(v[1])]
|
|
||||||
if known:
|
|
||||||
fallback = known[-1]
|
|
||||||
print(
|
|
||||||
f" osinfo « {osinfo} » inconnu (osinfo-db) — repli sur "
|
|
||||||
f"« {fallback} » (proche). « sudo apt upgrade osinfo-db » pour "
|
|
||||||
"l'entrée exacte."
|
|
||||||
)
|
|
||||||
return fallback
|
|
||||||
# Repli 2 : détection best-effort (évite l'échec, peut donner generic).
|
|
||||||
print(
|
print(
|
||||||
f" osinfo « {osinfo} » inconnu de la base locale (osinfo-db) — repli "
|
f" osinfo « {osinfo} » inconnu de la base locale (osinfo-db) — repli "
|
||||||
"sur la détection auto (detect=on,require=off).\n"
|
"sur la détection auto (detect=on,require=off).\n"
|
||||||
|
|
@ -360,18 +347,11 @@ TOOL_PACKAGES: dict[str, dict[str, str]] = {
|
||||||
# Paquets fournissant le démon libvirt + l'émulateur QEMU système. Ils sont
|
# Paquets fournissant le démon libvirt + l'émulateur QEMU système. Ils sont
|
||||||
# INDISPENSABLES pour exécuter la VM : virsh/virt-install (clients) seuls ne
|
# INDISPENSABLES pour exécuter la VM : virsh/virt-install (clients) seuls ne
|
||||||
# créent pas le socket /var/run/libvirt/libvirt-sock.
|
# créent pas le socket /var/run/libvirt/libvirt-sock.
|
||||||
# On inclut le firmware UEFI (OVMF/edk2) : le boot par défaut est UEFI
|
|
||||||
# (indispensable pour Debian 13+ ; les images récentes n'ont plus de BIOS).
|
|
||||||
DAEMON_PACKAGES: dict[str, list[str]] = {
|
DAEMON_PACKAGES: dict[str, list[str]] = {
|
||||||
"apt": ["libvirt-daemon-system", "qemu-system-x86", "ovmf"],
|
"apt": ["libvirt-daemon-system", "qemu-system-x86"],
|
||||||
"dnf": ["libvirt-daemon-kvm", "qemu-kvm", "edk2-ovmf"],
|
"dnf": ["libvirt-daemon-kvm", "qemu-kvm"],
|
||||||
"pacman": ["libvirt", "qemu-desktop", "dnsmasq", "edk2-ovmf"],
|
"pacman": ["libvirt", "qemu-desktop", "dnsmasq"],
|
||||||
"zypper": [
|
"zypper": ["libvirt-daemon", "libvirt-daemon-qemu", "qemu-kvm"],
|
||||||
"libvirt-daemon",
|
|
||||||
"libvirt-daemon-qemu",
|
|
||||||
"qemu-kvm",
|
|
||||||
"qemu-ovmf-x86_64",
|
|
||||||
],
|
|
||||||
"brew": [],
|
"brew": [],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -984,12 +964,6 @@ def virt_install(
|
||||||
"--console",
|
"--console",
|
||||||
"pty,target_type=serial",
|
"pty,target_type=serial",
|
||||||
]
|
]
|
||||||
# Boot UEFI par défaut : Debian 13 (trixie) et les images cloud récentes
|
|
||||||
# n'embarquent plus le chargeur BIOS/GRUB-pc et partent en boucle
|
|
||||||
# « Booting... » en SeaBIOS. UEFI (OVMF) fonctionne pour Ubuntu/Debian/
|
|
||||||
# Fedora. --bios force l'ancien BIOS si OVMF est indisponible.
|
|
||||||
if not args.bios:
|
|
||||||
cmd += ["--boot", "uefi"]
|
|
||||||
if not args.attach_console:
|
if not args.attach_console:
|
||||||
cmd.append("--noautoconsole")
|
cmd.append("--noautoconsole")
|
||||||
runner.run(cmd, privileged=True)
|
runner.run(cmd, privileged=True)
|
||||||
|
|
@ -1140,12 +1114,6 @@ def build_parser() -> argparse.ArgumentParser:
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Attache la console série (sinon --noautoconsole).",
|
help="Attache la console série (sinon --noautoconsole).",
|
||||||
)
|
)
|
||||||
g_vm.add_argument(
|
|
||||||
"--bios",
|
|
||||||
action="store_true",
|
|
||||||
help="Force l'amorçage BIOS hérité au lieu d'UEFI (par défaut UEFI ; "
|
|
||||||
"n'utiliser que si le firmware OVMF est absent).",
|
|
||||||
)
|
|
||||||
|
|
||||||
g_cloud = p.add_argument_group("cloud-init")
|
g_cloud = p.add_argument_group("cloud-init")
|
||||||
g_cloud.add_argument(
|
g_cloud.add_argument(
|
||||||
|
|
@ -1386,7 +1354,7 @@ def main() -> None:
|
||||||
cloud_cfg = build_cloud_config(args, pw_hash, ssh_keys)
|
cloud_cfg = build_cloud_config(args, pw_hash, ssh_keys)
|
||||||
build_seed(cloud_cfg, args.hostname, seed, runner)
|
build_seed(cloud_cfg, args.hostname, seed, runner)
|
||||||
|
|
||||||
resolved_osinfo = osinfo_arg(osinfo, args.distro)
|
resolved_osinfo = osinfo_arg(osinfo)
|
||||||
print(f"\n== 5/5 virt-install (--osinfo {resolved_osinfo}) ==")
|
print(f"\n== 5/5 virt-install (--osinfo {resolved_osinfo}) ==")
|
||||||
ensure_network(network_name(args.network), runner)
|
ensure_network(network_name(args.network), runner)
|
||||||
virt_install(args, disk, seed, resolved_osinfo, runner)
|
virt_install(args, disk, seed, resolved_osinfo, runner)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue