1. 07 9月, 2012 17 次提交
    • C
      events: Fix domain event race on client disconnect · defa8b85
      Christophe Fergeau 提交于
      GNOME Boxes sometimes stops getting domain events from libvirtd, even
      after restarting it. Further investigation in libvirtd shows that
      events are properly queued with virDomainEventStateQueue, but the
      timer virDomainEventTimer which flushes the events and sends them to
      the clients never gets called. Looking at the event queue in gdb
      shows that it's non-empty and that its size increases with each new
      events.
      
      virDomainEventTimer is set up in virDomainEventStateRegister[ID]
      when going from 0 client connecte to 1 client connected, but is
      initially disabled. The timer is removed in
      virDomainEventStateRegister[ID] when the last client is disconnected
      (going from 1 client connected to 0).
      
      This timer (which handles sending the events to the clients) is
      enabled in virDomainEventStateQueue when queueing an event on an
      empty queue (queue containing 0 events). It's disabled in
      virDomainEventStateFlush after flushing the queue (ie removing all
      the elements from it). This way, no extra work is done when the queue
      is empty, and when the next event comes up, the timer will get
      reenabled because the queue will go from 0 event to 1 event, which
      triggers enabling the timer.
      
      However, with this Boxes bug, we have a client connected (Boxes), a
      non-empty queue (there are events waiting to be sent), but a disabled
      timer, so something went wrong.
      
      When Boxes connects (it's the only client connecting to the libvirtd
      instance I used for debugging), the event timer is not set as expected
      (state->timer == -1 when virDomainEventStateRegisterID is called),
      but at the same time the event queue is not empty. In other words,
      we had no clients connected, but pending events. This also explains
      why the timer never gets enabled as this is only done when an event
      is queued on an empty queue.
      
      I think this can happen if an event gets queued using
      virDomainEventStateQueue and the client disconnection happens before
      the event timer virDomainEventTimer gets a chance to run and flush
      the event. In this situation, virDomainEventStateDeregister[ID] will
      get called with a non-empty event queue, the timer will be destroyed
      if this was the only client connected. Then, when other clients connect
      at a later time, they will never get notified about domain events as
      the event timer will never get enabled because the timer is only
      enabled if the event queue is empty when virDomainEventStateRegister[ID]
      gets called, which will is no longer the case.
      
      To avoid this issue, this commit makes sure to remove all events from
      the event queue when the last client in unregistered. As there is
      no longer anyone interested in receiving these events, these events
      are stale so there is no need to keep them around. A client connecting
      later will have no interest in getting events that happened before it
      got connected.
      defa8b85
    • D
      Fix location of SELinux mount during RPM builds · bd172f13
      Daniel P. Berrange 提交于
      When building RPMs the host kernel cannot be assumed to match
      the target OS kernel. Thus auto-detecting /selinux vs
      /sys/fs/selinux based on the host kernel can result in the
      wrong choice (eg F18 builds on a RHEL6 host kernel)
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      bd172f13
    • D
      Don't assume use of /sys/fs/cgroup · a4fd7405
      Daniel P. Berrange 提交于
      The introduction of /sys/fs/cgroup came in fairly recent kernels.
      Prior to that time distros would pick a custom directory like
      /cgroup or /dev/cgroup. We need to auto-detect where this is,
      rather than hardcoding it
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a4fd7405
    • D
      Introduce a test suite for the JSON monitor · 48d11221
      Daniel P. Berrange 提交于
      Take advantage of the previously added monitor helpers to
      create a test suite for the QEMU JSON monitor impl. As a
      proof of concept, this tests the 'qemuMonitorGetStatus'
      implementation
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      48d11221
    • D
      Add helper library for testing the qemu monitor code · 8d78fd04
      Daniel P. Berrange 提交于
      To be able to test the QEMU monitor code, we need to have a fake
      QEMU monitor server. This introduces a simple (dumb) framework
      that can do this. The test case registers a series of items to
      be sent back as replies to commands that will be executed. A
      thread runs the event loop looking for incoming replies and
      sending back this pre-registered data. This allows testing all
      QEMU monitor code that deals with parsing responses and errors
      from QEMU, without needing QEMU around
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      8d78fd04
    • D
      Add non-null annotations to qemuMonitorOpen · 1f490138
      Daniel P. Berrange 提交于
      Add some non-null annotations to qemuMonitorOpen and also
      check that the error callback is set, since it is mandatory
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1f490138
    • J
      examples: Fix event detail printing in python test · e2a7f97b
      Jiri Denemark 提交于
      If there is only one detail string for a particular event, we need to pu
      comma after the string otherwise the string itself will be taken as a
      list and only its first character will be printed out. For example,
      
          myDomainEventCallback1 EVENT: Domain fedora17(12) Shutdown F
      
      instead of the desired
      
          myDomainEventCallback1 EVENT: Domain fedora17(12) Shutdown Finished
      e2a7f97b
    • J
      Add PMSUSPENDED life cycle event · fc4115e8
      Jiri Denemark 提交于
      While PMSUSPENDED state was added a long time ago, we didn't have
      corresponding life cycle event.
      fc4115e8
    • J
      Fix PMSuspend and PMWakeup events · afab4824
      Jiri Denemark 提交于
      The unused reason parameter of PM{Suspend,Wakeup} event callbacks was
      completely ignored in lot of places and those events were not actually
      working at all.
      afab4824
    • P
      virsh: Update only changed scheduler tunables · 51907779
      Peter Krempa 提交于
      When setting the cpu tunables in virsh you are able to update only a
      subset of them. Virsh while doing the update updated all of the
      tunables, changed ones with new values and unchanged with old ones.
      This is unfortunate as it:
      a) might overwrite some other change by a race condition (unprobable)
      b) fails with range checking as some of the old values saved might be
         out of range
      
      This patch changes the update procedure so that only the changed value
      is updated on the host.
      
      This patch also fixes a very unprobable memory leak if the daemon would
      return a string tunable parameter, as the typed parameter array was not
      cleared.
      51907779
    • P
      util: Add helper to assign typed params from string · 245cef9f
      Peter Krempa 提交于
      This patch adds a helper to deal with assigning values to
      virTypedParameter structures from strings. The helper parses the value
      from the string and assigns it to the corresponding union value.
      245cef9f
    • P
      qemu: Add range checking for scheduler tunables when changed by API · 972e914f
      Peter Krempa 提交于
      The quota and period tunables for cpu scheduler accept only a certain
      range of values. When changing the live configuration invalid values get
      rejected. This check is not performed when changing persistent config.
      
      This patch adds a separate range check, that improves error messages
      when changing live config and adds the check for persistent config.
      This check is done only when using the API. It is still possible to
      specify invalid values in the XML.
      972e914f
    • P
      qemu: clean up qemuSetSchedulerParametersFlags() · 3e250b36
      Peter Krempa 提交于
      This patch tries to clean the code up a little bit and shorten very long
      lines.
      
      The apparent semantic change from moving the condition before calling
      the setter function is a non-issue here as the setter function is a
      no-op when called with both arguments zero.
      3e250b36
    • O
      virsh: Improve the document for pool-list · 6cdf0aaf
      Osier Yang 提交于
      Which is lost by commit 93a346d3.
      6cdf0aaf
    • E
      nwfilter: drop use of awk · ddd8c3b9
      Eric Blake 提交于
      Commit 2a41bc95 dropped a dependency on gawk, but we can go one step
      further and avoid awk altogether.
      
      * src/nwfilter/nwfilter_ebiptables_driver.c
      (iptablesLinkIPTablesBaseChain): Simplify command.
      (ebiptablesDriverInit, ebiptablesDriverShutdown): Drop awk probe.
      ddd8c3b9
    • G
      remove dnsmasq command line parameter "--filterwin2k" · f20b7dbe
      Gene Czarcinski 提交于
      This patch removed the "--filterwin2k" dnsmasq command line
      parameter which was unnecessary for domain specification,
      possibly blocked some usage, and was command line clutter.
      
      Gene Czarcinski <gene@czarc.net>
      f20b7dbe
    • E
      build: improved handling of <execinfo.h>, BSD <net/if.h> · ccaf0bee
      Eric Blake 提交于
      FreeBSD and OpenBSD have a <net/if.h> that is not self-contained;
      and mingw lacks the header altogether.  But gnulib has just taken
      care of that for us, so we might as well simplify our code.  In
      the process, I got a syntax-check failure if we don't also take
      the gnulib execinfo module.
      
      * .gnulib: Update to latest, for execinfo and net_if.
      * bootstrap.conf (gnulib_modules): Add execinfo and net_if modules.
      * configure.ac: Let gnulib check for headers.  Simplify check for
      'struct ifreq', while also including enough prereq headers.
      * src/internal.h (IF_NAMESIZE): Drop, now that gnulib guarantees it.
      * src/nwfilter/nwfilter_learnipaddr.h: Use correct header for
      IF_NAMESIZE.
      * src/util/virnetdev.c (includes): Assume <net/if.h> exists.
      * src/util/virnetdevbridge.c (includes): Likewise.
      * src/util/virnetdevtap.c (includes): Likewise.
      * src/util/logging.c (includes): Assume <execinfo.h> exists.
      (virLogStackTraceToFd): Handle gnulib's fallback implementation.
      ccaf0bee
  2. 06 9月, 2012 23 次提交
    • E
      build: avoid tabs that failed syntax-check · b6a14aec
      Eric Blake 提交于
      Introduced in commit f299ddd6.
      
      * src/check-symfile.pl: Fix whitespace.
      * .dir-locals.el (perl-mode): Prevent future occurrences.
      b6a14aec
    • E
      list: fix typo in virsh patch · 9a6e5751
      Eric Blake 提交于
      A last minute rename in commit fc122e1a to virsh.h was not properly
      reflected when rebasing virsh-pool.c in commit 93a346d3.
      
      * tools/virsh-pool.c (vshStoragePoolListCollect): Use VSH_MATCH,
      not MATCH.
      9a6e5751
    • D
      Remove duplicate symbols and add test case · f299ddd6
      Daniel P. Berrange 提交于
      When the event symbols were added to the public API, not all
      of them were removed from the private exports list. Solaris
      gets unhappy when there are duplicated symbols. Extend the
      symfile check to test for this scenario
      f299ddd6
    • O
      python: Expose virStorageListAllStoragePools to python binding · 92785780
      Osier Yang 提交于
      The implementation is done manually as the generator does not support
      wrapping lists of C pointers into Python objects.
      
      python/libvirt-override-api.xml: Document
      python/libvirt-override-virConnect.py: Add listAllStoragePools
      python/libvirt-override.c: Implementation for the wrapper.
      92785780
    • O
      list: Use virConnectListAllStoragePools in virsh · 93a346d3
      Osier Yang 提交于
      tools/virsh-pool.c:
        * vshStoragePoolSorter to sort the pool list by pool name.
      
        * struct vshStoragePoolList to present the pool list, pool info
          is collected by list->poolinfo if 'details' is specified by
          user.
      
        * vshStoragePoolListFree to free the pool list
      
        * vshStoragePoolListCollect to collect the pool list, new API
          virStorageListAllPools is tried first, if it's not supported,
          fall back to older APIs.
      
        * New options --persistent, --transient, --autostart, --no-autostart
          and --type for pool-list. --persistent or --transient is to filter
          the returned pool list by whether the pool is persistent or not.
          --autostart or --no-autostart is to filter the returned pool list
          by whether the pool is autostarting or not. --type is to filter
          the pools by pool types. E.g.
      
          % virsh pool-list --all --persistent --type dir,disk
      
      tools/virsh.pod:
         * Add documentations for the new options.
      93a346d3
    • O
      list: Change MATCH for common use in virsh · fc122e1a
      Osier Yang 提交于
      Move definition of MATCH from virsh-domain-monitor.c into
      virsh.h, and rename it as VSH_MATCH for further use.
      
      * tools/virsh-domain-monitor.c: Change MATCH into VSH_MATCH
      * tools/virsh.h: Define VSH_MATCH
      fc122e1a
    • O
      virsh: Fix the wrong doc for pool-list · 974a6330
      Osier Yang 提交于
      The storage pool's management doesn't relate with a domain, it
      probably was an intention, but not achieved yet. And the fact
      is only active pools are listed by default.
      974a6330
    • O
      list: Add helper to convert strings separated by ', ' to array · f7eac4f7
      Osier Yang 提交于
      tools/virsh.c: New helper function vshStringToArray.
      tools/virsh.h: Declare vshStringToArray.
      tools/virsh-domain.c: use the helper in cmdUndefine.
      f7eac4f7
    • O
      list: Implement listAllStoragePools for test driver · cf458628
      Osier Yang 提交于
      src/test/test_driver.c: Implement listAllStoragePools
      cf458628
    • O
      list: Implement listAllStoragePools for storage driver · c71f989b
      Osier Yang 提交于
      src/storage/storage_driver.c: Implement listAllStoragePools.
      c71f989b
    • O
      list: Implement the RPC calls for virConnectListAllStoragePools · 17fd0088
      Osier Yang 提交于
      The RPC generator doesn't support returning list of object, this patch does
      the work manually.
      
        * daemon/remote.c:
          Implement the server side handler remoteDispatchConnectListAllStoragePools
      
        * src/remote/remote_driver.c:
          Add remote driver handler remoteConnectListAllStoragePools.
      
        * src/remote/remote_protocol.x:
          New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_STORAGE_POOLS and
          structs to represent the args and ret for it.
      
        * src/remote_protocol-structs: Likewise.
      17fd0088
    • O
      list: Add helpers for listing storage pool objects · 84208a4a
      Osier Yang 提交于
      src/conf/storage_conf.c: Add virStoragePoolMatch to filter the
      pools; Add virStoragePoolList to iterate over the pool objects
      with filter.
      
      src/conf/storage_conf.h: Declare virStoragePoolMatch,
      virStoragePoolList, and the macros for filters.
      
      src/libvirt_private.syms: Export helper virStoragePoolList.
      84208a4a
    • O
      list: Define new API virStorageListAllStoragePools · 075c754a
      Osier Yang 提交于
      This introduces a new API to list the storage pool objects,
      4 groups of flags are provided to filter the returned pools:
      
        * Active or not
      
        * Autostarting or not
      
        * Persistent or not
      
        * And the pool type.
      
      include/libvirt/libvirt.h.in: New enum virConnectListAllStoragePoolFlags;
                                    Declare the API.
      python/generator.py: Skip the generating
      src/driver.h: (virDrvConnectListAllStoragePools)
      src/libvirt.c: Implementation for the API.
      src/libvirt_public.syms: Export the symbol.
      075c754a
    • P
      esx: Add implementation for virConnectListAllDomains() · 9e0ba44f
      Peter Krempa 提交于
      ESX doesn't use the common virDomainObj implementation so this patch
      adds a separate implementation.
      
      This driver supports all currently defined filtering flags, but as with
      other drivers some combinations yield a empty result list.
      9e0ba44f
    • P
      hyperv: Add implementation for virConnectListAllDomains() · 60d0ecda
      Peter Krempa 提交于
      Hyperv doesn't use the common virDomainObj implementation so this patch
      adds a separate implementation.
      
      This driver supports all currently added flags for filtering although
      some of those don't make sense with this driver (no support yet) and
      thus produce no output when used.
      60d0ecda
    • J
      Define DYNLIB_NAME on OpenBSD. · edc67a6f
      Jasper Lievisse Adriaanse 提交于
      edc67a6f
    • E
      build: avoid test failure when sasl was not compiled in · 5d3b65f9
      Eric Blake 提交于
      On systems without cyrus-sasl-devel available (I happened to be
      in that situation on my FreeBSD testing), this test fails rather
      miserably:
      
      TEST: libvirtdconftest
            .....!!!!!!...!!!!!!!!!!!!!!!!!!!!!!!!!  39  FAIL
      FAIL: libvirtdconftest
      
      with verbose output showing things like:
      
      39) Test corruption                                          ... libvir: Config File error : unsupporeted configuration: remoteReadConfigFile: /usr/home/dummy/libvirt/tests/../daemon/libvirtd.conf: auth_tcp: unsupported auth sasl
      
      * tests/libvirtdconftest.c (testCorrupt): Avoid failure when sasl
      is missing.
      5d3b65f9
    • E
      build: avoid check-symfile on non-Linux · ae94cf2d
      Eric Blake 提交于
      I tested both OpenBSD and cygwin; both failed 'make check' with:
      
        GEN    check-symfile
      Can't return outside a subroutine at ./check-symfile.pl line 13.
      
      Perl requires 'exit 77' instead of 'return 77' in that context,
      but even with that tweak, the build still fails, since the exit
      code of 77 is only special to explicit TESTS=foo listings, and
      not to make-only dependency rules where we are not going through
      automake's test framework.
      
      * src/check-symfile.pl: Kill bogus platform check...
      * src/Makefile.am (check-symfile): ...and replace with an automake
      conditional.
      ae94cf2d
    • L
      network: prevent infinite hang if ovs-vswitchd isn't running · 98e732fc
      Laine Stump 提交于
      This fixes https://bugzilla.redhat.com/show_bug.cgi?id=852984
      
      If a network or interface is configured to use Open vSwitch, but
      ovs-vswitchd (the Open vSwitch database service) isn't running, the
      ovs-vsctl add-port/del-port commands will hang indefinitely rather
      than returning an error. There is a --nowait option, but that appears
      to have no effect on add-port and del-port commands, so instead we add
      a --timeout=5 to the commands - they will retry for up to 5 seconds,
      then fail if there is no response.
      98e732fc
    • L
      build: require netcf-0.2.2 when installing on Fedora18+ · 89810fc4
      Laine Stump 提交于
      A previous patch forced libnl-3 and netcf-0.2.2 (which itself requires
      libnl-3) when *building* for Fedora 18+ (and RHEL 7+), but the
      install-time Requires: for netcf has always been implicit due to
      libvirtd linking with libnetcf.so. However, the since the API of netcf
      didn't change when it was rebuilt to use libnl-3, the internal library
      version didn't change either, making it possible (from rpm's point of
      view) to upgrade libvirt without upgrading netcf (in reality, that
      leads to a segfault - see
      https://bugzilla.redhat.com/show_bug.cgi?id=853381).
      
      The solution is to put an explicit Requires: line in libvirt's
      specfile for fedora >= 18 and rhel >= 7.
      89810fc4
    • E
      build: don't fail when xsltproc is missing · d51024ae
      Eric Blake 提交于
      On a machine without xsltproc, the build failed with:
      
      Scripting search.php
      /usr/local/bin/bash: line 1: search.php.tmp: No such file or directory
      rm: ./search.php: No such file or directory
      
      Regression introduced in commit 28183590.
      
      * docs/Makefile.am (%.php): Skip in the same conditions when the
      .tmp file is skipped.
      d51024ae
    • E
      build: avoid warnings from gcc 4.2.1 · c579d6b3
      Eric Blake 提交于
      OpenBSD ships with gcc 4.2.1, which annoyingly treats all format
      strings as though they were also attribute((nonnull)).  The two
      concepts are orthogonal, though, as evidenced by the number of
      spurious warnings it generates on uses where we know that
      virReportError specifically handles NULL instead of a format
      string; worse, since we now force -Werror on git builds, it
      prevents development builds on OpenBSD.
      
      I hate to do this, as it disables ALL format checking on older
      gcc, and therefore misses out on some useful checks (code that
      happened to compile on Linux may still have type mismatches
      when compiled on other platforms, as evidenced by the number
      of times I have fixed formatting mismatches for uid_t as found
      by warnings on Cygwin), but I don't see any other way to keep
      -Werror alive and still compile on OpenBSD.
      
      A more invasive change would be to make virReportError() mark
      its format attribute as nonnull, and fix (a lot of) fallout;
      we may end up doing that anyways as part of danpb's error
      refactoring improvements, but not today.
      
      * src/internal.h (ATTRIBUTE_FMT_PRINTF): Use preferred spellings.
      * m4/virt-compile-warnings.m4 (-Wformat): Disable on older gcc.
      c579d6b3
    • M
      qemu: don't pin all the cpus · 9f86fb93
      Martin Kletzander 提交于
      This is another fix for the emulator-pin series. When going through
      the cputune pinning settings, the current code is trying to pin all
      the CPUs, even when not all of them are specified. This causes error
      in the subsequent function which, of course, cannot find the cpu to
      pin. Since it's enough to pass the correct VCPU ID to the function,
      the fix is trivial.
      9f86fb93