1. 11 2月, 2010 1 次提交
    • D
      Fix disk stats retrieval with QEMU >= 0.12 · 73579750
      Daniel P. Berrange 提交于
      With QEMU >= 0.12 the host and guest side of disks no longer have
      the same naming convention. Specifically the host side will now
      get a 'drive-' prefix added to its name. The 'info blockstats'
      monitor command returns the host side name, so it is neccessary
      to strip this off when looking up stats since libvirt stores the
      guest side name !
      
      * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Move 'drive-' prefix
        string to a defined constant
      * src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Strip
        off 'drive-' prefix (if found) when looking up disk stats
      73579750
  2. 10 2月, 2010 3 次提交
    • D
      Annotate some virConnectPtr as mandatory non-null · 38536d6f
      Daniel P. Berrange 提交于
      Use the ATTRIBUTE_NONNULL annotation to mark some virConnectPtr
      args as mandatory non-null so the compiler can warn of mistakes
      
      * src/conf/domain_event.h: All virConnectPtr args must be non-null
      * src/qemu/qemu_conf.h: qemudBuildCommandLine and
        qemudNetworkIfaceConnect() must be given non-null connection
      * tests/qemuxml2argvtest.c: Provide a non-null (dummy) connection to
        qemudBuildCommandLine()
      38536d6f
    • D
      Convert qemu command line flags to 64-bit int · 910b019f
      Daniel P. Berrange 提交于
      The QEMU flags are commonly stored as a signed or unsigned int,
      allowing only 31 flags. This limit is rather close, so to aid
      future patches, change it to a 64-bit int
      
      * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h, src/qemu/qemu_driver.c,
        tests/qemuargv2xmltest.c, tests/qemuhelptest.c, tests/qemuxml2argvtest.c:
        Use 'unsigned long long' for QEMU flags
      910b019f
    • D
      caa805ea
  3. 09 2月, 2010 1 次提交
  4. 03 2月, 2010 6 次提交
    • 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
      Remove use of -netdev arg with QEMU · 49a0f6cd
      Daniel P. Berrange 提交于
      The QEMU 0.12.x tree has the -netdev command line argument, but not
      corresponding monitor command. We can't enable the former, without
      the latter since it will break hotplug/unplug.
      
      * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Disable -netdev usage
        until 0.13 at earliest
      * tests/qemuxml2argvtest.c: Add test for -netdev syntax
      * tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev.args,
        tests/qemuxml2argvdata/qemuxml2argv-net-virtio-netdev.xml: Test
        data files for -netdev syntax
      49a0f6cd
    • 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
  5. 02 2月, 2010 2 次提交
    • D
      Split out QEMU code for building PCI/USB hostdev arg values · 96c8608d
      Daniel P. Berrange 提交于
      To allow for better code reuse from hotplug methods, the code for
      generating PCI/USB hostdev arg values is split out into separate
      methods
      
      * qemu/qemu_conf.h, qemu/qemu_conf.c: Introduce new APis for
        qemuBuildPCIHostdevPCIDevStr, qemuBuildUSBHostdevUsbDevStr
        and qemuBuildUSBHostdevDevStr
      96c8608d
    • 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
  6. 21 1月, 2010 2 次提交
    • D
      Introduce a new DAC security driver for QEMU · 15f5eaa0
      Daniel P. Berrange 提交于
      This new security driver is responsible for managing UID/GID changes
      to the QEMU process, and any files/disks/devices assigned to it.
      
      * qemu/qemu_conf.h: Add flag for disabling automatic file permission
        changes
      * qemu/qemu_security_dac.h, qemu/qemu_security_dac.c: New DAC driver
        for QEMU guests
      * Makefile.am: Add new files
      15f5eaa0
    • D
      Introduce a stacked security driver impl for QEMU · 80fd73ca
      Daniel P. Berrange 提交于
      * qemu/qemu_conf.h: Add securityPrimaryDriver and
        securitySecondaryDriver fields to 'struct qemud_driver'
      * Makefile.am: Add new files
      * qemu/qemu_security_stacked.c, qemu/qemu_security_stacked.h: A
        simple stacked security driver
      80fd73ca
  7. 20 1月, 2010 1 次提交
  8. 19 1月, 2010 1 次提交
    • J
      Implement CPU topology support for QEMU driver · 5d462bd0
      Jiri Denemark 提交于
      QEMU's command line equivalent for the following domain XML fragment
          <vcpus>2</vcpus>
          <cpu ...>
              ...
              <topology sockets='1' cores='2', threads='1'/>
          </cpu>
      
      is
      
          -smp 2,sockets=1,cores=2,threads=1
      
      This syntax was introduced in QEMU-0.12.
      
      Version 2 changes:
      - -smp argument build split into a separate function
      - always add ",sockets=S,cores=C,threads=T" to -smp if qemu supports it
      - use qemuParseCommandLineKeywords for command line parsing
      
      Version 3 changes:
      - ADD_ARG_LIT => ADD_ARG and line reordering in qemudBuildCommandLine
      - rebased
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      5d462bd0
  9. 18 1月, 2010 2 次提交
    • D
      Add support for explicit -sdl flag to QEMU · 4f6c9990
      Daniel P. Berrange 提交于
      Not all QEMU builds default to SDL graphics for their display.
      Newer QEMU now has an explicit -sdl flag, which we can use to
      explicitly request SDL intead of relying on the default. This
      protects libvirt against unexpected changes in graphics default
      
      * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Probe for -sdl
        flag and use it if it is found
      * tests/qemuhelptest.c: Add SDL flag to tests
      4f6c9990
    • D
      Probe for -device and use -nodefaults · 1ed1bf3a
      Daniel P. Berrange 提交于
      Probe for the new -device flag and if available set the -nodefaults
      flag, instead of using -net none, -serial none or -parallel none.
      Other device types will be converted to use -device in later patches.
      The -nodefaults flag will help avoid unwelcome surprises from future
      QEMU releases
      
      * src/qemu/qemu_conf.c: Probe for -device. Add -nodefaults flag.
        Remove -net none, -serial none or -parallel none
      * src/qemu/qemu_conf.h: Define QEMU_CMD_FLAG_DEVICE
      * tests/qemuhelpdata/qemu-0.12.1: New data file for 0.12.1 QEMU
      * tests/qemuhelptest.c: Test feature extraction from 0.12.1 QEMU
      1ed1bf3a
  10. 16 1月, 2010 1 次提交
    • D
      Split code for building QEMU -drive arg in separate method · 2982d73a
      Daniel P. Berrange 提交于
      To enable it to be called from multiple locations, split out
      the code for building the -drive arg string. This will be needed
      by later patches which do drive hotplug, the conversion to use
      -device, and the conversion to controller/bus/unit addressing
      
      * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Add qemuBuildDriveStr
        for building -drive arg string
      2982d73a
  11. 07 1月, 2010 1 次提交
    • A
      qemu: Always enable the virtio balloon driver · 7a90f216
      Adam Litke 提交于
      The behavior for the qemu balloon device has changed.  Formerly, a virtio
      balloon device was provided by default.  Now, '-balloon virtio' must be
      specified on the command line to enable it.  This patch causes libvirt to
      add '-balloon virtio' to the command line whenever the -balloon option is
      available.
      * src/qemu/qemu_conf.c src/qemu/qemu_conf.h: check for the new flag and
        add "-baloon vitio" to qemu command when needed
      * tests/qemuhelptest.c: add the new flag for detection
      7a90f216
  12. 22 12月, 2009 1 次提交
  13. 18 12月, 2009 1 次提交
  14. 08 12月, 2009 1 次提交
    • D
      Support for JSON mode monitor · 3a4f172f
      Daniel P. Berrange 提交于
      Initial support for the new QEMU monitor protocol  using JSON
      as the data encoding format instead of plain text
      
      * po/POTFILES.in: Add src/qemu/qemu_monitor_json.c
      * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Hack to turn on QMP
        mode. Replace with a version number check on >= 0.12 later
      * src/qemu/qemu_monitor.c: Delegate to json monitor if enabled
      * src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h: Add
        impl of QMP protocol
      * src/Makefile.am: Add src/qemu/qemu_monitor_json.{c,h}
      3a4f172f
  15. 20 11月, 2009 1 次提交
    • S
      qemu-kvm needs -enable-kvm flag for VT optimization · b827338a
      Steve Yarmie 提交于
      Recent qemu releases require command option '-enable-qemu' in order
      for the kvm functionality be activated. Libvirt needs to pass this flag
      to qemu when starting a domain. Note that without the option,
      even if both the kernel and qemu support KVM, KVM will not be activated
      and VMs will be very slow.
      
      * src/qemu/qemu_conf.h src/qemu/qemu_conf.c: parse the extra command
        line option from help and add it when running kvm
      * tests/qemuhelptest.c: this modified the flags output for qemu-0.10.5
        and qemu-kvm-0.11.0-rc2 regression tests
      b827338a
  16. 10 11月, 2009 2 次提交
    • D
      Wrap text mode monitor APIs, pass qemuMonitorPtr directly to APIs · 41d8968d
      Daniel P. Berrange 提交于
      Change the QEMU driver to not directly invoke the text mode monitor
      APIs. Instead add a generic wrapper layer, which will eventually
      invoke either the text or JSON protocol code as needed. Pass an
      qemuMonitorPtr object into the monitor APIs instead of virDomainObjPtr
      to complete the de-coupling of the monitor impl from virDomainObj
      data structures
      
      * src/qemu/qemu_conf.h: Remove qemuDomainObjPrivate definition
      * src/qemu/qemu_driver.c: Add qemuDomainObjPrivate definition.
        Pass qemuMonitorPtr into all monitor APIs instead of the
        virDomainObjPtr instance.
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add thin
        wrappers for all qemuMonitorXXX command APIs, calling into
        qemu_monitor_text.c/h
      * src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
        Rename qemuMonitor -> qemuMonitorText & update to accept
        qemuMonitorPtr instead of virDomainObjPtr
      41d8968d
    • D
      Make use of private data structure for monitor state · 1cfd5a00
      Daniel P. Berrange 提交于
      Introduce a new qemuDomainObjPrivate object which is used to store
      the private QEMU specific data associated with each virDomainObjPtr
      instance. This contains a single member, an instance of the new
      qemuMonitorPtr object which encapsulates the QEMU monitor state.
      The internals of the latter are private to the qemu_monitor* files,
      not to be shown to qemu_driver.c
      
      * src/qemu/qemu_conf.h: Definition of qemuDomainObjPrivate.
      * src/qemu/qemu_driver.c: Register a functions for creating
        and freeing qemuDomainObjPrivate instances with the domain
        capabilities. Remove the qemudDispatchVMEvent() watch since
        I/O watches are now handled by the monitor code itself. Pass
        a new qemuHandleMonitorEOF() callback into qemuMonitorOpen
        to allow notification when the monitor quits.
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Introduce
        the 'qemuMonitor' object. Temporarily add new APIs
        qemuMonitorWrite, qemuMonitorRead, qemuMonitorWaitForInput
        to allow text based monitor impl to perform I/O.
      * src/qemu/qemu_monitor_text.c: Call APIs for reading/writing
        to monitor instead of accessing the file handle directly.
      1cfd5a00
  17. 05 11月, 2009 1 次提交
  18. 04 11月, 2009 1 次提交
    • G
      add MAC address based port filtering to qemu · 0aa72ac6
      Gerhard Stenzel 提交于
      * src/qemu/qemu.conf src/qemu/qemu_conf.c src/qemu/qemu_conf.h: there is
        a new config type option for mac filtering
      * src/qemu/qemu_bridge_filter.[ch]: new module for the ebtable entry points
      * src/qemu/qemu_driver.c: plug the MAC filtering at the right places
        in the domain life cycle
      * src/Makefile.am po/POTFILES.in: add the new module
      0aa72ac6
  19. 30 9月, 2009 1 次提交
  20. 29 9月, 2009 2 次提交
    • D
      Add API for issuing 'host_net_add' monitor command · 4c10127b
      Daniel P. Berrange 提交于
      * src/qemu/qemu_conf.h, src/qemu/qemu_conf.c: Remove prefix arg
        from qemuBuildHostNetStr which is no longer required
      * src/qemu/qemu_driver.c: Refactor to use qemuMonitorAddHostNetwork()
        API for adding host network
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
        qemuMonitorAddHostNetwork() method for adding host networks
      4c10127b
    • D
      Add API for issuing 'pci_add nic' monitor command · f8d54e7c
      Daniel P. Berrange 提交于
      * src/qemu/qemu_conf.c: Remove separator from qemuBuildNicStr()
        args, and remove hardcoded 'nic' prefix. Leave it upto callers
        instead
      * src/qemu/qemu_driver.c: Switch over to using the new
        qemuMonitorAddPCINetwork() method for NIC hotplug
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
        qemuMonitorAddPCINetwork API for PCI network device hotplug
      f8d54e7c
  21. 22 9月, 2009 1 次提交
    • D
      Fix handling of Xen(ner) detection · b81a7ece
      Daniel P. Berrange 提交于
      Latest upstream QEMU can be built with Xen support, which introduces
      a -xen-domid argument. This was  mistakenly detected as -domid due
      to old Xenner support. Adapt to cope with both syntax. Also only
      set domid if the virt type is xen, or the guest type is xen
      
      * src/qemu_conf.c, src/qemu_conf.h: Detect new -xen-domid flag in
        preference to -domid.
      * tests/qemuxml2argvdata/qemuxml2argv-bootloader.args,
        tests/qemuxml2argvdata/qemuxml2argv-input-xen.args: Add missing
        -domid param
      * tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.args: Remove bogus
        -boot param.
      * tests/qemuxml2argvtest.c: Add missing QEMUD_CMD_FLAG_DOMID params
      b81a7ece
  22. 21 9月, 2009 2 次提交
    • D
      Move security drivers to src/security/ · e56c6a83
      Daniel P. Berrange 提交于
      * src/Makefile.am, src/qemu/qemu_conf.h, src/qemu/qemu_driver.c,
        tests/seclabeltest.c: Adapt for changed paths
      * src/security.c: Rename to src/security/security_driver.c
      * src/security.h: Rename to src/security/security_driver.h
      * src/security_selinux.c, src/security_selinux.h: Move to src/security/
      e56c6a83
    • D
      Move QEMU driver to src/qemu/ · 58355a5b
      Daniel P. Berrange 提交于
      * src/qemu_conf.c, src/qemu_conf.h, src/qemu_driver.c,
        src/qemu_driver.h: Move to src/qemu/
      * daemon/qemud.c, src/Makefile.am, tests/qemuargv2xmltest.c,
        tests/qemuhelptest.c, tests/qemuxml2argvtest.c,
        tests/qemuxml2xmltest.c: Adapt for changed paths
      58355a5b
  23. 10 9月, 2009 1 次提交
    • M
      Canonicalize the qemu machine type in qemuxml2argvtest · 6e7ab461
      Mark McLoughlin 提交于
      This doesn't have any affect on the current tests because we don't have
      any machine aliases in the current test data.
      
      * src/qemu_conf.h, src/qemu_driver.c: expose qemudCanonicalizeMachine()
        for the tests
      
      * tests/qemuxml2argvtest.c: canonicalize the machine type
      6e7ab461
  24. 04 9月, 2009 1 次提交
    • D
      Move QEMU monitor socket in /var/lib/libvirt/qemu · 182a80b9
      Daniel P. Berrange 提交于
      Separate the guest created QEMU monitor socket location
      from the libvirtd create XML / PID data files, to improve
      security separation when running QEMU non-root
      
      * libvirt.spec.in: Leave /var/run/libvirt/qemu as root:root
      * src/qemu_conf.h: Add libDir and cacheDir directory paths
      * src/qemu_driver.c: Move QEMU monitor socket from
        stateDir to libDir to avoid making security critical directory
        accessible to QEMU guests.
      * src/util.c: Delay running hook till after damonizing to
        ensure pidfile is still written before changing UID/GID
      182a80b9
  25. 03 9月, 2009 2 次提交
    • D
      Add support for setting disk drive serial numbers · 85d15b51
      Daniel P. Berrange 提交于
      * docs/schemas/domain.rng: Add <serial> element to disks
      * src/domain_conf.h, src/domain_conf.c: XML parsing and
        formatting for disk serial numbers
      * src/qemu_conf.c: Set serial number when launching guests
      * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.args,
        tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml: Add
        serial number to XML test
      85d15b51
    • D
      Support configuration of huge pages in guests · d823a05a
      Daniel P. Berrange 提交于
      Add option to domain XML for
      
           <memoryBacking>
              <hugepages/>
           </memoryBacking>
      
      * configure.in: Add check for mntent.h
      * qemud/libvirtd_qemu.aug, qemud/test_libvirtd_qemu.aug, src/qemu.conf
        Add 'hugetlbfs_mount' config parameter
      * src/qemu_conf.c, src/qemu_conf.h: Check for -mem-path flag in QEMU,
        and pass it when hugepages are requested.
        Load hugetlbfs_mount config parameter, search for mount if not given.
      * src/qemu_driver.c: Free hugetlbfs_mount/path parameter in driver shutdown.
        Create directory for QEMU hugepage usage, chowning if required.
      * docs/formatdomain.html.in: Document memoryBacking/hugepages elements
      * docs/schemas/domain.rng: Add memoryBacking/hugepages elements to schema
      * src/util.c, src/util.h, src/libvirt_private.syms: Add virFileFindMountPoint
        helper API
      * tests/qemuhelptest.c: Add -mem-path constants
      * tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c: Add tests for hugepage
        handling
      * tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml,
        tests/qemuxml2argvdata/qemuxml2argv-hugepages.args: Data files for
        hugepage tests
      d823a05a
  26. 18 8月, 2009 1 次提交
    • M
      Maintain a list of active PCI hostdevs and use it in pciResetDevice() · e8ad3393
      Mark McLoughlin 提交于
      As we start/shutdown guests, or hotplug/hot-unplug devices, we can add
      or delete devices as appropriate from a list of active devices.
      
      Then, in pciReset(), we can use this to determine whether its safe to
      reset a device as a side effect of resetting another device.
      
      * src/qemu_conf.h: add activePciHostdevs to qemud_driver
      
      * src/qemu_driver.c: maintain the activePciHostdevs list, and pass it
        to pciResetDevice()
      
      * src/pci.[ch]: pass the activeDevs list to pciResetDevice() and use
        it to determine whether a Secondary Bus Reset is safe
      e8ad3393