[virt-tools-list] Fwd: virt-install question

Cole Robinson crobinso at redhat.com
Mon Nov 25 15:35:57 UTC 2013

(this was an offline discussion, I asked Stephen to message the list so he
could link to a public email if needed).

On 11/22/2013 01:31 PM, Stephen Herr wrote:
> As recommended I am asking this question to the list instead of the individual
> developer.
> -Stephen Herr
> -------- Original Message --------
> Subject:     virt-install question
> Date:     Thu, 21 Nov 2013 15:34:11 -0500
> From:     Stephen Herr <sherr at redhat.com>
> To:     Martin Kletzander <mkletzan at redhat.com>
> Hi Martin,
> I'm working on cobbler / koan (specifically on the Satellite team). I
> heard you were the maintainer for the virt-install package, and I have
> some questions for you. I'm looking at virt-install-0.10.0-7.el7.noarch
> if that makes any difference.
> Due to python-virtinst being subsumed into virt-install and the python
> module no longer being directly available in RHEL 7, the cobbler / koan
> code has had to change. Esentially we just shell out to a command line
> and call virt-install instead of communicating with the module directly,
> like we did in RHEL 5 and 6.
> The problem is with getting a list of os-variants that this version of
> virt-install supports. We used to just 'from virtinst import osdict' and
> look at OS_TYPES, but now that the module is not public we can't do that
> any more. I see that with the command line tool you can do 'virt-install
> --os-variant list', but the man page specifically says "The printed
> format is not a stable interface, DO NOT PARSE IT." If I'm not allowed
> to import the module and I'm not allowed to parse the output of the
> command line tool, how exactly am I supposed to be able to detect if my
> OS variant is supported by virt-install?

Unfortunately there isn't a good answer here. Long term the idea is to use
libosinfo for OS metadata handling, which has tools for querying values. There
is already some work underway to do this but it won't be in RHEL7.0 for sure.
Long term cobbler should consider switching to libosinfo as well for some of
it's OS awareness, then we all share the same library (it was partially
implemented with cobbler in mind as a future consumer).

Despite what the man page says (I wrote that comment  ) the output format
has never changed AFAIK so it's reasonably safe to parse. That said this is
not a guarantee of a 'stable API' here but it's the best option for the time

So my recommendation would be to just parse the virt-install output, with a
big comment like:

# The virt-install man page explicitly says to not parse this output. I talked
# with the virt-install maintainers and the general point is that the output
# is not and never will be a stable interface so this may break in the future.
# However right now it's the only option for us. Long term plans are for
# virt-install to switch to libosinfo for OS metadata tracking, which provides
# a library and tools for querying valid OS values.


More information about the virt-tools-list mailing list