def _prepare_kernel_and_initrd(self, guest, meter): disk = None # If installing off a local path, map it through to a virtual CD/disk if (self.location is not None and self._location_is_path and not os.path.isdir(self.location)): device = VirtualDisk.DEVICE_CDROM if (self.is_xenpv() and not guest._lookup_osdict_key('pv_cdrom_install')): device = VirtualDisk.DEVICE_DISK disk = VirtualDisk(conn=guest.conn, device=device, path=self.location, readOnly=True, transient=True) # Make sure we always fetch kernel here if required if self._install_bootconfig.kernel and not self.scratchdir_required(): return disk # Need to fetch the kernel & initrd from a remote site, or # out of a loopback mounted disk image/device ignore, os_type, os_variant, media = OSDistro.acquireKernel(guest, self.location, meter, self.scratchdir, self.os_type) (kernelfn, initrdfn, args) = media if guest.get_os_autodetect(): if os_type: logging.debug("Auto detected OS type as: %s", os_type) guest.os_type = os_type if (os_variant and guest.os_type == os_type): logging.debug("Auto detected OS variant as: %s", os_variant) guest.os_variant = os_variant self._tmpfiles.append(kernelfn) if initrdfn: self._tmpfiles.append(initrdfn) if self._initrd_injections: self._perform_initrd_injections(initrdfn) # If required, upload media to an accessible guest location kernelfn, initrdfn = self._upload_media(guest, meter, kernelfn, initrdfn) self._install_bootconfig.kernel = kernelfn self._install_bootconfig.initrd = initrdfn self._install_bootconfig.kernel_args = args return disk
def _prepare_kernel_and_initrd(self, guest, meter): disk = None # If installing off a local path, map it through to a virtual CD/disk if (self.location is not None and self._location_is_path and not os.path.isdir(self.location)): device = VirtualDisk.DEVICE_CDROM if (self.is_xenpv() and not guest._lookup_osdict_key('pv_cdrom_install')): device = VirtualDisk.DEVICE_DISK disk = VirtualDisk(conn=guest.conn, device=device, path=self.location, readOnly=True, transient=True) # Make sure we always fetch kernel here if required if self._install_bootconfig.kernel and not self.scratchdir_required(): return disk # Need to fetch the kernel & initrd from a remote site, or # out of a loopback mounted disk image/device ignore, os_type, os_variant, media = OSDistro.acquireKernel( guest, self.location, meter, self.scratchdir, self.os_type) (kernelfn, initrdfn, args) = media if guest.get_os_autodetect(): if os_type: logging.debug("Auto detected OS type as: %s" % os_type) guest.os_type = os_type if (os_variant and guest.os_type == os_type): logging.debug("Auto detected OS variant as: %s" % os_variant) guest.os_variant = os_variant self._tmpfiles.append(kernelfn) if initrdfn: self._tmpfiles.append(initrdfn) if self._initrd_injections: self._perform_initrd_injections(initrdfn) # If required, upload media to an accessible guest location kernelfn, initrdfn = self._upload_media(guest, meter, kernelfn, initrdfn) self._install_bootconfig.kernel = kernelfn self._install_bootconfig.initrd = initrdfn self._install_bootconfig.kernel_args = args return disk