1. 16 2月, 2010 1 次提交
    • S
      macvtap support for libvirt -- qemu support · a1b1ab14
      Stefan Berger 提交于
      This part adds support for qemu making a macvtap tap device available
      via file descriptor passed to qemu command line. This also attempts to
      tear down the macvtap device when a VM terminates. This includes support
      for attachment and detachment to/from running VM.
      * src/qemu/qemu_conf.[ch] src/qemu/qemu_driver.c: add support in the
        QEmu driver
      a1b1ab14
  2. 13 2月, 2010 2 次提交
    • D
      Add persistence of PCI addresses to QEMU · 141dea6b
      Daniel P. Berrange 提交于
      Current PCI addresses are allocated at time of VM startup.
      To make them truely persistent, it is neccessary to do this
      at time of virDomainDefine/virDomainCreate. The code in
      qemuStartVMDaemon still remains in order to cope with upgrades
      from older libvirt releases
      
      * src/qemu/qemu_driver.c: Rename existing qemuAssignPCIAddresses
        to qemuDetectPCIAddresses. Add new qemuAssignPCIAddresses which
        does auto-allocation upfront. Call qemuAssignPCIAddresses from
        qemuDomainDefine and qemuDomainCreate to assign PCI addresses that
        can then be persisted. Don't clear PCI addresses at shutdown if
        they are intended to be persistent
      141dea6b
    • D
      Support 'block_passwd' command for QEMU disk encryption · c31a116b
      Daniel P. Berrange 提交于
      The old text mode monitor prompts for a password when disks are
      encrypted. This interactive approach doesn't work for JSON mode
      monitor. Thus there is a new 'block_passwd' command that can be
      used.
      
      * src/qemu/qemu_driver.c: Split out code for looking up a disk
        secret from findVolumeQcowPassphrase, into a new method
        getVolumeQcowPassphrase. Enhance qemuInitPasswords() to also
        set the disk encryption password via the monitor
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
        src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
        support for the 'block_passwd' monitor command.
      c31a116b
  3. 12 2月, 2010 3 次提交
  4. 10 2月, 2010 9 次提交
  5. 09 2月, 2010 7 次提交
  6. 03 2月, 2010 7 次提交
    • D
      Ensure QEMU DAC security driver is activated at all times · 9120f004
      Daniel P. Berrange 提交于
      If the primary security driver (SELinux/AppArmour) was disabled
      then the secondary QEMU DAC security driver was also disabled.
      This is mistaken, because the latter must be active at all times
      
      * src/qemu/qemu_driver.c: Ensure DAC driver is always active
      9120f004
    • D
      Fix QEMU hotplug device alias assignment · 719c50ca
      Daniel P. Berrange 提交于
      To allow devices to be hot(un-)plugged it is neccessary to ensure
      they all have a unique device aliases. This fixes the hotplug
      methods to assign device aliases before invoking the monitor
      commands which need them
      
      * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Expose methods
        for assigning device aliases for disks, host devices and
        controllers
      * src/qemu/qemu_driver.c: Assign device aliases when hotplugging
        all types of device
      * tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address-device.args,
        tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device.args:
        Update for changed hostdev naming scheme
      719c50ca
    • D
      Re-arrange QEMU device alias assignment code · 16478459
      Daniel P. Berrange 提交于
      This patch re-arranges the QEMU device alias assignment code to
      make it easier to call into the same codeblock when performing
      device hotplug. The new code has the ability to skip over already
      assigned names to facilitate hotplug
      
      * src/qemu/qemu_driver.c: Call qemuAssignDeviceNetAlias()
        instead of qemuAssignNetNames
      * src/qemu/qemu_conf.h: Export qemuAssignDeviceNetAlias()
        instead of qemuAssignNetNames
      * src/qemu/qemu_driver.c: Merge the legacy disk/network alias
        assignment code into the main methods
      16478459
    • D
      Remove direct storage of hostnet_name & vlan · 0943048a
      Daniel P. Berrange 提交于
      The current way of assigning names to the host network backend and
      NIC device in QEMU was over complicated, by varying naming scheme
      based on the NIC model and backend type. This simplifies the naming
      to simply be 'net0' and 'hostnet0', allowing code to easily determine
      the host network name and vlan based off the primary device alias
      name 'net0'. This in turn allows removal of alot of QEMU specific
      code from the XML parser, and makes it easier to assign new unique
      names for NICs that are hotplugged
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Remove hostnet_name
        and vlan fields from virNetworkDefPtr
      * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h, src/qemu/qemu_driver.c:
        Use a single network alias naming scheme regardless of NIC type
        or backend type. Determine VLANs from the alias name.
      * tests/qemuxml2argvdata/qemuxml2argv-net-eth-names.args,
        tests/qemuxml2argvdata/qemuxml2argv-net-virtio-device.args,
        tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev.args: Update
        for new simpler naming scheme
      0943048a
    • D
      Assign PCI addresses before hotplugging devices · d8acc446
      Daniel P. Berrange 提交于
      PCI disk, disk controllers, net devices and host devices need to
      have PCI addresses assigned before they are hot-plugged
      
      * src/qemu/qemu_conf.c: Add APIs for ensuring a device has an
        address and releasing unused addresses
      * src/qemu/qemu_driver.c: Ensure all devices have addresses
        when hotplugging.
      d8acc446
    • D
      Rewrite way QEMU PCI addresses are allocated · 9258ec0a
      Daniel P. Berrange 提交于
      The current QEMU code allocates PCI addresses incrementally starting
      at 4. This is not satisfactory because the user may have given some
      addresses in their XML config, which need to be skipped over when
      allocating addresses to remaining devices.
      
      It is thus neccessary to maintain a list of already allocated PCI
      addresses and then only allocate ones that remain unused. This is
      also required for domain device hotplug to work properly later.
      
      * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Add APIs for creating
        list of existing PCI addresses, and allocating new addresses.
        Refactor address assignment to use this code
      * src/qemu/qemu_driver.c: Pull PCI address assignment up into the
        qemuStartVMDaemon() method, as a prelude to moving it into the
        'define' method. Update list of allocated addresses when connecting
        to a running VM at daemon startup.
      * tests/qemuxml2argvtest.c, tests/qemuargv2xmltest.c,
        tests/qemuxml2xmltest.c: Remove USB product test since all
        passthrough is done based on address
      * tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.args,
        tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.xml: Kil
        unused data files
      9258ec0a
    • D
      Make hotplug use new device_add where possible · 264e98d6
      Daniel P. Berrange 提交于
      Since QEMU startup uses the new -device argument, the hotplug
      code needs todo the same. This converts disk, network and
      host device hotplug to use the device_add command
      
      * src/qemu/qemu_driver.c: Use new device_add monitor APIs
        whereever possible
      264e98d6
  7. 02 2月, 2010 2 次提交
    • D
      Standard internal API syntax for building QEMU command line arguments · c129d4fe
      Daniel P. Berrange 提交于
      All the helper functions for building command line arguments
      now return a 'char *', instead of acepting a 'char **' or
      virBufferPtr argument
      
      * qemu/qemu_conf.c: Standardize syntax for building args
      * qemu/qemu_conf.h: Export all functions for building args
      * qemu/qemu_driver.c: Update for changed syntax for building
        NIC/hostnet args
      c129d4fe
    • J
      avoid a probable EINVAL from lseek · 9344e6ad
      Jim Meyering 提交于
      * src/qemu/qemu_driver.c (qemudLogReadFD): Don't pass a negative
      offset (from a preceding failed attempt to seek to EOF) to this use
      of lseek.
      9344e6ad
  8. 01 2月, 2010 1 次提交
  9. 26 1月, 2010 1 次提交
    • C
      Fix a crash when restarting libvirtd. · 7cc5410b
      Chris Lalancette 提交于
      If you shutdown libvirtd while a domain with PCI
      devices is running, then try to restart libvirtd,
      libvirtd will crash.
      
      This happens because qemuUpdateActivePciHostdevs() is calling
      pciDeviceListSteal() with a dev of 0x0 (NULL), and then trying
      to dereference it.  This patch fixes it up so that
      qemuUpdateActivePciHostdevs() steals the devices after first
      Get()'ting them, avoiding the crash.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      7cc5410b
  10. 23 1月, 2010 1 次提交
    • C
      qemu: Fix race between device rebind and kvm cleanup · be34c3c7
      Chris Lalancette 提交于
      Certain hypervisors (like qemu/kvm) map the PCI bar(s) on
      the host when doing device passthrough.  This can lead to a race
      condition where the hypervisor is still cleaning up the device while
      libvirt is trying to re-attach it to the host device driver.  To avoid
      this situation, we look through /proc/iomem, and if the hypervisor is
      still holding onto the bar (denoted by the string in the matcher variable),
      then we can wait around a bit for that to clear up.
      
      v2: Thanks to review by DV, make sure we wait the full timeout per-device
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      be34c3c7
  11. 21 1月, 2010 6 次提交
    • D
      Fix off-by-1 in SCSI drive hotplug · 6512d09c
      Daniel P. Berrange 提交于
      The loop looking for the controller associated with a SCI drive had
      an off by one, causing it to miss the last controller.
      
      * src/qemu/qemu_driver.c: Fix off-by-1 in searching for SCSI
        drive hotplug
      6512d09c
    • D
      Fix leak in hotplug code in QEMU driver · e3a0c80f
      Daniel P. Berrange 提交于
      The hotplug code in QEMU was leaking memory because although the
      inner device object was being moved into the main virDomainDefPtr
      config object, the outer container virDomainDeviceDefPtr was not.
      
       * src/qemu/qemu_driver.c: Clarify code to show that the inner
         device object is owned by the main domain config upon
         successfull attach.
      e3a0c80f
    • D
      Fix security driver calls in hotplug cleanup paths · 2df16576
      Daniel P. Berrange 提交于
      The hotplug code was not correctly invoking the security driver
      in error paths. If a hotplug attempt failed, the device would
      be left with VM permissions applied, rather than restored to the
      original permissions. Also, a CDROM media that is ejected was
      not restored to original permissions. Finally there was a bogus
      call to set hostdev permissions in the hostdev unplug code
      
      * qemu/qemu_driver.c: Fix security driver usage in hotplug/unplug
      2df16576
    • D
      Add missing call to re-attach host devices if VM startup fails · b2a2ba71
      Daniel P. Berrange 提交于
      If there is a problem with VM startup, PCI devices may be left
      assigned to pci-stub / pci-back. Adding a call to reattach
      host devices in the cleanup path is required.
      
      * qemu/qemu_driver.c: qemuDomainReAttachHostDevices() when
        VM startup fails
      b2a2ba71
    • D
      Switch QEMU driver over to use the DAC security driver · 3812c7b4
      Daniel P. Berrange 提交于
      Remove all the QEMU driver calls for setting file ownership and
      process uid/gid. Instead wire in the QEMU DAC security driver,
      stacking it ontop of the primary SELinux/AppArmour driver.
      
      * qemu/qemu_driver.c: Switch over to new DAC security driver
      3812c7b4
    • D
      Pull initial disk labelling out into libvirtd instead of exec hook · 08fd20b0
      Daniel P. Berrange 提交于
      Pulling the disk labelling code out of the exec hook, and into
      libvirtd will allow it to access shared state in the daemon. It
      will also make debugging & error reporting easier / more reliable.
      
      * qemu/qemu_driver.c: Move initial disk labelling calls up into
        libvirtd. Add cleanup of disk labels upon failure
      08fd20b0