From 5d1317e67b64874613173f5484ecbf0272128b84 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Fri, 12 Jan 2024 20:15:01 +0000 Subject: [PATCH] Use RHEL paths and pre-create disk --- roles/home-cli/files/virtinst.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/roles/home-cli/files/virtinst.sh b/roles/home-cli/files/virtinst.sh index 8790227..966a1aa 100755 --- a/roles/home-cli/files/virtinst.sh +++ b/roles/home-cli/files/virtinst.sh @@ -27,7 +27,7 @@ fi case "$_acp_vm_distro" in "debian") - _acp_vm_boot=loader=/usr/share/OVMF/OVMF_CODE.fd,loader.readonly=yes,loader.type=pflash,nvram.template=/usr/share/OVMF/OVMF_VARS.fd,loader_secure=no + _acp_vm_boot=loader=/usr/share/edk2/ovmf/OVMF_CODE.fd,loader.readonly=yes,loader.type=pflash,nvram.template=/usr/share/edk2/ovmf/OVMF_VARS.fd,loader_secure=no ;; *) _acp_vm_boot=uefi @@ -41,20 +41,27 @@ else _acp_vm_disk=$_acp_vm_root/$_acp_vm_name.qcow2 fi +if ! [ -r "$_acp_vm_disk" ] +then + qemu-img create -f qcow2 $_acp_vm_disk 20G +fi + # To get a list of valid osinfo options, run: # virt-install --osinfo list # Sizes are based on RHEL 9 minimum recommendations. virt-install --connect $_acp_vm_session \ --osinfo linux2022 \ + --accelerate \ --boot $_acp_vm_boot \ - --cpu host-passthrough \ --vcpus 1 \ --ram 1536 \ - --disk "$_acp_vm_disk,size=20" \ + --disk "$_acp_vm_disk" \ + --network network:default,model=virtio \ --graphics vnc \ --console pty,target.type=virtio \ --serial pty \ --channel unix,target.type=virtio,target.name=org.qemu.guest_agent.0 \ --video virtio \ --autoconsole none \ + --import \ --name "$@"