1. 21 10月, 2013 1 次提交
  2. 17 10月, 2013 1 次提交
  3. 15 10月, 2013 4 次提交
    • P
      qemu: command: Fix macro indentation · fe1bf917
      Peter Krempa 提交于
      fe1bf917
    • J
    • E
      maint: avoid 'const fooPtr' in qemu · 9a520a59
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in src/qemu.
      
      * src/qemu/qemu_bridge_filter.h (networkAllowMacOnPort)
      (networkDisallowMacOnPort): Use intended type.
      * src/qemu/qemu_bridge_filter.c (networkAllowMacOnPort)
      (networkDisallowMacOnPort): Likewise.
      * src/qemu/qemu_command.c (qemuBuildTPMBackendStr)
      (qemuBuildTPMDevStr, qemuBuildCpuArgStr)
      (qemuBuildObsoleteAccelArg, qemuBuildMachineArgStr)
      (qemuBuildSmpArgStr, qemuBuildNumaArgStr): Likewise.
      * src/qemu/qemu_conf.c (qemuSharedDeviceEntryCopy): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSaveImageStartVM): Likewise.
      * src/qemu/qemu_hostdev.c
      (qemuDomainHostdevNetConfigVirtPortProfile): Likewise.
      * src/qemu/qemu_monitor_json.c
      (qemuMonitorJSONAttachCharDevCommand): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      9a520a59
    • 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
  4. 10 10月, 2013 1 次提交
    • P
      qemu: Prefer VFIO for PCI device passthrough · f094aaac
      Peter Krempa 提交于
      Prefer using VFIO (if available) to the legacy KVM device passthrough.
      
      With this patch a PCI passthrough device without the driver configured
      will be started with VFIO if it's available on the host. If not legacy
      KVM passthrough is checked and error is reported if it's not available.
      f094aaac
  5. 08 10月, 2013 1 次提交
  6. 03 10月, 2013 1 次提交
    • L
      qemu: check actual netdev type rather than config netdev type during init · 9881bfed
      Laine Stump 提交于
      This resolves:
      
         https://bugzilla.redhat.com/show_bug.cgi?id=1012824
         https://bugzilla.redhat.com/show_bug.cgi?id=1012834
      
      Note that a similar problem was reported in:
      
         https://bugzilla.redhat.com/show_bug.cgi?id=827519
      
      but the fix only worked for <interface type='hostdev'>, *not* for
      <interface type='network'> where the network itself was a pool of
      hostdevs.
      
      The symptom in both cases was this error message:
      
         internal error: Unable to determine device index for network device
      
      In both cases the cause was lack of proper handling for netdevs
      (<interface>) of type='hostdev' when scanning the netdev list looking
      for alias names in qemuAssignDeviceNetAlias() - those that aren't
      type='hostdev' have an alias of the form "net%d", while those that are
      hostdev use "hostdev%d". This special handling was completely lacking
      prior to the fix for Bug 827519 which was:
      
      When searching for the highest alias index, libvirt looks at the alias
      for each netdev and if it is type='hostdev' it ignores the entry. If
      the type is not hostdev, then it expects the "net%d" form; if it
      doesn't find that, it fails and logs the above error message.
      
      That fix works except in the case of <interface type='network'> where
      the network uses hostdev (i.e. the network is a pool of VFs to be
      assigned to the guests via PCI passthrough). In this case, the check
      for type='hostdev' would fail because it was done as:
      
           def->net[i]->type == VIR_DOMAIN_NET_TYPE_HOSTDEV
      
      (which compares what was written in the config) when it actually
      should have been:
      
          virDomainNetGetActualType(def->net[i]) == VIR_DOMAIN_NET_TYPE_HOSTDEV
      
      (which compares the type of netdev that was actually allocated from
      the network at runtime).
      
      Of course the latter wouldn't be of any use if the netdevs of
      type='network' hadn't already acquired their actual network connection
      yet, but manual examination of the code showed that this is never the
      case.
      
      While looking through qemu_command.c, two other places were found to
      directly compare the net[i]->type field rather than getting actualType:
      
      * qemuAssignDeviceAliases() - in this case, the incorrect comparison
        would cause us to create a "net%d" alias for a netdev with
        type='network' but actualType='hostdev'. This alias would be
        subsequently overwritten by the proper "hostdev%d" form, so
        everything would operate properly, but a string would be
        leaked. This patch also fixes this problem.
      
      * qemuAssignDevicePCISlots() - would defer assigning a PCI address to
        a netdev if it was type='hostdev', but not for type='network +
        actualType='hostdev'. In this case, the actual device usually hasn't
        been acquired yet anyway, and even in the case that it has, there is
        no practical difference between assigning a PCI address while
        traversing the netdev list or while traversing the hostdev
        list. Because changing it would be an effective NOP (but potentially
        cause some unexpected regression), this usage was left unchanged.
      9881bfed
  7. 25 9月, 2013 15 次提交
  8. 24 9月, 2013 8 次提交
  9. 20 9月, 2013 1 次提交
    • L
      qemu: use "ide" as device name for implicit SATA controller on Q35 · 30bb4c4b
      Laine Stump 提交于
      This resolves https://bugzilla.redhat.com/show_bug.cgi?id=1008903
      
      The Q35 machinetype has an implicit SATA controller at 00:1F.2 which
      isn't given the "expected" id of ahci0 by qemu when it's created. The
      original suggested solution to this problem was to not specify any
      controller for the disks that use the default controller and just
      specify "unit=n" instead; qemu should then use the first IDE or SATA
      controller for the disk.
      
      Unfortunately, this "solution" is ignorant of the fact that in the
      case of SATA disks, the "unit" attribute in the disk XML is actually
      *not* being used for the unit, but is instead used to specify the
      "bus" number; each SATA controller has 6 buses, and each bus only
      allows a single unit. This makes it nonsensical to specify unit='n'
      where n is anything other than 0. It also means that the only way to
      connect more than a single device to the implicit SATA controller is
      to explicitly give the bus names, which happen to be "ide.$n", where
      $n can be replaced by the disk's "unit" number.
      30bb4c4b
  10. 17 9月, 2013 3 次提交
  11. 09 9月, 2013 1 次提交
  12. 06 9月, 2013 2 次提交
    • E
      qemu: recognize -machine accel=kvm when parsing native · 2b1ef11c
      Eric Blake 提交于
      In Fedora 19, 'qemu-kvm' is a simple wrapper that calls
      'qemu-system-x86_64 -machine accel=kvm'.  Attempting
      to use 'virsh qemu-attach $pid' to a machine started as:
      
      qemu-kvm -cdrom /var/lib/libvirt/images/foo.img \
       -monitor unix:/tmp/demo,server,nowait -name foo \
       --uuid cece4f9f-dff0-575d-0e8e-01fe380f12ea
      
      was failing with:
      error: XML error: No PCI buses available
      
      because we did not see 'kvm' in the executable name read from
      /proc/$pid/cmdline, and tried to assign os.machine as
      "accel=kvm" instead of "pc"; this in turn led to refusal to
      recognize the pci bus.
      
      Noticed while investigating https://bugzilla.redhat.com/995312
      although there are still other issues to fix before that bug
      will be completely solved.
      
      I've concluded that the existing parser code for native-to-xml
      is a horrendous hodge-podge of ad-hoc approaches; I basically
      rewrote the -machine section to be a bit saner.
      
      * src/qemu/qemu_command.c (qemuParseCommandLine): Don't assume
      -machine argument is always appropriate for os.machine; set
      virtType if accel is present.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2b1ef11c
    • 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
  13. 05 9月, 2013 1 次提交