Subject: virtinst: quickfix ubuntu net-preseed insert cdrom error From: Johannes Tiefenbacher johannes.tiefenbacher@svc.co.at Tue Oct 9 15:52:23 2018 +0200 Date: Thu Oct 18 13:21:41 2018 -0400: Git: b8aff28087d593f570b13aabe337b659bc260ae3 the proper kernel/initrd pair for booting from an http server is found in install/netboot/... on a mounted ubuntu iso. this last worked in v1.4.2 Discussion: https://github.com/virt-manager/virt-manager/pull/34 (crobinso: add the fetcher.is_iso handling and add a comment) diff --git a/virtinst/urldetect.py b/virtinst/urldetect.py index 5da15d0..4196b10 100644 --- a/virtinst/urldetect.py +++ b/virtinst/urldetect.py @@ -30,7 +30,6 @@ class _DistroCache(object): self.suse_content = None self.debian_media_type = None - def acquire_file_content(self, path): if path not in self._filecache: try: @@ -133,6 +132,9 @@ class _DistroCache(object): verstr, version, update) return version, update + def fetcher_is_iso(self): + return self._fetcher.is_iso() + class _SUSEContent(object): """ @@ -664,7 +666,16 @@ class DebianDistro(Distro): media_type = "daily" elif cache.content_regex(".disk/info", "%s.*" % cls._debname.capitalize()): - media_type = "disk" + # There's two cases here: + # 1) Direct access ISO, attached as CDROM afterwards. We + # use one set of kernels in that case which seem to + # assume the prescence of CDROM media + # 2) ISO mounted and exported over URL. We use a different + # set of kernels that expect to boot from the network + if cache.fetcher_is_iso(): + media_type = "disk" + else: + media_type = "mounted_iso_url" if media_type: cache.debian_media_type = media_type @@ -710,6 +721,8 @@ class DebianDistro(Distro): url_prefix = "current/images" if self.cache.debian_media_type == "daily": url_prefix = "daily" + elif self.cache.debian_media_type == "mounted_iso_url": + url_prefix = "install" tree_arch = self._find_treearch() hvmroot = "%s/netboot/%s-installer/%s/" % (url_prefix, diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py index 56c024a..e18fe98 100644 --- a/virtinst/urlfetcher.py +++ b/virtinst/urlfetcher.py @@ -26,6 +26,7 @@ class _URLFetcher(object): a media source, such as CD ISO, or HTTP/HTTPS/FTP server """ _block_size = 16384 + _is_iso = False def __init__(self, location, scratchdir, meter): self.location = location @@ -101,6 +102,12 @@ class _URLFetcher(object): # Public API # ############## + def is_iso(self): + """ + If this is a fetcher for local CDROM/ISO + """ + return self._is_iso + def prepareLocation(self): """ Perform any necessary setup @@ -288,6 +295,7 @@ class _LocalURLFetcher(_URLFetcher): class _ISOURLFetcher(_URLFetcher): _cache_file_list = None + _is_iso = True def _make_full_url(self, filename): return "/" + filename