Bug 656353 - Creating a Windows VM with virtio disks fails
Summary: Creating a Windows VM with virtio disks fails
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: virt-manager
Version: 14
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: Cole Robinson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-11-23 15:25 UTC by David Huff
Modified: 2011-04-16 20:54 UTC (History)
8 users (show)

Fixed In Version: virt-manager-0.8.7-2.fc14
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-04-16 20:54:07 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
New version of python-virtinst-0.500.5-1.fc14.src.rpm (623.05 KB, application/octet-stream)
2011-01-25 20:41 UTC, Boris Derzhavets
bderzhavets: review+
Details

Description David Huff 2010-11-23 15:25:08 UTC
Description of problem:
When creating a new windows7 VM with virtio drivers it cannot see/activate the disks. 

Version-Release number of selected component (if applicable):
Seen on both F13 and F14...
my current desktop is F13 and has the folling versions however I can also reproduce on laptop running F14
libvirt-0.8.2-1.fc13.x86_64
virt-manager-0.8.5-1.fc13.noarch
python-virtinst-0.500.4-1.fc13.noarch

How reproducible:
Always

Steps to Reproduce:
1. Launch virt manager create a new windows 7 VM,
2. configure virtual hard disk to use virtio drivers not IDE
3. Also add a virtual floppy with the virtio drivers:
http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/
  
Actual results:
When the windows install boots up load the virtio dirvers from the floppy disk, the installer will see the disk however says: "windows cannot be installed to this disk, ensure that the disk's controller is enabled in the bios."

Expected results:
you can install to virtio disk.  also if you select ide the install works fine.

Additional info:
also seen when trying to install win 2008r2 with virtio disk as well.

Comment 1 David Huff 2010-11-23 15:29:09 UTC
libvirt xml created by virt-manager....

[root@folly ~]# virsh list
 Id Name                 State
----------------------------------
  4 win7                 running

[root@folly ~]# virsh dumpxml 4
<domain type='kvm' id='4'>
  <name>win7</name>
  <uuid>2ac879ae-04fe-2fcd-6756-169ac21a23b9</uuid>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='fedora-13'>hvm</type>
    <boot dev='cdrom'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='localtime'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/tmp/en_windows_7_enterprise_x86_dvd_x15-70745.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/win7.img'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
    <disk type='file' device='floppy'>
      <driver name='qemu' type='raw'/>
      <source file='/tmp/virtio-win-1.1.11-0.vfd'/>
      <target dev='fda' bus='fdc'/>
      <alias name='fdc0-0-0'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='fdc' index='0'>
      <alias name='fdc0'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:2b:35:f4'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/2'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes'/>
    <sound model='ac97'>
      <alias name='sound0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </sound>
    <video>
      <model type='vga' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
  </devices>
  <seclabel type='dynamic' model='selinux'>
    <label>system_u:system_r:svirt_t:s0:c537,c838</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c537,c838</imagelabel>
  </seclabel>
</domain>

Comment 2 Rob Washburn 2010-12-17 15:17:51 UTC
I am also suffering at the hands of this bug.  Unfortunately this has been around for a while, since F12, and to my knowledge was never fixed.  This is a regression - the issue does not exist under RHEL 5.

https://bugzilla.redhat.com/show_bug.cgi?id=543435

Using the very latest virtIO .vfd build does not remedy this issue.

http://download.lab.bos.redhat.com/devel/RHEV/virtio-win/1.1.16/

Comment 3 Cole Robinson 2010-12-17 16:03:12 UTC
Probably want to refrain from posting internal links in external BZs.

Not sure exactly why this works on RHEL5 and not on F14/RHEL6 (must have been a libvirt or qemu change), but I think I've fixed this with a virtinst change:

http://hg.fedorahosted.org/hg/python-virtinst/rev/acdf26e10a4d

Basically we make sure that libvirt is marking the virtio disks as bootable. Right now I'm installing a windows 7 guest on F14 using virtio drivers with the virt-install command:

sudo ./virt-install --name win7 --ram 1024 --disk /var/lib/libvirt/hdimages/win7.img,size=10,bus=virtio --disk /mnt/data/media/virtio-win-1.1.16.vfd,device=floppy --os-variant win7 --cdrom /mnt/data/media/win7_64.iso --cpu host

Comment 4 Rob Washburn 2010-12-17 17:10:48 UTC
Cool. Can I take advantage of this on the build of F14 currently installed on my laptop?

Comment 5 Cole Robinson 2010-12-17 17:24:45 UTC
This is all upstream only at the moment, but will be in f14 eventually. You can kinda fake it though. Basically:

virt-install ... --disk /your/disk/img,bus=virtio --disk /your/virtio/floppy,device=floppy --disk /your/windows/cdrom,device=cdrom --boot cdrom,hd ...

That will start the first stage of the windows install and should allow installing the virtio drivers. However, it configures the guest to permanently boot off CD. So once the install completes, you will want to use virt-manager to change the boot order or eject the CDROM media.

Comment 6 Rob Washburn 2010-12-17 17:46:03 UTC
I just gave that a try - I still run into the same problem once the windows installer launches. After loading the viostor driver from the .vfd Windows can see the VirtIO disk but it is listed as being offline and thus an invalid install target.

Comment 7 Cole Robinson 2010-12-17 17:51:18 UTC
Please provide either the output of that command with the --debug flag. You will probably need to virsh undefine your existing guest first.

Comment 8 Rob Washburn 2010-12-17 18:16:37 UTC
virt-install --name w2k8r2 --ram 1024 --disk /var/lib/libvirt/images/w2k8r2.img,size=10,bus=virtio --disk /var/lib/libvirt/images/virtio-win-1.1.16.vfd,device=floppy --os-variant win2k8 --cdrom /var/lib/libvirt/images/en_windows_server_2008_r2_standard_enterprise_datacenter_web_x64_dvd_x15-50365.iso --vnc --debug


Fri, 17 Dec 2010 13:11:18 DEBUG    Launched with command line:
/usr/bin/virt-install --name w2k8r2 --ram 1024 --disk /var/lib/libvirt/images/w2k8r2.img,size=10,bus=virtio --disk /var/lib/libvirt/images/virtio-win-1.1.16.vfd,device=floppy --os-variant win2k8 --cdrom /var/lib/libvirt/images/en_windows_server_2008_r2_standard_enterprise_datacenter_web_x64_dvd_x15-50365.iso --vnc --debug
Fri, 17 Dec 2010 13:11:18 DEBUG    Requesting libvirt URI default
Fri, 17 Dec 2010 13:11:18 DEBUG    Received libvirt URI qemu:///system
Fri, 17 Dec 2010 13:11:18 DEBUG    Requesting virt method 'default', hv type 'default'.
Fri, 17 Dec 2010 13:11:18 DEBUG    Received virt method 'hvm'
Fri, 17 Dec 2010 13:11:18 DEBUG    Hypervisor name is 'kvm'
Fri, 17 Dec 2010 13:11:18 DEBUG    parse_disk: returning {'format': None, 'bus': 'virtio', 'readOnly': False, 'volInstall': None, 'path': '/var/lib/libvirt/images/w2k8r2.img', 'device': 'disk', 'volName': None, 'conn': <libvirt.virConnect instance at 0x2b0a998>, 'size': 10.0, 'driverType': None, 'driverCache': None, 'shareable': False, 'driverName': None, 'sparse': True}
Fri, 17 Dec 2010 13:11:18 DEBUG    Path '/var/lib/libvirt/images' is target for pool 'default'. Creating volume 'w2k8r2.img'.
Fri, 17 Dec 2010 13:11:18 DEBUG    parse_disk: returning {'format': None, 'bus': None, 'readOnly': False, 'volInstall': None, 'path': '/var/lib/libvirt/images/virtio-win-1.1.16.vfd', 'device': 'floppy', 'volName': None, 'conn': <libvirt.virConnect instance at 0x2b0a998>, 'size': None, 'driverType': None, 'driverCache': None, 'shareable': False, 'driverName': None, 'sparse': True}
Fri, 17 Dec 2010 13:11:18 DEBUG    Setting os type to 'windows' for variant 'win2k8'
Fri, 17 Dec 2010 13:11:18 DEBUG    DistroInstaller location is a local file/path: /var/lib/libvirt/images/en_windows_server_2008_r2_standard_enterprise_datacenter_web_x64_dvd_x15-50365.iso

Starting install...
Fri, 17 Dec 2010 13:11:18 DEBUG    Creating storage volume 'w2k8r2.img' with xml:
<volume>
  <name>w2k8r2.img</name>
  <capacity>10737418240</capacity>
  <allocation>0</allocation>
  <target>
    <format type='raw'/>
  </target>
</volume>

Allocating 'w2k8r2.img'                                                             |  10 GB     00:00     
Fri, 17 Dec 2010 13:11:19 DEBUG    Storage volume 'w2k8r2.img' install complete.
Fri, 17 Dec 2010 13:11:19 DEBUG    Generated install XML: 
<domain type='kvm'>
  <name>w2k8r2</name>
  <currentMemory>1048576</currentMemory>
  <memory>1048576</memory>
  <uuid>61b6589e-be84-f11c-22a9-a7100bcbe3e8</uuid>
  <os>
    <type arch='x86_64'>hvm</type>
    <boot dev='cdrom'/>
  </os>
  <features>
    <acpi/><apic/><pae/>
  </features>
  <clock offset="localtime"/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>destroy</on_reboot>
  <on_crash>destroy</on_crash>
  <vcpu>1</vcpu>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/w2k8r2.img'/>
      <target dev='vda' bus='virtio'/>
    </disk>
    <disk type='file' device='floppy'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/virtio-win-1.1.16.vfd'/>
      <target dev='fda' bus='fdc'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/en_windows_server_2008_r2_standard_enterprise_datacenter_web_x64_dvd_x15-50365.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
    </disk>
    <interface type='network'>
      <source network='default'/>
      <mac address='52:54:00:46:42:96'/>
    </interface>
    <input type='tablet' bus='usb'/>
    <graphics type='vnc' port='-1' keymap='en-us'/>
    <console type='pty'/>
    <video>
      <model type='vga'/>
    </video>
  </devices>
</domain>

Fri, 17 Dec 2010 13:11:19 DEBUG    Couldn't lookup storage volume in prog thread.
Creating domain...                                                                  |    0 B     00:00     
Fri, 17 Dec 2010 13:11:19 DEBUG    Started guest, looking to see if it is running
Fri, 17 Dec 2010 13:11:19 DEBUG    Launching console callback
Fri, 17 Dec 2010 13:11:19 DEBUG    Generated boot XML: 
<domain type='kvm'>
  <name>w2k8r2</name>
  <currentMemory>1048576</currentMemory>
  <memory>1048576</memory>
  <uuid>61b6589e-be84-f11c-22a9-a7100bcbe3e8</uuid>
  <os>
    <type arch='x86_64'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/><apic/><pae/>
  </features>
  <clock offset="localtime"/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <vcpu>1</vcpu>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/w2k8r2.img'/>
      <target dev='vda' bus='virtio'/>
    </disk>
    <disk type='file' device='floppy'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/virtio-win-1.1.16.vfd'/>
      <target dev='fda' bus='fdc'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/en_windows_server_2008_r2_standard_enterprise_datacenter_web_x64_dvd_x15-50365.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
    </disk>
    <interface type='network'>
      <source network='default'/>
      <mac address='52:54:00:46:42:96'/>
    </interface>
    <input type='tablet' bus='usb'/>
    <graphics type='vnc' port='-1' keymap='en-us'/>
    <console type='pty'/>
    <video>
      <model type='vga'/>
    </video>
  </devices>
</domain>

Comment 9 Rob Washburn 2010-12-17 18:49:31 UTC
That's as far as I get.  This is the message I get hit with after loading the viostor driver from the .vfd and attempting to proceed with the installation on the detected 10.0 GB virtio disk:

Windows cannot be installed to this disk. This computer's hardware may not support booting to this disk.  Ensure that this disk's controller is enabled in the computer's BIOS menu.

Comment 10 Cole Robinson 2010-12-17 18:50:04 UTC
2 problems: You are specifying --cdrom, when you should be specifying --disk PATH,device=cdrom (there is a difference in this case), and you are not specifying --boot cdrom,hd  . please take another look at comment #5

Comment 11 Boris Derzhavets 2011-01-20 20:33:11 UTC
Command line :-

# virt-install --name win7 --ram 1024 --disk
/var/lib/libvirt/hdimages/win7.img,size=10,bus=virtio --disk
/mnt/data/media/virtio-win-1.1.16.vfd,device=floppy --os-variant win7 --cdrom
/mnt/data/media/win7_64.iso --cpu host

suggested in Comment 3 works fine on 

1. Ubuntu 10.10 KVM Server Libvirt 0.8.3 & Qemu 0.12.5
2. Ubuntu 10.04.1 KVM Server Libvirt 0.8.3 & Qemu 0.12.5
3. Scientific Linux 6 (alplha 4) KVM Server Libvirt 0.8.1 & Qemu 0.12.1

and fails on F14 Libvirt 0.8.7 & Qemu 0.13.0

Comment 12 Boris Derzhavets 2011-01-24 17:40:43 UTC
I believe the correct patch for Installer.py

17.1 --- a/virtinst/Installer.py	Wed Dec 15 15:19:04 2010 -0500
17.2 +++ b/virtinst/Installer.py	Wed Dec 15 15:53:53 2010 -0500
17.3 @@ -265,6 +265,21 @@
17.4      def _get_bootdev(self, isinstall, guest):
17.5          raise NotImplementedError
17.6  
17.7 +    def _build_boot_order(self, isinstall, guest):
17.8 +        bootorder = [self._get_bootdev(isinstall, guest)]
17.9 +
17.10 +        # If guest has an attached disk, always have 'hd' in the boot
17.11 +        # list, so disks are marked as bootable/installable (needed for
17.12 +        # windows virtio installs, and booting local disk from PXE)
17.13 +        for disk in guest.get_devices("disk"):
17.14 +            if disk.device == disk.DEVICE_DISK:
17.15 +                bootdev = self.bootconfig.BOOT_DEVICE_HARDDISK
17.16 +                if bootdev not in bootorder:
17.17 +                    bootorder.append(bootdev)
17.18 +                break
17.19 +
17.20 +        return bootorder
17.21 +
17.22      def _get_osblob_helper(self, guest, isinstall, bootconfig):
17.23          ishvm = self.os_type == "hvm"
17.24          conn = guest.conn
17.25 @@ -321,10 +336,10 @@
17.26          if isinstall and not self.has_install_phase():
17.27              return
17.28  
17.29          bootdev = self._get_bootdev(isinstall, guest)
17.30 +        bootorder = self._build_boot_order(isinstall, guest)
17.31          bootconfig = copy.copy(bootconfig)
17.32          if not bootconfig.bootorder:
17.33 -            bootconfig.bootorder = [bootdev]
17.34 +            bootconfig.bootorder = bootorder
17.35  
17.36          return self._get_osblob_helper(guest, isinstall, bootconfig)
17.37  

Sign (-) at line 17.29 caused for me failure to start virt-install.

[root@fedora14kvm ~]# virt-install --connect qemu:///system --virt-type kvm \
> --name W7V64 --ram 2048 --disk path=/dev/vg_kvms/vm01,bus=virtio \
> --disk /usr/tmp/virtio-win-1.1.16.vfd,device=floppy \
> --os-variant win7 \
> --cdrom /usr/tmp/Win7_64.iso --vcpus 2
ERROR    global name 'bootdev' is not defined

python-virtinst-0.500.4-1.fc14.src.rpm has been installed , patched as above
rebuilt and python-virtinst-0.500.4-1.fc14.noarch.rpm reinstalled on F14

# virt-install --connect qemu:///system --virt-type kvm \
> --name W7V64 --ram 2048 --disk path=/dev/vg_kvms/vm01,bus=virtio \
> --disk /usr/tmp/virtio-win-1.1.16.vfd,device=floppy \
> --os-variant win7 \
> --cdrom /usr/tmp/Win7_64.iso --vcpus 2

Starting install...
Creating domain...                                                                          |    0 B     00:00     
Domain installation still in progress. Waiting for installation to complete.
Domain has shutdown. Continuing.
Starting domain...                                                                          |    0 B     00:00     
Domain installation still in progress. Waiting for installation to complete.
Domain has shutdown. Continuing.
Guest installation complete... restarting guest.

Comment 13 Boris Derzhavets 2011-01-25 20:06:19 UTC
Another option :-
# cd ../SOURCES
# wget http://virt-manager.org/download/sources/virtinst/virtinst-0.500.5.tar.gz
# cd ../SPECS
# Update  in python-virtinst.spec 
  Version: 0.500.5
Save
# rpmbuild -ba ./python-virtinst.spec
# cd ../RPMS/noarch
# yum install python-virtinst-0.500.5-1.fc14.noarch.rpm

Comment 14 Boris Derzhavets 2011-01-25 20:41:46 UTC
Created attachment 475268 [details]
New version of python-virtinst-0.500.5-1.fc14.src.rpm

Seems to be a new version of python-virtinst package for F14 (F15)

Comment 15 Fedora Update System 2011-03-31 17:12:57 UTC
virt-manager-0.8.7-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/virt-manager-0.8.7-1.fc14

Comment 16 Fedora Update System 2011-04-01 18:28:51 UTC
Package virt-manager-0.8.7-1.fc14:
* should fix your issue,
* was pushed to the Fedora 14 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing virt-manager-0.8.7-1.fc14'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/virt-manager-0.8.7-1.fc14
then log in and leave karma (feedback).

Comment 17 Fedora Update System 2011-04-07 14:30:31 UTC
virt-manager-0.8.7-2.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/virt-manager-0.8.7-2.fc14

Comment 18 Fedora Update System 2011-04-16 20:53:22 UTC
virt-manager-0.8.7-2.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.