1. 02 8月, 2013 1 次提交
    • J
      build: fix qemuagenttest build with -O0 in fedora 19. · a320730a
      Jincheng Miao 提交于
      When building libvirt with -O0 flag in fedora 19, it will fail to
      generate qemuagenttest, a link error occurs like:
      
      ./.libs/libqemumonitortestutils.a(qemumonitortestutils.o): In function `qemuMonitorTestFree':
      libvirt/tests/qemumonitortestutils.c:346: undefined reference to `qemuMonitorClose'
      ./.libs/libqemumonitortestutils.a(qemumonitortestutils.o): In function `qemuMonitorTestNew':
      libvirt/tests/qemumonitortestutils.c:870: undefined reference to `qemuMonitorOpen'
      collect2: error: ld returned 1 exit status
      
      Fix it by listing libraries in the correct order to avoid lazy linkage.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a320730a
  2. 31 7月, 2013 1 次提交
  3. 22 7月, 2013 2 次提交
    • D
      Add API for calling systemd-machined's DBus API · dff93f8c
      Daniel P. Berrange 提交于
      To register virtual machines and containers with systemd-machined,
      and thus have cgroups auto-created, we need to talk over DBus.
      This is somewhat tedious code, so introduce a dedicated function
      to isolate the DBus call in one place.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      dff93f8c
    • D
      Introduce virDBusCallMethod & virDBusMessageRead methods · 834c9c94
      Daniel P. Berrange 提交于
      Doing DBus method calls using libdbus.so is tedious in the
      extreme. systemd developers came up with a nice high level
      API for DBus method calls (sd_bus_call_method). While
      systemd doesn't use libdbus.so, their API design can easily
      be ported to libdbus.so.
      
      This patch thus introduces methods virDBusCallMethod &
      virDBusMessageRead, which are based on the code used for
      sd_bus_call_method and sd_bus_message_read. This code in
      systemd is under the LGPLv2+, so we're license compatible.
      
      This code is probably pretty unintelligible unless you are
      familiar with the DBus type system. So I added some API
      docs trying to explain how to use them, as well as test
      cases to validate that I didn't screw up the adaptation
      from the original systemd code.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      834c9c94
  4. 19 7月, 2013 1 次提交
    • E
      maint: split long lines in Makefiles · d21d40bf
      Eric Blake 提交于
      Makefiles are another easy file to enforce line limits.
      
      Mostly straightforward; interesting tricks worth noting:
      src/Makefile.am: $(confdir) was already defined, use it in more places
      tests/Makefile.am: path_add and VG required some interesting compression
      
      * cfg.mk (sc_prohibit_long_lines): Add another test.
      * Makefile.am: Fix offenders.
      * daemon/Makefile.am: Likewise.
      * docs/Makefile.am: Likewise.
      * python/Makefile.am: Likewise.
      * src/Makefile.am: Likewise.
      * tests/Makefile.am: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d21d40bf
  5. 26 6月, 2013 1 次提交
    • L
      test: include qemuhotplugtest data files in source rpm · ec30f0f7
      Laine Stump 提交于
      commit 0fc12bca added a new test called qemuhotplugtest which has
      several data files in tests/qemuhotplugtestdata, but didn't add that
      directory to EXTRA_DIST in the tests Makefile.am, so the make check
      done during a make rpm was failing due to missing data files.
      ec30f0f7
  6. 25 6月, 2013 1 次提交
  7. 21 5月, 2013 1 次提交
    • E
      maint: use LGPL correctly · d7f53c7b
      Eric Blake 提交于
      Several files called out COPYING or COPYING.LIB instead of using
      the normal boilerplate.  It's especially important that we don't
      call out COPYING from an LGPL file, since COPYING is traditionally
      used for the GPL.  A few files were lacking copyright altogether.
      
      * src/rpc/gendispatch.pl: Add missing copyright.
      * Makefile.nonreentrant: Likewise.
      * src/check-symfile.pl: Likewise.
      * src/check-symsorting.pl: Likewise.
      * src/driver.h: Likewise.
      * src/internal.h: Likewise.
      * tools/libvirt-guests.sh.in: Likewise.
      * tools/virt-pki-validate.in: Mention copyright in comment, not just code.
      * tools/virt-sanlock-cleanup.in: Likewise.
      * src/rpc/genprotocol.pl: Spell out license terms.
      * src/xen/xend_internal.h: Likewise.
      * src/xen/xend_internal.c: Likewise.
      * Makefile.am: Likewise.
      * daemon/Makefile.am: Likewise.
      * docs/Makefile.am: Likewise.
      * docs/schemas/Makefile.am: Likewise.
      * examples/apparmor/Makefile.am: Likewise.
      * examples/domain-events/events-c/Makefile.am: Likewise.
      * examples/dominfo/Makefile.am: Likewise.
      * examples/domsuspend/Makefile.am: Likewise.
      * examples/hellolibvirt/Makefile.am: Likewise.
      * examples/openauth/Makefile.am: Likewise.
      * examples/python/Makefile.am: Likewise.
      * examples/systemtap/Makefile.am: Likewise.
      * examples/xml/nwfilter/Makefile.am: Likewise.
      * gnulib/lib/Makefile.am: Likewise.
      * gnulib/tests/Makefile.am: Likewise.
      * include/Makefile.am: Likewise.
      * include/libvirt/Makefile.am: Likewise.
      * python/Makefile.am: Likewise.
      * python/tests/Makefile.am: Likewise.
      * src/Makefile.am: Likewise.
      * tests/Makefile.am: Likewise.
      * tools/Makefile.am: Likewise.
      * configure.ac: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d7f53c7b
  8. 17 5月, 2013 2 次提交
  9. 15 5月, 2013 2 次提交
  10. 13 5月, 2013 1 次提交
    • O
      tests: Add tests for fc_host · 9706d85f
      Osier Yang 提交于
      Since the NPIV machine is not easy to get, it's very likely to
      introduce regressions when doing changes on the existing code.
      This patch dumps part of the sysfs files (the necessary ones)
      of fc_host as test input data, to test the related util functions.
      It could be extended for more fc_host related testing in future.
      9706d85f
  11. 11 5月, 2013 1 次提交
  12. 16 4月, 2013 2 次提交
    • D
      Add a test suite for cgroups functionality · d1452470
      Daniel P. Berrange 提交于
      Some aspects of the cgroups setup / detection code are quite subtle
      and easy to break. It would greatly benefit from unit testing, but
      this is difficult because the test suite won't have privileges to
      play around with cgroups. The solution is to use monkey patching
      via LD_PRELOAD to override the fopen, open, mkdir, access functions
      to redirect access of cgroups files to some magic stubs in the
      test suite.
      
      Using this we provide custom content for the /proc/cgroup and
      /proc/self/mounts files which report a fixed cgroup setup. We
      then override open/mkdir/access so that access to the cgroups
      filesystem gets redirected into files in a temporary directory
      tree in the test suite build dir.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d1452470
    • D
      Conditionally compile storagevolxml2argvtest · b7f1d218
      Daniel P. Berrange 提交于
      Only compile storagevolxml2argvtest if WITH_STORAGE is
      set, because it links to that driver
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b7f1d218
  13. 08 4月, 2013 1 次提交
  14. 20 3月, 2013 1 次提交
  15. 19 3月, 2013 1 次提交
  16. 27 2月, 2013 1 次提交
    • E
      tests: old automake lacks abs_builddir · b6176e52
      Eric Blake 提交于
      On RHEL 5, 'make check' included failures such as:
      
      TEST: virstoragetest
      unable to create directory /virstoragedata/sub
      unable to return to correct directory, refusing to clean up /virstoragedata
      
      It turns out that with automake 1.9.x, $(abs_builddir) is not
      automatically provided.  We have previously worked around this
      by using `pwd` before, but because we did not do it everywhere,
      we had a number of broken tests.
      
      This patch brings RHEL 5 from 8 failed tests down to 5 (the
      remaining failures may be due to bugs in the older libxml2 and
      RNG schema validation available in RHEL 5, so I'm not sure if
      they can be fixed in libvirt, but I'm still investigating).
      
      * tests/Makefile.am (AM_CFLAGS): Reliably set abs_builddir.
      (*_la_CFLAGS): Factor out common settings; delete when nothing
      remains to be added.
      b6176e52
  17. 25 2月, 2013 1 次提交
  18. 16 2月, 2013 1 次提交
    • E
      storage: test backing chain traversal · a18452d0
      Eric Blake 提交于
      Testing our backing chain handling will make it much easier to
      ensure that we avoid issues in the future.  If only I had written
      this test before I first caused several regressions...
      
      * tests/virstoragetest.c: New test.
      * tests/Makefile.am (test_programs): Build it.
      * .gitignore: Ignore new files.
      a18452d0
  19. 13 2月, 2013 1 次提交
    • E
      util: add virendian.h macros · c6f1060c
      Eric Blake 提交于
      We have several cases where we need to read endian-dependent
      data regardless of host endianness; rather than open-coding
      these call sites, it will be nicer to funnel things through
      a macro.
      
      The virendian.h file can be expanded to add writer functions,
      and/or 16-bit access patterns, if needed.  Also, if we need
      to turn things into a function to avoid multiple evaluations
      of buf, that can be done later.  But for now, a macro worked.
      
      * src/util/virendian.h: New file.
      * src/Makefile.am (UTIL_SOURCES): Ship it.
      * tests/virendiantest.c: New test.
      * tests/Makefile.am (test_programs, virendiantest_SOURCES): Run
      the test.
      * .gitignore: Ignore built file.
      c6f1060c
  20. 31 1月, 2013 1 次提交
  21. 16 1月, 2013 1 次提交
  22. 14 1月, 2013 2 次提交
    • D
      Add a test suite for validating SELinux labelling · 907a39e7
      Daniel P. Berrange 提交于
      There are many aspects of the guest XML which result in the
      SELinux driver applying file labelling. With the increasing
      configuration options it is desirable to test this behaviour.
      It is not possible to assume that the test suite has the
      ability to set SELinux labels. Most filesystems though will
      support extended attributes. Thus for the purpose of testing,
      it is possible to extend the existing LD_PRELOAD hack to
      override setfilecon() and getfilecon() to simply use the
      'user.libvirt.selinux' attribute for the sake of testing.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      907a39e7
    • D
      Rename HAVE_GNUTLS to WITH_GNUTLS · bccd4a8c
      Daniel P. Berrange 提交于
      bccd4a8c
  23. 11 1月, 2013 1 次提交
  24. 09 1月, 2013 1 次提交
  25. 18 12月, 2012 1 次提交
  26. 11 12月, 2012 1 次提交
    • G
      network: put dnsmasq parameters in conf-file instead of command line · 8b32c80d
      Gene Czarcinski 提交于
      This patch changes how parameters are passed to dnsmasq.  Instead of
      being on the command line, the parameters are put into a file (one
      parameter per line) and a commandline --conf-file= specifies the
      location of the file.  The file is located in the same directory as
      the leases file.
      
      Putting the dnsmasq parameters into a configuration file
      allows them to be examined and more easily understood than
      examining the command lines displayed by "ps ax".  This is
      especially true when a number of networks have been started.
      
      When the use of dnsmasq was originally done, the required command line
      was simple, but it has gotten more complicated over time and will
      likely become even more complicated in the future.
      
      Note: The test conf files have all been renamed .conf instead of
      .argv, and tests/networkxml2xmlargvdata was moved to
      tests/networkxml2xmlconfdata.
      8b32c80d
  27. 01 12月, 2012 1 次提交
  28. 16 10月, 2012 1 次提交
    • D
      Introduce an internal API for handling file based lockspaces · eca72d47
      Daniel P. Berrange 提交于
      The previously introduced virFile{Lock,Unlock} APIs provide a
      way to acquire/release fcntl() locks on individual files. For
      unknown reason though, the POSIX spec says that fcntl() locks
      are released when *any* file handle referring to the same path
      is closed. In the following sequence
      
        threadA: fd1 = open("foo")
        threadB: fd2 = open("foo")
        threadA: virFileLock(fd1)
        threadB: virFileLock(fd2)
        threadB: close(fd2)
      
      you'd expect threadA to come out holding a lock on 'foo', and
      indeed it does hold a lock for a very short time. Unfortunately
      when threadB does close(fd2) this releases the lock associated
      with fd1. For the current libvirt use case for virFileLock -
      pidfiles - this doesn't matter since the lock is acquired
      at startup while single threaded an never released until
      exit.
      
      To provide a more generally useful API though, it is necessary
      to introduce a slightly higher level abstraction, which is to
      be referred to as a "lockspace".  This is to be provided by
      a virLockSpacePtr object in src/util/virlockspace.{c,h}. The
      core idea is that the lockspace keeps track of what files are
      already open+locked. This means that when a 2nd thread comes
      along and tries to acquire a lock, it doesn't end up opening
      and closing a new FD. The lockspace just checks the current
      list of held locks and immediately returns VIR_ERR_RESOURCE_BUSY.
      
      NB, the API as it stands is designed on the basis that the
      files being locked are not being otherwise opened and used
      by the application code. One approach to using this API is to
      acquire locks based on a hash of the filepath.
      
      eg to lock /var/lib/libvirt/images/foo.img the application
      might do
      
         virLockSpacePtr lockspace = virLockSpaceNew("/var/lib/libvirt/imagelocks");
         lockname = md5sum("/var/lib/libvirt/images/foo.img");
         virLockSpaceAcquireLock(lockspace, lockname);
      
      NB, in this example, the caller should ensure that the path
      is canonicalized before calculating the checksum.
      
      It is also possible to do locks directly on resources by
      using a NULL lockspace directory and then using the file
      path as the lock name eg
      
         virLockSpacePtr lockspace = virLockSpaceNew(NULL);
         virLockSpaceAcquireLock(lockspace, "/var/lib/libvirt/images/foo.img");
      
      This is only safe to do though if no other part of the process
      will be opening the files. This will be the case when this
      code is used inside the soon-to-be-reposted virlockd daemon
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      eca72d47
  29. 18 9月, 2012 1 次提交
    • H
      New functions for virBitmap · 0fc89098
      Hu Tao 提交于
      In many places we store bitmap info in a chunk of data
      (pointed to by a char *), and have redundant codes to
      set/unset bits. This patch extends virBitmap, and convert
      those codes to use virBitmap in subsequent patches.
      0fc89098
  30. 13 9月, 2012 1 次提交
    • E
      build: avoid confusing make with raw name 'undefine' · a20f06d9
      Eric Blake 提交于
      Make has a builtin operator 'undefine', and coupled with latest
      automake.git, this test name ended up confusing make into thinking
      the file name was meant to be used as the make operator.  Renaming
      the file avoids the confusion.
      
      * tests/undefine: Rename...
      * tests/virsh-undefine: ...to this.
      * tests/Makefile.am (test_scripts): Use new name.
      Reported by Jim Meyering.
      a20f06d9
  31. 07 9月, 2012 2 次提交
  32. 21 8月, 2012 2 次提交
    • E
      build: split driver_storage into convenience library · 1a4379cb
      Eric Blake 提交于
      Commit 1d22ba95 was complete at the time, but we have since
      reintroduced a warning that is fixed in the same manner:
      
        CCLD   storagebackendsheepdogtest
      
      *** Warning: Linking the executable storagebackendsheepdogtest against the loadable module
      *** libvirt_driver_storage.so is not portable!
      
      * src/Makefile.am (libvirt_driver_storage.la): Factor into new
      convenience library libvirt_driver_storage_impl.la.
      * tests/Makefile.am (storagebackendsheepdogtest_LDADD): Link to
      convenience library, not shared library.
      1a4379cb
    • D
      Add test case for SELinux label generation · 9136032a
      Daniel P. Berrange 提交于
      This test case validates the correct generation of SELinux labels
      for VMs, wrt the current process label. Since we can't actually
      change the label of the test program process, we create a shared
      library libsecurityselinuxhelper.so which overrides the getcon()
      and setcon() libselinux.so functions. When started the test case
      will check to see if LD_PRELOAD is set, and if not, it will
      re-exec() itself setting LD_PRELOAD=libsecurityselinuxhelper.so
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      9136032a
  33. 07 8月, 2012 1 次提交