Commit Graph

4 Commits

Author SHA1 Message Date
Daniel P. Berrange
b030084f07 Auto-add disk controllers based on defined disks
Existing applications using libvirt are not aware of the disk
controller concept. Thus, after parsing the <disk> definitions
in the XML, it is neccessary to create <controller> elements
to satisfy all requested disks, as per their defined drive
addresses

* src/conf/domain_conf.c, src/conf/domain_conf.h,
  src/libvirt_private.syms: Add virDomainDefAddDiskControllers()
  method for populating disk controllers, and call it after
  parsing disk definitions.
* src/qemu/qemu_conf.c: Call virDomainDefAddDiskControllers()
  when doing ARGV -> XML conversion
* tests/qemuxml2argvdata/qemuxml2argv*.xml: Add disk controller
  data to all data files which don't have it already
2010-01-18 13:35:40 +00:00
Daniel P. Berrange
776e37e1eb Set default disk controller/bus/unit props
When parsing the <disk> element specification, if no <address>
is provided for the disk, then automatically assign one based on
the <target dev='sdXX'/> device name. This provides for backwards
compatability with existing applications using libvirt, while also
allowing new apps to have complete fine grained control.

* src/conf/domain_conf.h, src/conf/domain_conf.c,
  src/libvirt_private.syms: Add virDomainDiskDefAssignAddress()
  for assigning a controller/bus/unit address based on disk target
* src/qemu/qemu_conf.c: Call virDomainDiskDefAssignAddress() after
  generating XML from ARGV
* tests/qemuxml2argvdata/*.xml: Add in drive address information
  to all XML files
2010-01-15 16:38:29 +00:00
Mark McLoughlin
73c901a807 Take domain type into account when looking up default machine
If one has e.g.

  <guest>
    <os_type>hvm</os_type>
    <arch name='x86_64'>
      <wordsize>64</wordsize>
      <emulator>/usr/bin/qemu-system-x86_64</emulator>
      <machine>pc-0.11</machine>
      <machine canonical='pc-0.11'>pc</machine>
      <machine>pc-0.10</machine>
      <machine>isapc</machine>
      <domain type='qemu'>
      </domain>
      <domain type='kvm'>
        <emulator>/usr/bin/kvm</emulator>
        <machine>pc</machine>
        <machine>isapc</machine>
      </domain>
    </arch>
  </guest>

and start a guest with:

  <domain type='kvm'>
    ...
    <os>
      <type arch='x86_64'>hvm</type>
      ...
    </os>
  </domain>

then the default machine type should be 'pc' and not 'pc-0.11'

Issue was reported by Anton Protopopov.

* src/capabilities.[ch]: pass the domain type to
  virCapabilitiesDefaultGuestArch() and use it to look up the default
  machine type from a specific guest domain if needed.

* src/conf/domain_conf.c, src/xen/xm_internal.c: update

* tests/qemuxml2argvdata/qemuxml2argv-machine-aliases2.xml: update
  the domain type to 'kvm' and remove the machine type to check
  that the default gets looked up correctly
2009-10-12 10:57:35 +01:00
Mark McLoughlin
e52d608ddf Test that domain-specific qemu machine types are used correctly
* tests/testutilsqemu.c: add a machine types list for /usr/bin/kvm
  which doesn't have any aliases, while the guest has aliases

* tests/qemuxml2argvdata/qemuxml2argv-machine-aliases2.*,
  tests/qemuxml2argvtest.c: add a test using /usr/bin/kvm and make
  sure that 'pc' machine type doesn't get canonicalized using the
  aliases in the guest machine type list
2009-09-10 12:37:43 +01:00