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

Cole Robinson crobinso at redhat.com
Fri Sep 8 20:59:10 UTC 2017


On 09/08/2017 04:00 AM, Viktor Mihajlovski wrote:
> 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).

Agreed on both counts but those can be follow ups and I'd rather not force
more work on a driveby contributor.

Thanks Andrew, I've pushed these two patches, with a small pylint fix squashed
into patch #1

- Cole




More information about the virt-tools-list mailing list