[virt-tools-list] [RFC PATCH 4/6] virtinstall: add some quirks

Christophe Fergeau cfergeau at redhat.com
Tue Oct 15 06:49:35 UTC 2013


On Mon, Oct 14, 2013 at 11:16:40PM +0200, Giuseppe Scrivano wrote:
> Some OS names are different under libosinfo, add quirks to be
> backward compatible.
> 
> Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
> ---
>  virtinst/osdict.py | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 71 insertions(+), 2 deletions(-)
> 
> diff --git a/virtinst/osdict.py b/virtinst/osdict.py
> index 481d5db..d840797 100644
> --- a/virtinst/osdict.py
> +++ b/virtinst/osdict.py
> @@ -269,6 +269,9 @@ class _OsVariantOsInfo(_OSVariant):
>          return _SENTINEL
>  
>      def _get_netmodel(self):
> +        if self._os.get_distro() == "fedora":
> +            return _SENTINEL
> +
>          fltr = libosinfo.Filter()
>          fltr.add_constraint("class", "net")
>          devs = self._os.get_all_devices(fltr)
> @@ -277,6 +280,15 @@ class _OsVariantOsInfo(_OSVariant):
>          return _SENTINEL
>  
>      def _get_videomodel(self):
> +        if self._os.get_short_id() in {"ubuntu13.10", "ubuntu13.04"}:
> +            return "vmvga"
> +
> +        if _OsVariantOsInfo.is_windows(self._os):
> +            return "vga"
> +
> +        if self._os.get_distro() == "fedora":
> +            return _SENTINEL
> +
>          fltr = libosinfo.Filter()
>          fltr.add_constraint("class", "video")
>          devs = self._os.get_all_devices(fltr)
> @@ -322,6 +334,9 @@ class _OsVariantOsInfo(_OSVariant):
>          return _SENTINEL
>  
>      def _is_virtiodisk(self):
> +        if self._os.get_distro() == "fedora":
> +            return int(self._os.get_version() >= 10) or _SENTINEL
> +
>          fltr = libosinfo.Filter()
>          fltr.add_constraint("class", "block")
>          devs = self._os.get_all_devices(fltr)
> @@ -333,6 +348,9 @@ class _OsVariantOsInfo(_OSVariant):
>          return _SENTINEL
>  
>      def _is_virtionet(self):
> +        if self._os.get_distro() == "fedora":
> +            return int(self._os.get_version() >= 9) or _SENTINEL
> +
>          fltr = libosinfo.Filter()
>          fltr.add_constraint("class", "net")
>          devs = self._os.get_all_devices(fltr)
> @@ -343,6 +361,9 @@ class _OsVariantOsInfo(_OSVariant):
>          return _SENTINEL
>  
>      def _is_virtioconsole(self):
> +        if self._os.get_distro() == "fedora":
> +            return int(self._os.get_version()) >= 18 or _SENTINEL
> +
>          fltr = libosinfo.Filter()
>          fltr.add_constraint("class", "console")
>          devs = self._os.get_all_devices(fltr)
> @@ -358,8 +379,8 @@ class _OsVariantOsInfo(_OSVariant):
>          return _SENTINEL
>  
>      def _is_qemu_ga(self):
> -        if _OsVariantOsInfo.is_os_related_to(self._os, ["fedora18"]):
> -            return True
> +        if self._os.get_distro() == "fedora":
> +            return int(self._os.get_version()) >= 18 or _SENTINEL
>          return _SENTINEL
>  
>      def _get_typename(self):

It looks like all the special cases above are things that libosinfo
should provide. Did you try to fix the data there so that it matches what
you need?

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20131015/5cf77a65/attachment.sig>


More information about the virt-tools-list mailing list