1. 02 2月, 2012 2 次提交
    • E
      block rebase: initial qemu implementation · 9f902a2e
      Eric Blake 提交于
      This is a trivial implementation, which works with the current
      released qemu 1.0 with backports of preliminary block pull but
      no partial rebase.  Future patches will update the monitor handling
      to support an optional parameter for partial rebase; but as qemu
      1.1 is unreleased, it can be in later patches, designed to be
      backported on top of the supported API.
      
      * src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Add parameter,
      and adjust callers.  Drop redundant check.
      (qemuDomainBlockPull): Move guts...
      (qemuDomainBlockRebase): ...to new function.
      9f902a2e
    • P
      qemu: Add support for virDomainGetMetadata and virDomainSetMetadata · 21d13ddc
      Peter Krempa 提交于
      This patch adds support for the new api into the qemu driver to support
      modification and retrieval of domain description and title. This patch
      does not add support for modifying the <metadata> element.
      21d13ddc
  2. 01 2月, 2012 5 次提交
  3. 31 1月, 2012 3 次提交
    • L
      qemu: add "romfile" support to specify device boot ROM · 3801831c
      Laine Stump 提交于
      This patch addresses: https://bugzilla.redhat.com/show_bug.cgi?id=781562
      
      Along with the "rombar" option that controls whether or not a boot rom
      is made visible to the guest, qemu also has a "romfile" option that
      allows specifying a binary file to present as the ROM BIOS of any
      emulated or passthrough PCI device. This patch adds support for
      specifying romfile to both passthrough PCI devices, and emulated
      network devices that attach to the guest's PCI bus (just about
      everything other than ne2k_isa).
      
      One example of the usefulness of this option is described in the
      bugzilla report: 82576 sriov network adapters don't provide a ROM BIOS
      for the cards virtual functions (VF), but an image of such a ROM is
      available, and with this ROM visible to the guest, it can PXE boot.
      
      In libvirt's xml, the new option is configured like this:
      
         <hostdev>
           ...
           <rom file='/etc/fake/boot.bin'/>
           ...
         </hostdev
      
      (similarly for <interface>).
      3801831c
    • L
      qemu: (and conf) support rombar for network devices · 3284ac04
      Laine Stump 提交于
      When support for the rombar option was added, it was only added for
      PCI passthrough devices, configured with <hostdev>. The same option is
      available for any network device that is attached to the guest's PCI
      bus. This patch allows setting rombar for any PCI network device type.
      
      After adding cases to test this to qemuxml2argv-hostdev-pci-rombar.*,
      I decided to rename those files (to qemuxml2argv-pci-rom.*) to more
      accurately reflect the additional tests, and also noticed that up to
      now we've only been performing a domainschematest for that case, so I
      added the "pci-rom" test to both qemuxml2argv and qemuxml2xml (and in
      the process found some bugs whose fixes I squashed into previous
      commits of this series).
      3284ac04
    • L
      conf: put all guest-related HostdevDef data in one object · 159f4d0b
      Laine Stump 提交于
      To help consolidate the commonality between virDomainHostdevDef and
      virDomainNetDef into as few members as possible (and because I
      think it makes sense), this patch moves the rombar and bootIndex
      members into the "info" member that is common to both (and to all the
      other structs that use them).
      
      It's a bit problematic that this gives rombar and bootIndex to many
      device types that don't use them, but this is already the case for the
      master and mastertype members of virDomainDeviceInfo, and is properly
      commented as such in the definition.
      
      Note that this opens the door to supporting rombar for other devices
      that are attached to the guest PCI bus - virtio-blk-pci,
      virtio-net-pci, various other network adapters - which which have that
      capability in qemu, but previously had no support in libvirt.
      159f4d0b
  4. 30 1月, 2012 1 次提交
  5. 28 1月, 2012 2 次提交
    • E
      qemu: avoid double free of qemu help output · ab6f1c98
      Eric Blake 提交于
      If yajl was not compiled in, we end up freeing an incoming
      parameter, which leads to a bogus free later on.  Regression
      introduced in commit 6e769eba.
      
      * src/qemu/qemu_capabilities.c (qemuCapsParseHelpStr): Avoid alloc
      on failure path, which in turn fixes bogus free.
      Reported by Cole Robinson.
      ab6f1c98
    • D
      Rename virXXXXMacAddr to virMacAddrXXX · 4ce98dad
      Daniel P. Berrange 提交于
      Rename virFormatMacAddr, virGenerateMacAddr and virParseMacAddr
      to virMacAddrFormat, virMacAddrGenerate and virMacAddrParse
      respectively
      4ce98dad
  6. 27 1月, 2012 8 次提交
    • P
      qemu: parse and create -cpu ...,-kvmclock · b66d1bef
      Paolo Bonzini 提交于
      QEMU supports a bunch of CPUID features that are tied to the kvm CPUID
      nodes rather than the processor's.  They are "kvmclock",
      "kvm_nopiodelay", "kvm_mmu", "kvm_asyncpf".  These are not known to
      libvirt and their CPUID leaf might move if (for example) the Hyper-V
      extensions are enabled. Hence their handling would anyway require some
      special-casing.
      
      However, among these the most useful is kvmclock; an additional
      "property" of this feature is that a <timer> element is a better model
      than a CPUID feature.  Although, creating part of the -cpu command-line
      from something other than the <cpu> XML element introduces some
      ugliness.
      Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b66d1bef
    • P
      qemu: do not create useless <cpu> element · df8e6918
      Paolo Bonzini 提交于
      Avoid creating an empty <cpu> element when the QEMU command-line simply
      specifies the default "-cpu qemu32" or "-cpu qemu64".
      
      This requires the previous patch, which lets us represent "-cpu qemu32"
      as <os arch='i686'> in the generated XML.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      df8e6918
    • P
      qemu: get arch name from <cpu> element · d5e88b2c
      Paolo Bonzini 提交于
      The qemu32 CPU model is chosen based on the <os arch=...> name when
      creating the QEMU command line for a 64-bit host.  For the opposite
      transformation we can test the guest CPU model for the "lm" feature.
      If it is absent, def->os.arch needs to be corrected.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      d5e88b2c
    • P
      qemu: detect arch correctly for KVM · 4be541a6
      Paolo Bonzini 提交于
      When running under KVM, the arch is usually set to i686 because
      the name of the emulator is not qemu-system-x86_64.  Use the host
      arch instead.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      4be541a6
    • P
      qemu: parse -enable-kvm · 4a00c099
      Paolo Bonzini 提交于
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      4a00c099
    • E
      qemu: require qmp on new enough qemu · 6e769eba
      Eric Blake 提交于
      The qemu developers have made it clear that modern qemu will no
      longer guarantee human monitor command stability; furthermore,
      some features, such as async events, are only supported via qmp.
      If we are compiled without support for handling JSON, we cannot
      expect to sanely interact with modern qemu.
      
      However, things must continue to build on RHEL 5, where qemu
      is stuck at 0.10, and where yajl is not available.
      
      Another benefit of this patch: future additions of new monitor
      commands need only focus on qemu_monitor_json.c, instead of
      also wasting time with qemu_monitor_text.c.
      
      * src/qemu/qemu_capabilities.c (qemuCapsComputeCmdFlags): Report
      error if yajl is missing but qemu requires qmp.
      (qemuCapsParseHelpStr): Propagate error.
      (qemuCapsExtractVersionInfo): Update caller.
      * tests/qemuhelptest.c (testHelpStrParsing): Likewise.
      6e769eba
    • E
      qemu: support qmp on RHEL/CentOS qemu · ff88cd59
      Eric Blake 提交于
      I'm getting tired of remembering to backport RHEL-specific
      patches when building upstream libvirt on RHEL 6.x or CentOS.
      All the affected versions of RHEL qemu-kvm have backported
      enough patches to a) make JSON useful, and b) modify the
      -help text to mention libvirt as the preferred interface;
      which means this string in the help output is a reliable
      indicator that we can outsmart a strict version check,
      even when upstream qemu 0.12 lacked the needed features.
      
      * src/qemu/qemu_capabilities.c (qemuCapsComputeCmdFlags):
      Recognize particular help string present when enough features were
      backported to be worth using JSON.
      * tests/qemuhelptest.c (mymain): Update tests accordingly.
      ff88cd59
    • J
      qemu: Refactor qemuMonitorGetBlockInfo · 65c27e29
      Jiri Denemark 提交于
      QEMU always sends details about all available block devices as an answer
      for "info block"/"query-block" command. On the other hand, our
      qemuMonitorGetBlockInfo was made for a single block devices queries
      only. Thus, when asking for multiple devices, we asked qemu multiple
      times to always get the same answer from which different parts were
      filtered. This patch makes qemuMonitorGetBlockInfo return a hash table
      of all block devices, which may later be used for getting details about
      specific devices.
      65c27e29
  7. 26 1月, 2012 1 次提交
  8. 25 1月, 2012 3 次提交
  9. 24 1月, 2012 2 次提交
    • D
      Wire up QEMU agent to reboot/shutdown APIs · fb52a399
      Daniel P. Berrange 提交于
      This makes use of the QEMU guest agent to implement the
      virDomainShutdownFlags and virDomainReboot APIs. With
      no flags specified, it will prefer to use the agent, but
      fallback to ACPI. Explicit choice can be made by using
      a suitable flag
      
      * src/qemu/qemu_driver.c: Wire up use of agent
      fb52a399
    • D
      QEMU guest agent support · c160ce33
      Daniel P. Berrange 提交于
      There is now a standard QEMU guest agent that can be installed
      and given a virtio serial channel
      
          <channel type='unix'>
            <source mode='bind' path='/var/lib/libvirt/qemu/f16x86_64.agent'/>
            <target type='virtio' name='org.qemu.guest_agent.0'/>
          </channel>
      
      The protocol that runs over the guest agent is JSON based and
      very similar to the JSON monitor. We can't use exactly the same
      code because there are some odd differences in the way messages
      and errors are structured. The qemu_agent.c file is based on
      a combination and simplification of qemu_monitor.c and
      qemu_monitor_json.c
      
      * src/qemu/qemu_agent.c, src/qemu/qemu_agent.h: Support for
        talking to the agent for shutdown
      * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add thread
        helpers for talking to the agent
      * src/qemu/qemu_process.c: Connect to agent whenever starting
        a guest
      * src/qemu/qemu_monitor_json.c: Make variable static
      c160ce33
  10. 21 1月, 2012 2 次提交
    • E
      maint: cleanup qemu capabilities · 32b57a72
      Eric Blake 提交于
      Fix inconsistent whitespace and long lines.
      
      * src/qemu/qemu_capabilities.h (qemuCapsFlags): Improve formatting.
      32b57a72
    • E
      maint: enforce use of _LAST marker · bb69630b
      Eric Blake 提交于
      When converting a linear enum to a string, we have checks in
      place in the VIR_ENUM_IMPL macro to ensure that there is one
      string for every value, which lets us quickly flag if a user
      added a value but forgot to add a counterpart string.  However,
      this only works if we use the _LAST marker.
      
      * cfg.mk (sc_require_enum_last_marker): New syntax check.
      * src/conf/domain_conf.h (virDomainSnapshotState): Add new marker.
      * src/conf/domain_conf.c (virDomainSnapshotState): Fix offender.
      * src/qemu/qemu_monitor_json.c (qemuMonitorWatchdogAction)
      (qemuMonitorIOErrorAction, qemuMonitorGraphicsAddressFamily):
      Likewise.
      * src/util/virtypedparam.c (virTypedParameter): Likewise.
      bb69630b
  11. 20 1月, 2012 1 次提交
    • E
      util: use new virTypedParameter helpers · 9e48c225
      Eric Blake 提交于
      Reusing common code makes things smaller; it also buys us some
      additional safety, such as now rejecting duplicate parameters
      during a set operation.
      
      * src/qemu/qemu_driver.c (qemuDomainSetBlkioParameters)
      (qemuDomainSetMemoryParameters, qemuDomainSetNumaParameters)
      (qemuSetSchedulerParametersFlags)
      (qemuDomainSetInterfaceParameters, qemuDomainSetBlockIoTune)
      (qemuDomainGetBlkioParameters, qemuDomainGetMemoryParameters)
      (qemuDomainGetNumaParameters, qemuGetSchedulerParametersFlags)
      (qemuDomainBlockStatsFlags, qemuDomainGetInterfaceParameters)
      (qemuDomainGetBlockIoTune): Use new helpers.
      * src/esx/esx_driver.c (esxDomainSetSchedulerParametersFlags)
      (esxDomainSetMemoryParameters)
      (esxDomainGetSchedulerParametersFlags)
      (esxDomainGetMemoryParameters): Likewise.
      * src/libxl/libxl_driver.c
      (libxlDomainSetSchedulerParametersFlags)
      (libxlDomainGetSchedulerParametersFlags): Likewise.
      * src/lxc/lxc_driver.c (lxcDomainSetMemoryParameters)
      (lxcSetSchedulerParametersFlags, lxcDomainSetBlkioParameters)
      (lxcDomainGetMemoryParameters, lxcGetSchedulerParametersFlags)
      (lxcDomainGetBlkioParameters): Likewise.
      * src/test/test_driver.c (testDomainSetSchedulerParamsFlags)
      (testDomainGetSchedulerParamsFlags): Likewise.
      * src/xen/xen_hypervisor.c (xenHypervisorSetSchedulerParameters)
      (xenHypervisorGetSchedulerParameters): Likewise.
      9e48c225
  12. 19 1月, 2012 1 次提交
    • M
      Added capability checking for block <iotune> setting. · 4c82f09e
      Martin Kletzander 提交于
      There was missing capability for blkiotune and thus specifying these
      settings caused libvirt to run qemu with invalid parameters and then
      reporting qemu error instead of the standard libvirt one. The support
      for blkiotune setting was added in upstream qemu repo under commit
      0563e191516289c9d2f282a8c50f2eecef2fa773.
      4c82f09e
  13. 18 1月, 2012 4 次提交
    • O
      qemu: Prohibit reattaching node device if it is in use · 7aeb9794
      Osier Yang 提交于
      It doesn't make sense to reattach a device to host while it's
      still in use, e.g, by a domain.
      7aeb9794
    • O
      qemu: Introduce inactive PCI device list · 6be610bf
      Osier Yang 提交于
      pciTrySecondaryBusReset checks if there is active device on the
      same bus, however, qemu driver doesn't maintain an effective
      list for the inactive devices, and it passes meaningless argument
      for parameter "inactiveDevs". e.g. (qemuPrepareHostdevPCIDevices)
      
      if (!(pcidevs = qemuGetPciHostDeviceList(hostdevs, nhostdevs)))
          return -1;
      
      ..skipped...
      
      if (pciResetDevice(dev, driver->activePciHostdevs, pcidevs) < 0)
          goto reattachdevs;
      
      NB, the "pcidevs" used above are extracted from domain def, and
      thus one won't be able to attach a device of which bus has other
      device even detached from host (nodedev-detach). To see more
      details of the problem:
      
      RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=773667
      
      This patch is to resolve the problem by introducing an inactive
      PCI device list (just like qemu_driver->activePciHostdevs), and
      the whole logic is:
      
        * Add the device to inactive list during nodedev-dettach
        * Remove the device from inactive list during nodedev-reattach
        * Remove the device from inactive list during attach-device
          (for non-managed device)
        * Add the device to inactive list after detach-device, only
          if the device is not managed
      
      With the above, we have a sufficient inactive PCI device list, and thus
      we can use it for pciResetDevice. e.g.(qemuPrepareHostdevPCIDevices)
      
      if (pciResetDevice(dev, driver->activePciHostdevs,
                         driver->inactivePciHostdevs) < 0)
          goto reattachdevs;
      6be610bf
    • D
      Add new attribute wrpolicy to <driver> element · d9e0d820
      Deepak C Shetty 提交于
      This introduces new attribute wrpolicy with only supported
      value as immediate. This will be an optional
      attribute with no defaults. This helps specify whether
      to skip the host page cache.
      
      When wrpolicy is specified, meaning when wrpolicy=immediate
      a writeback is explicitly initiated for the dirty pages in
      the host page cache as part of the guest file write operation.
      
      Usage:
      <filesystem type='mount' accessmode='passthrough'>
        <driver type='path' wrpolicy='immediate'/>
        <source dir='/export/to/guest'/>
        <target dir='mount_tag'/>
      </filesystem>
      
      Currently this only works with type='mount' for the QEMU/KVM driver.
      Signed-off-by: NDeepak C Shetty <deepakcs@linux.vnet.ibm.com>
      d9e0d820
    • J
      qemu: Don't break domain with 0:0:2.0 assigned to anything but VGA · 9619d8a6
      Jiri Denemark 提交于
      In the past we didn't reserve 0:0:2.0 PCI address if there was no video
      device assigned to a domain, which made it impossible to add a video
      device later on. So we fixed it (commit v0.9.0-37-g7b2cac12) by always
      reserving that address. However, that breaks existing domains without
      video devices that already have another device assigned to the
      problematic address.
      
      This patch reserves address 0:0:2.0 only in case it was not explicitly
      assigned to another device, which means libvirt will try to keep this
      address free and will not automatically assign it new devices. But
      existing domains for which older libvirt already assigned the address to
      a non-video device will keep working as they used to work before 0.9.1.
      Moreover, users who want to create a domain without a video device and
      use its address for another device may do so by explicitly configuring
      the PCI address in domain XML.
      9619d8a6
  14. 17 1月, 2012 5 次提交
    • J
      qemu: Add support for host CPU modes · e7201afd
      Jiri Denemark 提交于
      This adds support for host-model and host-passthrough CPU modes to qemu
      driver. The host-passthrough mode is mapped to -cpu host.
      e7201afd
    • J
      Taint domains configured with cpu mode=host-passthrough · c8506d66
      Jiri Denemark 提交于
      There are several reasons for doing this:
      
      - the CPU specification is out of libvirt's control so we cannot
        guarantee stable guest ABI
      - not every feature of a CPU may actually work as expected when
        advertised directly to a guest
      - migration between two machines with exactly the same CPU may work but
        no guarantees can be made
      - this mode is not supported and its use is at one's own risk
      c8506d66
    • J
      cpu: Update guest CPU in host-* mode · 277bc0dc
      Jiri Denemark 提交于
      VIR_DOMAIN_XML_UPDATE_CPU flag for virDomainGetXMLDesc may be used to
      get updated custom mode guest CPU definition in case it depends on host
      CPU. This patch implements the same behavior for host-model and
      host-passthrough CPU modes.
      277bc0dc
    • J
      cpu: Optionally forbid fallback CPU models · a6f88cbd
      Jiri Denemark 提交于
      In case a hypervisor doesn't support the exact CPU model requested by a
      domain XML, we automatically fallback to a closest CPU model the
      hypervisor supports (and make sure we add/remove any additional features
      if needed). This patch adds 'fallback' attribute to model element, which
      can be used to disable this automatic fallback.
      a6f88cbd
    • J
      Clarify semantics of virDomainMigrate{,ToURI}2 · 5e31e713
      Jiri Denemark 提交于
      Commit 5d784bd6 was a nice attempt to
      clarify the semantics by requiring domain name from dxml to either match
      original name or dname. However, setting dxml domain name to dname
      doesn't really work since destination host needs to know the original
      domain name to be able to use it in migration cookies. This patch
      requires domain name in dxml to match the original domain name. The
      change should be safe and backward compatible since migration would fail
      just a bit later in the process.
      5e31e713