1. 14 7月, 2012 1 次提交
    • D
      Define public API for receiving guest memory balloon events · 7ed6d7dd
      Daniel P. Berrange 提交于
      When the guest changes its memory balloon applications may want
      to know what the new value is, without having to periodically
      poll on XML / domain info. Introduce a "balloon change" event
      to let apps see this
      
      * include/libvirt/libvirt.h.in: Define the
        virConnectDomainEventBalloonChangeCallback callback
        and VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE constant
      * python/libvirt-override-virConnect.py,
        python/libvirt-override.c: Wire up helpers for new event
      * daemon/remote.c: Helper for serializing balloon event
      * examples/domain-events/events-c/event-test.c,
        examples/domain-events/events-python/event-test.py: Add
        example of balloon event usage
      * src/conf/domain_event.c, src/conf/domain_event.h: Handling
        of balloon events
      * src/remote/remote_driver.c: Add handler of balloon events
      * src/remote/remote_protocol.x: Define wire protocol for
        balloon events
      * src/remote_protocol-structs: Likewise.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      7ed6d7dd
  2. 10 7月, 2012 1 次提交
  3. 05 7月, 2012 1 次提交
  4. 20 6月, 2012 1 次提交
    • E
      list: new helper function to collect snapshots · 8548a9c5
      Eric Blake 提交于
      Wraps the conversion from 'char *name' to virDomainSnapshotPtr in
      a reusable manner.
      
      * src/conf/virdomainlist.h (virDomainListSnapshots): New declaration.
      * src/conf/virdomainlist.c (virDomainListSnapshots): Implement it.
      * src/libvirt_private.syms (virdomainlist.h): Export it.
      8548a9c5
  5. 19 6月, 2012 2 次提交
    • E
      snapshot: merge domain and snapshot computation · 7e111c6f
      Eric Blake 提交于
      Now that domain listing is a thin wrapper around child listing,
      it's easier to have a common entry point.  This restores the
      hashForEach optimization lost in the previous patch when there
      are no snapshots being filtered out of the entire list.
      
      * src/conf/domain_conf.h (virDomainSnapshotObjListGetNames)
      (virDomainSnapshotObjListNum): Add parameter.
      (virDomainSnapshotObjListGetNamesFrom)
      (virDomainSnapshotObjListNumFrom): Delete.
      * src/libvirt_private.syms (domain_conf.h): Drop deleted functions.
      * src/conf/domain_conf.c (virDomainSnapshotObjListGetNames):
      Merge, and (re)add an optimization.
      * src/qemu/qemu_driver.c (qemuDomainUndefineFlags)
      (qemuDomainSnapshotListNames, qemuDomainSnapshotNum)
      (qemuDomainSnapshotListChildrenNames)
      (qemuDomainSnapshotNumChildren): Update callers.
      * src/qemu/qemu_migration.c (qemuMigrationIsAllowed): Likewise.
      * src/conf/virdomainlist.c (virDomainListPopulate): Likewise.
      7e111c6f
    • P
      conf: Add helper for listing domains on drivers supporting virDomainObj · 2c680804
      Peter Krempa 提交于
      This patch adds common code to list domains in fashion used by
      virListAllDomains with all currently supported flags. The header file
      also contains macros that group filters together that are used to
      shorten filter conditions.
      2c680804
  6. 12 6月, 2012 1 次提交
  7. 11 6月, 2012 1 次提交
    • E
      buf: support peeking at string contents · 9202f2c2
      Eric Blake 提交于
      Right now, the only way to get at the contents of a virBuffer is
      to destroy it.  But there are cases in my upcoming patches where
      peeking at the contents makes life easier.  I suppose this does
      open up the potential for bad code to dereference a stale pointer,
      by disregarding the docs that the return value is invalid on the
      next virBuf operation, but such is life.
      
      * src/util/buf.h (virBufferCurrentContent): New declaration.
      * src/util/buf.c (virBufferCurrentContent): Implement it.
      * src/libvirt_private.syms (buf.h): Export it.
      * tests/virbuftest.c (testBufAutoIndent): Test it.
      9202f2c2
  8. 02 6月, 2012 1 次提交
    • S
      nwfilter: move code for IP address map into separate file · 797b4758
      Stefan Berger 提交于
      The goal of this patch is to prepare for support for multiple IP
      addresses per interface in the DHCP snooping code.
      
      Move the code for the IP address map that maps interface names to
      IP addresses into their own file. Rename the functions on the way
      but otherwise leave the code as-is. Initialize this new layer
      separately before dependent layers (iplearning, dhcpsnooping)
      and shut it down after them.
      797b4758
  9. 28 5月, 2012 1 次提交
    • D
      Add impl of APIs to get user directories on Win32 · 076f2006
      Daniel P. Berrange 提交于
      Add an impl of +virGetUserRuntimeDirectory, virGetUserCacheDirectory
      virGetUserConfigDirectory and virGetUserDirectory for Win32 platform.
      Also create stubs for non-Win32 platforms which lack getpwuid_r()
      
      In adding these two helpers were added virFileIsAbsPath and
      virFileSkipRoot, along with some macros VIR_FILE_DIR_SEPARATOR,
      VIR_FILE_DIR_SEPARATOR_S, VIR_FILE_IS_DIR_SEPARATOR,
      VIR_FILE_PATH_SEPARATOR, VIR_FILE_PATH_SEPARATOR_S
      
      All this code was adapted from GLib2 under terms of LGPLv2+ license.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      076f2006
  10. 24 5月, 2012 1 次提交
    • D
      Remove libvirt_test.la library · 6cd4b1fe
      Daniel P. Berrange 提交于
      The libvirt_test.la library was introduced to allow test suites
      to reference internal-only symbols. These days, nearly every
      symbol we care about is in src/libvirt_private.syms, so there
      is no need for libvirt_test.la to continue to exist
      
      * src/Makefile.am: Delete libvirt_test.la & add new .syms files
      * src/libvirt_private.syms: Export symbols needed by test suite
      * tests/Makefile.am: Link to libvirt_test.la. Ensure LXC tests link
        to network_driver.la
      * src/libvirt_esx.syms, src/libvirt_openvz.syms: Add exports needed
        by test suite
      6cd4b1fe
  11. 22 5月, 2012 2 次提交
    • L
      util: export virBufferTrim · 3404729e
      Laine Stump 提交于
      This was forgotten in commit cdb87b1c.
      3404729e
    • D
      Fix potential events deadlock when unref'ing virConnectPtr · 2cb0899e
      Daniel P. Berrange 提交于
      When the last reference to a virConnectPtr is released by
      libvirtd, it was possible for a deadlock to occur in the
      virDomainEventState functions. The virDomainEventStatePtr
      holds a reference on virConnectPtr for each registered
      callback. When removing a callback, the virUnrefConnect
      function is run. If this causes the last reference on the
      virConnectPtr to be released, then virReleaseConnect can
      be run, which in turns calls qemudClose. This function has
      a call to virDomainEventStateDeregisterConn which is intended
      to remove all callbacks associated with the virConnectPtr
      instance. This will try to grab a lock on virDomainEventState
      but this lock is already held. Deadlock ensues
      
      Thread 1 (Thread 0x7fcbb526a840 (LWP 23185)):
      
      Since each callback associated with a virConnectPtr holds a
      reference on virConnectPtr, it is impossible for the qemudClose
      method to be invoked while any callbacks are still registered.
      Thus the call to virDomainEventStateDeregisterConn must in fact
      be a no-op. Thus it is possible to just remove all trace of
      virDomainEventStateDeregisterConn and avoid the deadlock.
      
      * src/conf/domain_event.c, src/conf/domain_event.h,
        src/libvirt_private.syms: Delete virDomainEventStateDeregisterConn
      * src/libxl/libxl_driver.c, src/lxc/lxc_driver.c,
        src/qemu/qemu_driver.c, src/uml/uml_driver.c: Remove
        calls to virDomainEventStateDeregisterConn
      2cb0899e
  12. 16 5月, 2012 1 次提交
  13. 14 5月, 2012 1 次提交
    • W
      Use XDG Base Directories instead of storing in home directory · 32a9aac2
      William Jon McCann 提交于
      As defined in:
      http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
      
      This offers a number of advantages:
       * Allows sharing a home directory between different machines, or
      sessions (eg. using NFS)
       * Cleanly separates cache, runtime (eg. sockets), or app data from
      user settings
       * Supports performing smart or selective migration of settings
      between different OS versions
       * Supports reseting settings without breaking things
       * Makes it possible to clear cache data to make room when the disk
      is filling up
       * Allows us to write a robust and efficient backup solution
       * Allows an admin flexibility to change where data and settings are stored
       * Dramatically reduces the complexity and incoherence of the
      system for administrators
      32a9aac2
  14. 09 5月, 2012 1 次提交
    • O
      numad: Set memory policy from numad advisory nodeset · 97010eb1
      Osier Yang 提交于
      Though numad will manage the memory allocation of task dynamically,
      it wants management application (libvirt) to pre-set the memory
      policy according to the advisory nodeset returned from querying numad,
      (just like pre-bind CPU nodeset for domain process), and thus the
      performance could benefit much more from it.
      
      This patch introduces new XML tag 'placement', value 'auto' indicates
      whether to set the memory policy with the advisory nodeset from numad,
      and its value defaults to the value of <vcpu> placement, or 'static'
      if 'nodeset' is specified. Example of the new XML tag's usage:
      
        <numatune>
          <memory placement='auto' mode='interleave'/>
        </numatune>
      
      Just like what current "numatune" does, the 'auto' numa memory policy
      setting uses libnuma's API too.
      
      If <vcpu> "placement" is "auto", and <numatune> is not specified
      explicitly, a default <numatume> will be added with "placement"
      set as "auto", and "mode" set as "strict".
      
      The following XML can now fully drive numad:
      
      1) <vcpu> placement is 'auto', no <numatune> is specified.
      
         <vcpu placement='auto'>10</vcpu>
      
      2) <vcpu> placement is 'auto', no 'placement' is specified for
         <numatune>.
      
         <vcpu placement='auto'>10</vcpu>
         <numatune>
           <memory mode='interleave'/>
         </numatune>
      
      And it's also able to control the CPU placement and memory policy
      independently. e.g.
      
      1) <vcpu> placement is 'auto', and <numatune> placement is 'static'
      
         <vcpu placement='auto'>10</vcpu>
         <numatune>
           <memory mode='strict' nodeset='0-10,^7'/>
         </numatune>
      
      2) <vcpu> placement is 'static', and <numatune> placement is 'auto'
      
         <vcpu placement='static' cpuset='0-24,^12'>10</vcpu>
         <numatune>
           <memory mode='interleave' placement='auto'/>
         </numatume>
      
      A follow up patch will change the XML formatting codes to always output
      'placement' for <vcpu>, even it's 'static'.
      97010eb1
  15. 08 5月, 2012 2 次提交
  16. 07 5月, 2012 1 次提交
    • G
      usb: create functions to search usb device accurately · 9914477e
      Guannan Ren 提交于
      usbFindDevice():get usb device according to
                      idVendor, idProduct, bus, device
                      it is the exact match of the four parameters
      
      usbFindDeviceByBus():get usb device according to bus, device
                        it returns only one usb device same as usbFindDevice
      
      usbFindDeviceByVendor():get usb device according to idVendor,idProduct
                           it probably returns multiple usb devices.
      
      usbDeviceSearch(): a helper function to do the actual search
      9914477e
  17. 03 5月, 2012 1 次提交
  18. 30 4月, 2012 1 次提交
    • J
      qemu: Make sure qemu can access its directory in hugetlbfs · 9d2ac545
      Jiri Denemark 提交于
      When libvirtd is started, we create "libvirt/qemu" directories under
      hugetlbfs mount point. Only the "qemu" subdirectory is chowned to qemu
      user and "libvirt" remains owned by root. If umask was too restrictive
      when libvirtd started, qemu user may lose access to "qemu"
      subdirectory. Let's explicitly grant search permissions to "libvirt"
      directory for all users.
      9d2ac545
  19. 25 4月, 2012 1 次提交
    • S
      Add new functions to virSocketAddr · 1614970e
      Stefan Berger 提交于
      Add 2 new functions to the virSocketAddr 'class':
      
      - virSocketAddrEqual: tests whether two IP addresses and their ports are equal
      - virSocketaddSetIPv4Addr: set a virSocketAddr given a 32 bit int
      1614970e
  20. 20 4月, 2012 1 次提交
    • D
      The policy kit and HAL node device drivers both require a · 2223ea98
      Daniel P. Berrange 提交于
      DBus connection. The HAL device code further requires that
      the DBus connection is integrated with the event loop and
      provides such glue logic itself.
      
      The forthcoming FirewallD integration also requires a
      dbus connection with event loop integration. Thus we need
      to pull the current event loop glue out of the HAL driver.
      
      Thus we create src/util/virdbus.{c,h} files. This contains
      just one method virDBusGetSystemBus() which obtains a handle
      to the single shared system bus instance, with event glue
      automagically setup.
      2223ea98
  21. 19 4月, 2012 1 次提交
  22. 13 4月, 2012 1 次提交
  23. 02 4月, 2012 1 次提交
    • P
      Support clock=variable relative to localtime · b8bf79aa
      Philipp Hahn 提交于
      Since Xen 3.1 the clock=variable semantic is supported. In addition to
      qemu/kvm Xen also knows about a variant where the offset is relative to
      'localtime' instead of 'utc'.
      
      Extends the libvirt structure with a flag 'basis' to specify, if the
      offset is relative to 'localtime' or 'utc'.
      
      Extends the libvirt structure with a flag 'reset' to force the reset
      behaviour of 'localtime' and 'utc'; this is needed for backward
      compatibility with previous versions of libvirt, since they report
      incorrect XML.
      
      Adapt the only user 'qemu' to the new name.
      Extend the RelaxNG schema accordingly.
      Document the new 'basis' attribute in the HTML documentation.
      Adapt test for the new attribute.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      b8bf79aa
  24. 29 3月, 2012 1 次提交
  25. 23 3月, 2012 9 次提交
    • O
      Add support for the suspend event · 487c0633
      Osier Yang 提交于
      This patch introduces a new event type for the QMP event
      SUSPEND:
      
          VIR_DOMAIN_EVENT_ID_PMSUSPEND
      
      The event doesn't take any data, but considering there might
      be reason for wakeup in future, the callback definition is:
      
      typedef void
      (*virConnectDomainEventSuspendCallback)(virConnectPtr conn,
                                              virDomainPtr dom,
                                              int reason,
                                              void *opaque);
      
      "reason" is unused currently, always passes "0".
      487c0633
    • O
      Add support for the wakeup event · 57ddcc23
      Osier Yang 提交于
      This patch introduces a new event type for the QMP event
      WAKEUP:
      
          VIR_DOMAIN_EVENT_ID_PMWAKEUP
      
      The event doesn't take any data, but considering there might
      be reason for wakeup in future, the callback definition is:
      
      typedef void
      (*virConnectDomainEventWakeupCallback)(virConnectPtr conn,
                                             virDomainPtr dom,
                                             int reason,
                                             void *opaque);
      
      "reason" is unused currently, always passes "0".
      57ddcc23
    • O
      Add support for event tray moved of removable disks · a26a1969
      Osier Yang 提交于
      This patch introduces a new event type for the QMP event
      DEVICE_TRAY_MOVED, which occurs when the tray of a removable
      disk is moved (i.e opened or closed):
      
          VIR_DOMAIN_EVENT_ID_TRAY_CHANGE
      
      The event's data includes the device alias and the reason
      for tray status' changing, which indicates why the tray
      status was changed. Thus the callback definition for the event
      is:
      
      enum {
          VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN = 0,
          VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE,
      
      \#ifdef VIR_ENUM_SENTINELS
          VIR_DOMAIN_EVENT_TRAY_CHANGE_LAST
      \#endif
      } virDomainEventTrayChangeReason;
      
      typedef void
      (*virConnectDomainEventTrayChangeCallback)(virConnectPtr conn,
                                                 virDomainPtr dom,
                                                 const char *devAlias,
                                                 int reason,
                                                 void *opaque);
      a26a1969
    • D
      Add helper API for finding auth file path · a4fb88b5
      Daniel P. Berrange 提交于
      * src/util/virauth.c, src/util/virauth.h: Add virAuthGetConfigFilePath
      * include/libvirt/virterror.h, src/util/virterror.c: Add
        VIR_FROM_AUTH error domain
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a4fb88b5
    • D
      Rename virRequest{Username,Password} to virAuthGet{Username,Password} · 4262e34e
      Daniel P. Berrange 提交于
      Ensure that the functions in virauth.h have names matching the file
      prefix, by renaming  virRequest{Username,Password} to
      virAuthGet{Username,Password}
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      4262e34e
    • D
      Add a virKeyfilePtr object for parsing '.ini' files · f6632f6b
      Daniel P. Berrange 提交于
      The '.ini' file format is a useful alternative to the existing
      config file style, when you need to have config files which
      are hashes of hashes. The 'virKeyFilePtr' object provides a
      way to parse these file types.
      
      * src/Makefile.am, src/util/virkeyfile.c,
        src/util/virkeyfile.h: Add .ini file parser
      * tests/Makefile.am, tests/virkeyfiletest.c: Test
        basic parsing capabilities
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f6632f6b
    • D
      Convert drivers over to use virURIPtr for query params · bc1ff160
      Daniel P. Berrange 提交于
      Convert drivers currently using the qparams APIs, to instead
      use the virURIPtr query parameters directly.
      
      * src/esx/esx_util.c, src/hyperv/hyperv_util.c,
        src/remote/remote_driver.c, src/xenapi/xenapi_utils.c: Remove
        use of qparams
      * src/util/qparams.h, src/util/qparams.c: Delete
      * src/Makefile.am, src/libvirt_private.syms: Remove qparams
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      bc1ff160
    • D
      Store parsed query parameters directly in the virURIPtr struct · 4ae4ae4b
      Daniel P. Berrange 提交于
      Avoid the need for each driver to parse query parameters itself
      by storing them directly in the virURIPtr struct. The parsing
      code is a copy of that from src/util/qparams.c  The latter will
      be removed in a later patch
      
      * src/util/viruri.h: Add query params to virURIPtr
      * src/util/viruri.c: Parse query parameters when creating virURIPtr
      * tests/viruritest.c: Expand test to cover params
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      4ae4ae4b
    • D
      Use virURIFree instead of xmlFreeURI · c33dae31
      Daniel P. Berrange 提交于
      Since we defined a custom virURIPtr type, we should use a
      virURIFree method instead of assuming it will always be
      a typedef for xmlURIPtr
      
      * src/util/viruri.c, src/util/viruri.h, src/libvirt_private.syms:
        Add a virURIFree method
      * src/datatypes.c, src/esx/esx_driver.c, src/libvirt.c,
        src/qemu/qemu_migration.c, src/vmx/vmx.c, src/xen/xend_internal.c,
        tests/viruritest.c: s/xmlFreeURI/virURIFree/
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c33dae31
  26. 20 3月, 2012 1 次提交
    • L
      conf: forbid use of multicast mac addresses · 00072373
      Laine Stump 提交于
      A few times libvirt users manually setting mac addresses have
      complained of a networking failure that ends up being due to a multicast
      mac address being used for a guest interface. This patch prevents that
      by logging an error and failing if a multicast mac address is
      encountered in each of the three following cases:
      
      1) domain xml <interface> mac address.
      2) network xml bridge mac address.
      3) network xml dhcp/host mac address.
      
      There are several other places where a mac address can be input that
      aren't controlled in this manner because failure to do so has no
      consequences (e.g., if the address will be used to search through
      existing interfaces for a match).
      
      The RNG has been updated to add multiMacAddr and uniMacAddr along with
      the existing macAddr, and macAddr was switched to uniMacAddr where
      appropriate.
      00072373
  27. 15 3月, 2012 2 次提交
    • O
      numad: Fix typo and warning · d86120fc
      Osier Yang 提交于
      src/libvirt_private.syms:
        s/virDomainCpuPlacement/virDomainCpuPlacementMode/
      src/qemu/qemu_process.c
        def->mem.cur_balloon expects "llu"
      --
      pushed under build-breaker rule
      d86120fc
    • O
      qemu: Support numad · 0f8e7ae3
      Osier Yang 提交于
      numad is an user-level daemon that monitors NUMA topology and
      processes resource consumption to facilitate good NUMA resource
      alignment of applications/virtual machines to improve performance
      and minimize cost of remote memory latencies. It provides a
      pre-placement advisory interface, so significant processes can
      be pre-bound to nodes with sufficient available resources.
      
      More details: http://fedoraproject.org/wiki/Features/numad
      
      "numad -w ncpus:memory_amount" is the advisory interface numad
      provides currently.
      
      This patch add the support by introducing a new XML attribute
      for <vcpu>. e.g.
      
        <vcpu placement="auto">4</vcpu>
        <vcpu placement="static" cpuset="1-10^6">4</vcpu>
      
      The returned advisory nodeset from numad will be printed
      in domain's dumped XML. e.g.
        <vcpu placement="auto" cpuset="1-10^6">4</vcpu>
      
      If placement is "auto", the number of vcpus and the current
      memory amount specified in domain XML will be used for numad
      command line (numad uses MB for memory amount):
        numad -w $num_of_vcpus:$current_memory_amount / 1024
      
      The advisory nodeset returned from numad will be used to set
      domain process CPU affinity then. (e.g. qemuProcessInitCpuAffinity).
      
      If the user specifies both CPU affinity policy (e.g.
      (<vcpu cpuset="1-10,^7,^8">4</vcpu>) and placement == "auto"
      the specified CPU affinity will be overridden.
      
      Only QEMU/KVM drivers support it now.
      
      See docs update in patch for more details.
      0f8e7ae3
  28. 12 3月, 2012 1 次提交
    • E
      cpustats: collect VM user and sys times · 0d0b4098
      Eric Blake 提交于
      As documented in linux.git/Documentation/cgroups/cpuacct.txt,
      cpuacct.stat returns user and system time in ticks (the same
      unit used in times(2)).  It would be a bit nicer if it were like
      getrusage(2) and reported timeval contents, or like cpuacct.usage
      and in nanoseconds, but we can't be picky.
      
      * src/util/cgroup.h (virCgroupGetCpuacctStat): New function.
      * src/util/cgroup.c (virCgroupGetCpuacctStat): Implement it.
      (virCgroupGetValueStr): Allow for multi-line files.
      * src/libvirt_private.syms (cgroup.h): Export it.
      0d0b4098