[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 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

Attachment: pgpU70wnPhEbI.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]