kvm-install-vm icon indicating copy to clipboard operation
kvm-install-vm copied to clipboard

Add support to custom list of distros

Open seocam opened this issue 4 years ago • 2 comments

My use case for kvm-install-vm is to perform test run in multiple versions of a given distro (centos, fedora and rhel). While I don't think it would make sense to create a PR to add centos-1611, centos1811, centos1907, etc., those names are meaningful and helpful in my tests.

For that reason I'd like to suggest that the mapping of distros could be customized in .kvirc or somewhere else.

Thanks!

seocam avatar Mar 26 '20 18:03 seocam

Would you be able to walk me through how you would implement this feature?

giovtorres avatar Mar 28 '20 17:03 giovtorres

There probably many ways it could be done. One example would be to take an argument of a json file with the distro definition and parse it using jq (available in most debian-based and rpm-based distros).

For this file:

{
    "centos8": {
        "qcow": "CentOS-8-GenericCloud-8.1.1911-20200113.3.x86_64.qcow2",
        "os_variant": "centos8",
        "image_url": "https://cloud.centos.org/centos/8/x86_64/images",
        "disk_format": "qcow2",
        "login_user": "centos"
    }
}

You could read the settings like this:

$ cat distros.json | jq .centos8.qcow
"CentOS-8-GenericCloud-8.1.1911-20200113.3.x86_64.qcow2"

I've made this gist with all "distro variables" read using jq: https://gist.github.com/seocam/e0e6ff8e4b2b26884cda1ca046ec5921

seocam avatar Mar 29 '20 19:03 seocam