[virt-tools-list] [PATCH 2/2] virtinst: In DebianDistro and UbuntuDistro, detect Install CDs

Viktor Mihajlovski mihajlov at linux.vnet.ibm.com
Fri Sep 8 08:00:25 UTC 2017


On 08.09.2017 01:11, Andrew Wong wrote:
> ---
>  virtinst/urlfetcher.py | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py
> index e5beb9b2..47fd97f1 100644
> --- a/virtinst/urlfetcher.py
> +++ b/virtinst/urlfetcher.py
> @@ -1190,10 +1190,27 @@ class DebianDistro(Distro):
>  
>          return True
>  
> +    def _is_install_cd(self):
> +        # For install CDs
> +        if not self._check_info(".disk/info"):
> +            return False
> +
> +        if self.arch == "x86_64":
> +            kernel_initrd_pair = ("install.amd/vmlinuz", "install.amd/initrd.gz")
> +        elif self.arch == "i686":
> +            kernel_initrd_pair = ("install.386/vmlinuz", "install.386/initrd.gz")
> +        else:
> +            kernel_initrd_pair = ("install/vmlinuz", "install/initrd.gz")
> +        self._hvm_kernel_paths += [kernel_initrd_pair]
> +        self._xen_kernel_paths += [kernel_initrd_pair]
> +
> +        return True
> +
>      def isValidStore(self):
>          return any(check() for check in [
>              self._is_regular_tree,
>              self._is_daily_tree,
> +            self._is_install_cd,
>              ])
>  
>  
> @@ -1244,6 +1261,18 @@ class UbuntuDistro(DebianDistro):
>  
>          return True
>  
> +    def _is_install_cd(self):
> +        # For install CDs
> +        if not self._check_info(".disk/mini-info"):
> +            return False
> +
> +        kernel_initrd_pair = ("linux", "initrd.gz")
> +
> +        self._hvm_kernel_paths += [kernel_initrd_pair]
> +        self._xen_kernel_paths += [kernel_initrd_pair]
> +
> +        return True
> +
You might consider to either factor in the code for s390x cd discovery
into the generic function above, or (which I'd find better) provide cd
checking functions for each architecture in addition to the generic one
(most of them could be in the Debian parent class).
>      def _is_install_cd_s390x(self):
>          # For install CDs (s390x)
>          if not self.arch == "s390x":
> @@ -1261,6 +1290,7 @@ class UbuntuDistro(DebianDistro):
>          return any(check() for check in [
>              self._is_regular_tree,
>              self._is_tree_iso,
> +            self._is_install_cd,
>              self._is_install_cd_s390x,
>              ])
>  
> 


-- 

Mit freundlichen Grüßen/Kind Regards
   Viktor Mihajlovski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Köderitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294




More information about the virt-tools-list mailing list