Let's make _get_cached_data() also check for the media being used,
whenever an ISO is used with "--location" and let's get, from libosinfo,
the kernel and initrd path inside the media and add those to the kernel
pair list.

By doing this, the media's kernel and initrd can be used without the
user having to explicitly pass them when calling virt-install.

Signed-off-by: Fabiano Fidêncio <[email protected]>
---
 virtinst/installertreemedia.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/virtinst/installertreemedia.py b/virtinst/installertreemedia.py
index 39f5ac0f..0b8b1383 100644
--- a/virtinst/installertreemedia.py
+++ b/virtinst/installertreemedia.py
@@ -122,6 +122,10 @@ class InstallerTreeMedia(object):
         if not self._cached_data:
             has_location_kernel = bool(
                     self._location_kernel and self._location_initrd)
+            has_location_kernel_from_iso = bool(
+                    self._media and
+                    self._media.get_kernel_path() and
+                    self._media.get_initrd_path())
             store = urldetect.getDistroStore(guest, fetcher,
                     skip_error=has_location_kernel)
 
@@ -133,6 +137,10 @@ class InstallerTreeMedia(object):
             if has_location_kernel:
                 kernel_paths = [
                         (self._location_kernel, self._location_initrd)]
+            if has_location_kernel_from_iso:
+                kernel_paths.append([
+                    self._media.get_kernel_path(),
+                    self._media.get_initrd_path()])
 
             self._cached_data = _LocationData(os_variant, kernel_paths)
         return self._cached_data
-- 
2.20.1

_______________________________________________
virt-tools-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-tools-list

Reply via email to