def _prepare_kernel_url(self, guest, fetcher): store = urlfetcher.getDistroStore(guest, fetcher) kernel, initrd, args = store.acquireKernel(guest) os_variant = store.get_osdict_info() if guest.os_autodetect: if os_variant: logging.debug("Auto detected OS variant as: %s", os_variant) guest.os_variant = os_variant self._tmpfiles.append(kernel) if initrd: self._tmpfiles.append(initrd) _perform_initrd_injections(initrd, self.initrd_injections, fetcher.scratchdir) kernel, initrd, tmpvols = _upload_media( guest.conn, fetcher.scratchdir, util.get_system_scratchdir(guest.type), fetcher.meter, kernel, initrd) self._tmpvols += tmpvols self._install_kernel = kernel self._install_initrd = initrd self.extraargs = args
def _storeForDistro(fetcher, guest): """ Helper to lookup the Distro store object, basically detecting the URL. Handle occasional proxy errors """ for ignore in range(0, 10): try: return urlfetcher.getDistroStore(guest, fetcher) except Exception, e: if str(e).count("502"): logging.debug("Caught proxy error: %s", str(e)) time.sleep(.5) continue raise
def _fetch_distro(distro): print "Fetching distro=%s" % distro.name fetcher = urlfetcher.fetcherForURI(distro.url, "/tmp", meter) try: fetcher.prepareLocation() store = urlfetcher.getDistroStore(guest, fetcher) kernel, initrd, ignore = store.acquireKernel(guest) cleanup.append(kernel) cleanup.append(initrd) distro.kernel = kernel distro.initrd = initrd finally: fetcher.cleanupLocation()
def _fetch_distro(distro): print "Fetching distro=%s" % distro.name fetcher = urlfetcher.fetcherForURI(distro.url, "/tmp", meter) origenv = os.environ.pop("VIRTINST_TEST_SUITE") try: fetcher.prepareLocation() store = urlfetcher.getDistroStore(guest, fetcher) kernel, initrd, ignore = store.acquireKernel(guest) cleanup.append(kernel) cleanup.append(initrd) distro.kernel = kernel distro.initrd = initrd except Exception, e: print "fetching distro=%s failed: %s" % (distro.name, e)
def _fetch_distro(distro): print("Fetching distro=%s" % distro.name) fetcher = urlfetcher.fetcherForURI(distro.url, "/tmp", meter) origenv = os.environ.pop("VIRTINST_TEST_SUITE") try: fetcher.prepareLocation() store = urlfetcher.getDistroStore(guest, fetcher) kernel, initrd, ignore = store.acquireKernel(guest) cleanup.append(kernel) cleanup.append(initrd) distro.kernel = kernel distro.initrd = initrd except Exception: logging.error("Fetching distro=%s failed", distro.name, exc_info=True) finally: fetcher.cleanupLocation() if origenv: os.environ["VIRTINST_TEST_SUITE"] = origenv
def _prepare_cdrom_url(self, guest, fetcher): store = urlfetcher.getDistroStore(guest, fetcher) media = store.acquireBootDisk(guest) self._tmpfiles.append(media) return self._make_cdrom_dev(media, transient=True)