1. 15 10月, 2013 1 次提交
    • E
      maint: fix awkward typing of virDomainChrGetDomainPtrs · f8fa2b3e
      Eric Blake 提交于
      virDomainChrGetDomainPtrs() required 4 levels of pointers (taking
      a parameter that will be used as an output variable to return the
      address of another variable that contains an array of pointers).
      This is rather complex to reason about, especially when outside
      of the domain_conf file, no other caller should be modifying
      the resulting array of pointers directly.  Changing the public
      signature gives something is easier to reason with, and actually
      make const-correct; which is important as it was the only function
      that was blocking virDomainDeviceDefCopy from treating its source
      as const.
      
      * src/conf/domain_conf.h (virDomainChrGetDomainPtrs): Use simpler
      types, and make const-correct for external users.
      * src/conf/domain_conf.c (virDomainChrGetDomainPtrs): Split...
      (virDomainChrGetDomainPtrsInternal): ...into an internal version
      that lets us modify terms, vs. external form that is read-only.
      (virDomainDeviceDefPostParseInternal, virDomainChrFind)
      (virDomainChrInsert): Adjust callers.
      * src/qemu/qemu_command.c (qemuGetNextChrDevIndex): Adjust caller.
      (qemuDomainDeviceAliasIndex): Make const-correct.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f8fa2b3e
  2. 09 10月, 2013 1 次提交
    • J
      LXC: Fix handling of RAM filesystem size units · 3f029fb5
      Ján Tomko 提交于
      Since 76b644c3 when the support for RAM filesystems was introduced,
      libvirt accepted the following XML:
      <source usage='1024' unit='KiB'/>
      
      This was parsed correctly and internally stored in bytes, but it
      was formatted as (with an extra 's'):
      <source usage='1024' units='KiB'/>
      When read again, this was treated as if the units were missing,
      meaning libvirt was unable to parse its own XML correctly.
      
      The usage attribute was documented as being in KiB, but it was not
      scaled if the unit was missing. Transient domains still worked,
      because this was balanced by an extra 'k' in the mount options.
      
      This patch:
      Changes the parser to use 'units' instead of 'unit', as the latter
      was never documented (fixing persistent domains) and some programs
      (libvirt-glib, libvirt-sandbox) already parse the 'units' attribute.
      
      Removes the extra 'k' from the tmpfs mount options, which is needed
      because now we parse our own XML correctly.
      
      Changes the default input unit to KiB to match documentation, fixing:
      https://bugzilla.redhat.com/show_bug.cgi?id=1015689
      3f029fb5
  3. 04 10月, 2013 1 次提交
    • C
      test: Implement snapshot create/delete/revert APIs · 390c06b6
      Cole Robinson 提交于
      Again stolen from qemu_driver.c, but dropping all the unneeded bits.
      This aims to copy all the current qemu validation checks since that's
      the most commonly used real driver, but some of the checks are
      completely artificial in the test driver.
      
      This only supports creation of internal snapshots for initial
      simplicity.
      390c06b6
  4. 26 9月, 2013 2 次提交
    • P
      conf: clean up virDomainChrSourceDefParseXML · 0dd948cb
      Peter Krempa 提交于
      Tweak some conditions and use correct typecasts in enums.
      0dd948cb
    • P
      conf: Don't crash on invalid chardev source definition of RNGs and other · 79552754
      Peter Krempa 提交于
      Since commit 297c99a5 an invalid source definition XML of a character
      device that is used as backend for RNG devices, smartcards and redirdevs
      causes crash of the daemon when parsing such a definition.
      
      The device types mentioned above are not a part of a regular character
      device but are backends for other types. Thus when parsing such device
      NULL is passed as the argument @chr_def. Later when checking the
      validity of the definition @chr_def was dereferenced when parsing a UNIX
      socket backend with missing path of the socket and crashed the daemon.
      
      Sample offending configuration:
        <devices>
        ...
          <rng model='virtio'>
            <backend model='egd' type='unix'>
              <source mode='bind' service='1024'/>
            </backend>
          </rng>
        </devices>
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1012196
      79552754
  5. 25 9月, 2013 5 次提交
  6. 24 9月, 2013 2 次提交
  7. 23 9月, 2013 1 次提交
    • P
      conf: Do better job when comparing features ABI compatibility · 5702c014
      Peter Krempa 提交于
      The ABI compatibility check for domain features didn't check the
      expanded HyperV and APIC EOI values, thus possibly allowing change in
      guest ABI.
      
      Add the check and use typecasted switch statement to warn developers
      when adding a new HyperV feature.
      5702c014
  8. 18 9月, 2013 1 次提交
    • D
      Allow <source> for type=block to have no dev · 4b5652d0
      Doug Goldstein 提交于
      Currently the XML parser already allows the following syntax:
        <disk type='block' device='cdrom'>
          <source startupPolicy='optional'/>
          <target dev='hda' bus='ide'/>
          <address type='drive' controller='0' bus='0' target='0' unit='0'/>
        </disk>
      
      But it if the dev value is NULL then it would not have the leading
      "<source ", resulting in invalid XML.
      4b5652d0
  9. 17 9月, 2013 11 次提交
  10. 11 9月, 2013 1 次提交
  11. 06 9月, 2013 1 次提交
    • E
      qemu: only parse basename when determining emulator properties · 6a373fb2
      Eric Blake 提交于
      'virsh domxml-from-native' and 'virsh qemu-attach' could misbehave
      for an emulator installed in (a somewhat unlikely) location
      such as /usr/local/qemu-1.6/qemu-system-x86_64 or (an even less
      likely) /opt/notxen/qemu-system-x86_64.  Limit the strstr seach
      to just the basename of the file where we are assuming details
      about the binary based on its name.
      
      While testing, I accidentally triggered a core dump during strcmp
      when I forgot to set os.type on one of my code paths; this patch
      changes such a coding error to raise a nicer internal error instead.
      
      * src/qemu/qemu_command.c (qemuParseCommandLine): Compute basename
      earlier.
      * src/conf/domain_conf.c (virDomainDefPostParseInternal): Avoid
      NULL deref.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6a373fb2
  12. 05 9月, 2013 3 次提交
    • L
      virDomainDeviceIsUSB: Drop check for USB controller · ce78098e
      Liuji (Jeremy) 提交于
      Delete the USB controller check from the USB Device checklist in
      virDomainDeviceIsUSB as USB controller is a PCI device rather than
      a USB one.
      Signed-off-by: NLiu Ji <jeremy.liu@huawei.com>
      ce78098e
    • D
      Stop free'ing 'const char *' strings · bbcdd9b5
      Daniel P. Berrange 提交于
      The VIR_FREE() macro will cast away any const-ness. This masked a
      number of places where we passed a 'const char *' string to
      VIR_FREE. Fortunately in all of these cases, the variable was not
      in fact const data, but a heap allocated string. Fix all the
      variable declarations to reflect this.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      bbcdd9b5
    • P
      conf: Don't deref NULL actual network in virDomainNetGetActualHostdev() · a3d24862
      Peter Krempa 提交于
      In commit 991270db I've used virDomainNetGetActualHostdev() to get
      the actual hostdev from a network when removing the network from the
      list to avoid leaving the hostdev in the list. I didn't notice that this
      function doesn't check if the actual network is allocated and
      dereferences it. This crashes the daemon when cleaning up a domain
      object in early startup phases when the actual network definition isn't
      allocated. When the actual definition isn't present, the hostdev that
      might correspond to it won't be present anyways so it's safe to return
      NULL.
      
      Thanks to Cole Robinson for noticing this problem.
      a3d24862
  13. 04 9月, 2013 1 次提交
    • P
      conf: Remove the actual hostdev when removing a network · 991270db
      Peter Krempa 提交于
      Commit 50348e6e reused the code to remove the hostdev portion of a
      network definition on multiple places but forgot to take into account
      that sometimes the "actual" network is passed and in some cases the
      parent of that.
      
      This patch uses the virDomainNetGetActualHostdev() helper to acquire the
      correct pointer all the time while removing the hostdev portion from the
      list.
      991270db
  14. 03 9月, 2013 3 次提交
    • C
      qemu: Support virtio-mmio transport for virtio on ARM · 4fa17221
      Cole Robinson 提交于
      Starting with qemu 1.6, the qemu-system-arm vexpress-a9 model has a
      hardcoded virtio-mmio transport which enables attaching all virtio
      devices.
      
      On the command line, we have to use virtio-XXX-device rather than
      virtio-XXX-pci, thankfully s390 already set the precedent here so
      it's fairly straight forward.
      
      At the XML level, this adds a new device address type virtio-mmio.
      The controller and addressing don't have any subelements at the
      moment because we they aren't needed for this usecase, but could
      be added later if needed.
      
      Add a test case for an ARM guest with one of every virtio device
      enabled.
      4fa17221
    • C
      domain_conf: Add disk bus=sd, wire it up for qemu · 3730353f
      Cole Robinson 提交于
      This corresponds to '-sd' and '-drive if=sd' on the qemu command line.
      Needed for many ARM boards which don't provide any other way to
      pass in storage.
      3730353f
    • C
      domain_conf: Add default memballoon in PostParse callbacks · d40cde31
      Cole Robinson 提交于
      This should be a no-op change for now.
      d40cde31
  15. 02 9月, 2013 1 次提交
    • F
      qemu: Support setting the 'removable' flag for USB disks · feba2feb
      Fred A. Kemp 提交于
      Add an attribute named 'removable' to the 'target' element of disks,
      which controls the removable flag. For instance, on a Linux guest it
      controls the value of /sys/block/$dev/removable. This option is only
      valid for USB disks (i.e. bus='usb'), and its default value is 'off',
      which is the same behaviour as before.
      
      To achieve this, 'removable=on' (or 'off') is appended to the '-device
      usb-storage' parameter sent to qemu when adding a USB disk via
      '-disk'. A capability flag QEMU_CAPS_USB_STORAGE_REMOVABLE was added
      to keep track if this option is supported by the qemu version used.
      
      Bug: https://bugzilla.redhat.com/show_bug.cgi?id=922495Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      feba2feb
  16. 29 8月, 2013 1 次提交
    • P
      qemu: Remove hostdev entry when freeing the depending network entry · 50348e6e
      Peter Krempa 提交于
      When using a <interface type="network"> that points to a network with
      hostdev forwarding mode a hostdev alias is created for the network. This
      allias is inserted into the hostdev list, but is backed with a part of
      the network object that it is connected to.
      
      When a VM is being stopped qemuProcessStop() calls
      networkReleaseActualDevice() which eventually frees the memory for the
      hostdev object. Afterwards when the domain definition is being freed by
      virDomainDefFree() an invalid pointer is accessed by
      virDomainHostdevDefFree() and may cause a crash of the daemon.
      
      This patch removes the entry in the hostdev list before freeing the
      depending memory to avoid this issue.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1000973
      50348e6e
  17. 27 8月, 2013 4 次提交