[virt-tools-list] About virt-install 0.6

gong ys gong_ys2004 at yahoo.com.cn
Mon Dec 26 01:58:10 UTC 2011


Dear virt-install developers:

I found one of my commands can run on virt-install 0.5x, but it fails on virt-install 0.6. 
The problem is in _prepare_kernel_and_initrd function of DistroInstaller.py.

my command line is:

virt-install -n testredhat2 -r 1024 --vcpus=1 --disk path=/var/lib/libvirt/images/testredhat2.img,size=8 -l /mnt/ --initrd-inject=/home/gongys/redhat/ks.cfg  --extra-args "ks=file:/ks.cfg" --connect=qemu:///system --vnc -v --network bridge=br0  --dry-run -d
where my RHEL6.1-20110510.1-Server-x86_64-DVD1.iso is mounted at /mnt.

To fix it, I think we should add back three-line codes to set _install_bootconfig  before we inject the initram:
   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._install_bootconfig.kernel = kernelfn
        self._install_bootconfig.initrd = initrdfn
        self._install_bootconfig.kernel_args = args
        
        self._tmpfiles.append(kernelfn)
        if initrdfn:
            self._tmpfiles.append(initrdfn)

        if self._initrd_injections:
            self._perform_initrd_injections()

        # 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

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20111226/27e3ae27/attachment.htm>


More information about the virt-tools-list mailing list