Skip to content

Detect host machine type instead of hardcoding pc-i440fx-rhel7.6.0 - #18

Open
eliorerz wants to merge 1 commit into
osac-project:mainfrom
eliorerz:fix-machine-type-detection
Open

Detect host machine type instead of hardcoding pc-i440fx-rhel7.6.0#18
eliorerz wants to merge 1 commit into
osac-project:mainfrom
eliorerz:fix-machine-type-detection

Conversation

@eliorerz

Copy link
Copy Markdown
Contributor

Problem

The VM XML template hardcodes machine='pc-i440fx-rhel7.6.0' which doesn't exist on RHEL 10 / Fedora hosts. These hosts only have pc-i440fx-rhel10.0.0, causing virsh define to fail:

error: unsupported configuration: Emulator '/usr/libexec/qemu-kvm' does not support machine type 'pc-i440fx-rhel7.6.0'

Fix

Query qemu-kvm -machine help at boot time to detect the host's default i440fx machine type and use it in the VM XML. Falls back to pc (the generic alias that works everywhere) if detection fails.

Testing

Verified on RHEL 10 host (osac-ci-1) where qemu-kvm -machine help returns:

pc-i440fx-rhel10.0.0 RHEL 10.0.0 PC (i440FX + PIIX, 1996) (default) (deprecated)

Boot succeeds with the detected machine type.

The VM XML template hardcoded machine type 'pc-i440fx-rhel7.6.0' which
doesn't exist on RHEL 10 / Fedora hosts (only pc-i440fx-rhel10.0.0 is
available). This causes 'virsh define' to fail with "unsupported
configuration: Emulator does not support machine type".

Query 'qemu-kvm -machine help' at boot time to detect the host's default
i440fx machine type. Falls back to 'pc' (the generic alias) if detection
fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant