1. 27 7月, 2009 8 次提交
    • M
      Use sendmsg() on QEMU monitor socket · 7d9576ed
      Mark McLoughlin 提交于
      Switch from using write() to using sendmsg() on QEMU's monitor socket
      so that we can add support for SCM_RIGHTS.
      
      * src/qemu_driver.c: add sendmsg() based qemudMonitorSendUnix() and use
        it when the monitor fd is a unix socket
      7d9576ed
    • M
      Factor qemudMonitorSend() out of qemudMonitorCommandExtra() · 9de2972c
      Mark McLoughlin 提交于
      Add a little helper function to write the monitor command followed by
      carriage return in a single write.
      
      This doesn't make any real difference, but allows us to more easily
      switch to using sendmsg() when using the monitor over a unix socket.
      
      * src/qemu_conf.c: split qemudMonitorSend() out
      9de2972c
    • M
      Clean up error handling in qemudDomainAttachNetDevice() · be44cabd
      Mark McLoughlin 提交于
      In subsequent patches we're going to have a file descriptor to close
      too, so centralize the error handling cleanups to make things easier.
      
      * src/qemu_conf.c: in qemudDomainAttachNetDevice() consolidate the
        error handling cleanups together
      be44cabd
    • M
      Make qemuBuildHostNetStr() take tapfd as a string · 32db8dd7
      Mark McLoughlin 提交于
      With hotplug, we're going to want to pass a tapfd name rather than an
      actual file descriptor, so prepare the way by passing a string tapfd to
      qemuBuildHostNetStr().
      
      * src/qemu_conf.h: qemuBuildHostNetStr() takes a string tapfd now
      
      * src/qemu_conf.c: pass qemuBuildHostNetStr() a string rather than an
        actual file descriptor
      
      * src/qemu_driver.c: update qemudDomainAttachNetDevice() for change
      32db8dd7
    • M
      Only probe qemu for machine types when binary changes · 707302b2
      Mark McLoughlin 提交于
      By probing for qemu machine types, we increased the time of a
      GetCapabilities call from 100us to a whopping 60ms.
      
      This patch takes the approach of only probing for machine types
      when the mtime of the emulator binary changed since the last time
      the capabilities were generated.
      
      * src/capabilities.h: cache the emulator binary mtime
      
      * src/qemu_conf.c: add qemudGetOldMachines() to copy the machine
        types from the old caps struct if the mtime for the binary hasn't
        changed
      
      * src/qemu_conf.h, src/qemu_driver.c: pass the old caps pointer to
        qemudCapsInit()
      707302b2
    • M
      Probe QEMU directly for machine aliases if not found in capabilties · c14c6b08
      Mark McLoughlin 提交于
      Not all possible emulators are actually in the capabilities, so if we
      don't find the supplied emulator we should probe it directly for machine
      types.
      
      * src/qemu_driver.c: add qemudCanonicalizeMachineDirect() to directly
        probe an emulator for the canonical machine type
      c14c6b08
    • M
      Canonicalize qemu machine types · be291b33
      Mark McLoughlin 提交于
      In qemu-0.11 there is a 'pc-0.10' machine type which allows you to run
      guests with a machine which is compatible with the pc machine in
      qemu-0.10 - e.g. using the original PCI class for virtio-blk and
      virtio-console and disabling MSI support in virtio-net. The idea here
      is that we don't want to suprise guests by changing the hardware when
      qemu is updated.
      
      I've just posted some patches for qemu-0.11 which allows libvirt to
      canonicalize the 'pc' machine alias to the latest machine version.
      
      This patches makes us use that so that when a guest is configured to
      use the 'pc' machine type, we resolve that to 'pc-0.11' machine and
      save that in the guest XML.
      
      See also:
      
        https://fedoraproject.org/wiki/Features/KVM_Stable_Guest_ABI
      
      * src/qemu_conf.c: add qemudCanonicalizeMachine() to canonicalize
        the machine type according to the machine aliases in capabilities
      
      * src/qemu_driver.c: parse aliases in qemudParseMachineTypesStr()
      be291b33
    • C
      Don't allow NULL paths for BlockStats and InterfaceStats · 13f3d40c
      Cole Robinson 提交于
      Do the check in libvirt.c, to save drivers from the burden. This changes
      behavior slightly in the qemu driver: we no longer explictly error if
      passed an empty string. An error will still be thrown when the device
      lookup fails.
      13f3d40c
  2. 24 7月, 2009 5 次提交
    • D
      Make QEMU cgroups use configurable · f4c3acdf
      Daniel P. Berrange 提交于
       * qemud/libvirtd_qemu.aug, qemud/test_libvirtd_qemu.aug,
         src/qemu.conf: Add 'cgroups_controllers' and 'cgroups_device_acl'
         parameters
       * src/qemu_conf.h, src/qemu_conf.c: Load & parse configuration params
         for cgroups
       * src/qemu_driver.c: Only use cgroups controllers that are activated,
         and use configured device whitelist instead of default, if set.
      f4c3acdf
    • D
      Use cgroups for block device whitelisting in QEMU guests · e88d638a
      Daniel P. Berrange 提交于
      * src/qemu_driver.c: Set a restrictive block device whitelist for
        all QEMU guests. Update whitelist when hotplugging disks.
      * src/cgroup.h, src/cgroup.c: Add some more convenience methods
        for dealing with block device whitelists.
      e88d638a
    • D
      Implement schedular tunables API using cgroups · 55bc5090
      Daniel P. Berrange 提交于
      * src/qemu_driver.c:  Add driver methods qemuGetSchedulerType,
        qemuGetSchedulerParameters, qemuSetSchedulerParameters
      * src/lxc_driver.c: Fix to use unsigned long long consistently
        for schedular parameters
      * src/cgroup.h, src/cgroup.c: Fix cpu_shares to take unsigned
        long long
      * src/util.c, src/util.h, src/libvirt_private.syms: Add a
        virStrToDouble helper
      * src/virsh.c: Fix handling of --set arg to schedinfo command
        to honour the designated data type of each schedular tunable
        as declared by the driver
      55bc5090
    • D
      Place every QEMU guest in a private cgroup · 38f6f47b
      Daniel P. Berrange 提交于
      * src/qemu_driver.c: Place guest in cgroup upon startup. Remove
        cgroup upon shutdown
      38f6f47b
    • L
      Add bare format string to printf-derivatives troubles · 165ed4a0
      Laine Stump 提交于
      * src/datatypes.c src/domain_conf.c src/interface_conf.c
        src/lxc_driver.c src/qemu_driver.c src/storage_backend.c src/virsh.c:
        add bare %s format string to printf-derivatives called with no format
        string
      165ed4a0
  3. 22 7月, 2009 8 次提交
    • N
      Add support for physical memory access for QEmu · e4c48e02
      Nguyen Anh Quynh 提交于
      * include/libvirt/libvirt.h include/libvirt/libvirt.h.in: adds the new
        flag VIR_MEMORY_PHYSICAL for virDomainMemoryPeek
      * src/libvirt.c: update the front-end checking
      * src/qemu_driver.c: extend the QEmu driver
      e4c48e02
    • M
      Add support for network device detach · c2709cda
      Mark McLoughlin 提交于
      qemu network devices are hot-unplugged in two stages - first the PCI NIC
      is removed using 'pci_del <pci_addr>' and then the backend is removed
      using 'host_net_remove <vlan> <name>'.
      
      In order to perform these operations we need to have retained the
      PCI address, backend name and vlan number.
      
      * src/qemu_driver.c: add qemudDomainDetachNetDevice()
      c2709cda
    • M
      Retain PCI address from NIC attach · 4e21a95a
      Mark McLoughlin 提交于
      When we pci_add a NIC, we need to retain the PCI address assigned by
      qemu for using during detach.
      
      * src/qemu_driver.c: use qemudParsePciAddReply() to pull the PCI
        address from the pci_add reply
      
      * src/domain_conf.c: handle storing and parsing the PCI address in the
        domain state XML file
      4e21a95a
    • M
      Re-factor pci_add reply parsing and parse domain/bus numbers · ffec099e
      Mark McLoughlin 提交于
      The current code for parsing pci_add replies ignores the the domain and
      bus numbers. Re-write the code to rectify that.
      
      Also, since pci_add is used for NIC hotplug as well ask disk hotplug,
      re-factor the code into a separate function.
      
      * src/qemu_driver.c: add qemudParsePciAddReply() function which can
        handle parsing domain and bus numbers
      ffec099e
    • M
      Remove the network backend if NIC hotplug fails · d06f261c
      Mark McLoughlin 提交于
      If we fail to pci_add a NIC, we should remove the network backend and
      leave things the way we found them. To do that, we pre-allocate a
      host_net_remove monitor command and issue that if the pci_add fails.
      If the remove fails, we just log a warning.
      
      We can only do this if we have a name for the network backend and
      we know the vlan number its associated with.
      
      * src/qemu_driver.c: host_net_remove the network backend if the
        pci_add fails
      d06f261c
    • M
      Basic qemu NIC hotplug support · 35153940
      Mark McLoughlin 提交于
      Implement basic NIC hotplug support using the 'host_net_add' and
      'pci_add' qemu monitor commands.
      
      For now, we don't support 'bridge' or 'network' types.
      
      Also, if pci_add fails, we currently fail to remove the backend
      which we added.
      
      Finally, NIC hot-unplug support is missing.
      
      * src/qemu_driver.c: add qemudDomainAttachNetDevice()
      
      * src/qemu_conf.[ch]: export qemuBuildNicStr(), qemuBuildHostNetStr()
        and qemuAssignNames()
      
      * src/libvirt_private.syms: export virDomainNetTypeToString()
      35153940
    • M
      Make qemuCmdFlags available in qemudDomainAttachDevice() · 423af197
      Mark McLoughlin 提交于
      qemudDomainChangeEjectableMedia() currently extracts the qemu command
      line flags, but other device attaching code might need it, so move
      the qemudExtractVersionInfo() call up a frame.
      
      * src/qemu_driver.c: move the qemudExtractVersionInfo() call from
        qemudDomainChangeEjectableMedia() to qemudDomainAttachDevice()
      423af197
    • M
      Retain disk PCI address across libvirtd restarts · 01654107
      Mark McLoughlin 提交于
      When we hot-plug a disk device into a qemu guest, we need to retain its
      PCI address so that it can be removed again later. Currently, we do
      retain the slot number, but not across libvirtd restarts.
      
      Add <state devaddr="xxxx:xx:xx"/> to the disk device XML config when the
      VIR_DOMAIN_XML_INTERNAL_STATUS flag is used. We still don't parse the
      domain and bus number, but the format allows us to do that in future.
      
      * src/domain_conf.h: replace slotnum with pci_addr struct, add helper
        for testing whether the address is valid
      
      * src/domain_conf.c: handle formatting and parsing the address
      
      * src/qemu_driver.c: store the parsed slot number as a full PCI address,
        and use this address with the pci_del monitor command
      
      * src/vbox/vbox_tmpl.c: we're debug printing slotnum here even though
        it can never be set, just delete it
      01654107
  4. 21 7月, 2009 1 次提交
  5. 17 7月, 2009 2 次提交
    • C
      qemu: Try multiple times to open unix monitor socket · 3b541768
      Cole Robinson 提交于
      Unlike the pty monitor (which we know exists since we scrape its path from
      stdout), we have no way of knowing that the unix monitor socket should exist/
      be initialized. As a result, some of my KVM guests randomly fail to start on
      F10 host.
      
      Try to open the unix socket in a 3 second timeout loop. Ignore EACCES (path
      does not exist if a first time run) and ECONNREFUSED (leftover socket from
      a previous run hasn't been removed yet). Fixes things for me.
      3b541768
    • D
      Run QEMU guests as an unprivileged user · 0714b2ba
      Daniel P. Berrange 提交于
      * configure.in: Add --with-qemu-user and --with-qemu-group args
      * libvirt.spec.in: use 'qemu' for user/group for Fedora >= 12
      * qemud/libvirtd_qemu.arg, qemud/test_libvirtd_qemu.aug,
        src/qemu.conf: Add 'user' and 'group' args for configuration
      * src/Makefile.am: Create %localstatedir/cache/libvirt/qemu
      * src/qemu_conf.c, src/qemu_conf.h: Load user/group from config
      * src/qemu_driver.c: Change user ID/group ID when launching QEMU
        guests. Change user/group ownership on disks/usb/pci devs.
        Put memory dumps in %localstatedir/cache/libvirt/qemu
      * src/util.c, src/util.h: Add convenient APIs for converting
        username/groupname to user ID / group ID
      0714b2ba
  6. 16 7月, 2009 4 次提交
  7. 11 7月, 2009 1 次提交
  8. 10 7月, 2009 4 次提交
    • M
      Switch to using a unix socket for the qemu monitor · 62455ed8
      Mark McLoughlin 提交于
      We keep support for the pty based monitor so that we can re-connect
      to VMs started by older versions of libvirtd.
      
      * src/domain_conf.c: handle formatting and parsing unix monitors
      
      * src/qemu_driver.c: add qemudOpenMonitorUnix(), remove the monitor
        pty path searching from qemudFindCharDevicePTYs(), switch
        qemudStartVMDaemon() and qemuDomainXMLToNative() to using a unix
        monitor
      
      * tests/qemuxml2argvtest.c: switch to using a unix monitor
      
      * tests/qemuxml2argvdata/qemuxml2argv-*.args: update test data
      62455ed8
    • M
      Add the monitor type to the domain state XML · 05d377bd
      Mark McLoughlin 提交于
      There are no functional changes in this patch apart from adding the
      monitor type to the state XML.
      
      The patch mostly consists of switching to use virDomainChrDef every
      where to describe the monitor.
      
      * src/domain_conf.h: replace monitorpath with monitor_chr
      
      * src/domain_conf.c: handle parsing the monitor type and initializing
        monitor chr
      
      * src/qemu_conf.[ch]: make qemudBuildCommandLine take a
        virDomainChrDefPtr and use that to build the -monitor parameter
      
      * src/qemu_driver.c: split pty specific and common code from
        qemudOpenMonitor, have qemudStartVMDaemon() initialize monitor_chr
      
      * tests/qemuxml2argvtest.c: update for qemudBuildCommandLine() change
      05d377bd
    • M
      Minor qemu monitor coding style fixes · 1f4ec305
      Mark McLoughlin 提交于
      * src/qemu_driver.c: use a consistent coding style for function
        definitions
      1f4ec305
    • M
      Don't leak vm->monitorpath on re-connect · 8a52daa2
      Mark McLoughlin 提交于
      * src/qemu_driver.c: vm->monitorpath is already initialized in the case
        of re-connect, so move the initialization for the normal startup case
        out of the common code
      8a52daa2
  9. 30 6月, 2009 1 次提交
  10. 29 6月, 2009 1 次提交
  11. 25 6月, 2009 2 次提交
  12. 23 6月, 2009 1 次提交
  13. 16 6月, 2009 1 次提交
  14. 12 6月, 2009 1 次提交