Re: [PATCH v2 virt-manager 1/2] virtinst: DistroInstaller uses libosinfo detection first

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

 



On 03/26/2014 07:19 AM, Giuseppe Scrivano wrote:
> Signed-off-by: Giuseppe Scrivano <gscrivan@xxxxxxxxxx>
> ---
>  virtinst/distroinstaller.py | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/virtinst/distroinstaller.py b/virtinst/distroinstaller.py
> index ec63ec3..1341314 100644
> --- a/virtinst/distroinstaller.py
> +++ b/virtinst/distroinstaller.py
> @@ -1,5 +1,5 @@
>  #
> -# Copyright 2006-2009, 2013 Red Hat, Inc.
> +# Copyright 2006-2009, 2013, 2014 Red Hat, Inc.
>  # Daniel P. Berrange <berrange@xxxxxxxxxx>
>  #
>  # This program is free software; you can redistribute it and/or modify
> @@ -30,6 +30,7 @@ from virtinst import util
>  from virtinst import Installer
>  from virtinst import VirtualDisk
>  from virtinst import urlfetcher
> +from virtinst import osdict
>  
>  
>  def _is_url(conn, url):
> @@ -473,6 +474,14 @@ class DistroInstaller(Installer):
>  
>      def detect_distro(self, guest):
>          try:
> +            os = osdict.lookup_os_by_media(self.location)
> +            if os:
> +                logging.debug("installer.detect_distro returned=%s", os)
> +                return os
> +        except:
> +            pass
> +

Can you add a logging.debug("libosinfo detect failed", exc_info=True) in the
except: bit?

And actually, it looks like lookup_os_by_media will throw an exception when
libosinfo fails to detect a distro, because it doesn't handle None return value.

ACK otherwise, feel free to just fix it  in a follow up patch.

- Cole

> +        try:
>              ret = urlfetcher.detectMediaDistro(guest, self.location)
>              logging.debug("installer.detect_distro returned=%s", ret)
>              return ret
> 

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux