sciurus / vagrant-mutate

Convert vagrant boxes to work with different providers
MIT License
281 stars 41 forks source link

KVM requires PCI address 0:0:1.1 for IDE controller #39

Closed sciurus closed 10 years ago

sciurus commented 10 years ago

/home/pittsb/.vagrant.d/gems/gems/vagrant-kvm-0.1.4/lib/vagrant-kvm/driver/driver.rb:165:in `define_domain_xml': Call to virDomainDefineXML failed: internal error: Primary IDE controller must have PCI address 0:0:1.1 (Libvirt::DefinitionError)

sciurus commented 10 years ago

I thought changing

  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>

to

 <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>

would be good enough but apparently there's something else I'm missing.

eagleas commented 10 years ago

Same error.

sciurus commented 10 years ago

If you find the solution please let me know. Otherwise I'll try to look at the issue this weekend.

@miurahr you are using boxes with IDE disks, correct? Have you run into this?

sciurus commented 10 years ago

@eaglas please reopen this if version 0.2.5 does not fix the error for you.

eagleas commented 10 years ago

@scliurus, this happen again, when box.xml contains:

<devices>
  <disk type='file' device='disk'>
    ...
    <target dev='vda' bus='pci'/>

Official box precise64.box (after mutate to kvm provider) contain bus='sata', but ffuenf box from: https://s3-eu-west-1.amazonaws.com/ffuenf-vagrant-boxes/ubuntu/ubuntu-12.04.3-server-amd64.box (linked from http://www.dev-metal.com/list-downloadable-vagrant-boxes-centos-5-9-6-4-ubuntu-12-13-debian-6-7-7-1-7-2/) contain bus='pci'. I don't know why. Changing to value to 'sata' fix error. vagrant-mutate-0.2.5, of course.

sciurus commented 10 years ago

Hmm, maybe there is a bug in the disk_interface method for VagrantMutate::Box::Virtualbox. It should return either ide, scsi, or sata. not pci. I'll take a look

sciurus commented 10 years ago

Sorry for taking a while to look at this. @eagleas I cannot reproduce the error you saw. After I convert the box I get this box.xml. Notice that vda is ide, not pci.

<domain type='kvm'>
<name>debug-disk</name>

<memory unit='KiB'>524288</memory>
<currentMemory unit='KiB'>524288</currentMemory>
<vcpu placement='static'>1</vcpu>
  <os>
  <type arch='x86_64' machine='pc-1.2'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='box-disk1.img'/>
      <target dev='vda' bus='ide'/>

      <address type='drive' controller='0' bus='0' target='0' unit='0'/>

    </disk>
    <interface type='network'>
      <mac address='08:00:27:A8:E6:57'/>
      <source network='vagrant'/>
      <model type='virtio'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>

    <graphics type='vnc' port='-1' autoport='yes'/>

    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </memballoon>
  </devices>
</domain>