1. 07 9月, 2011 1 次提交
    • M
      Threadpool: Initialize new dynamic workers · d1a366be
      Michal Privoznik 提交于
      Although we were initializing worker threads during pool creating,
      we missed this during virThreadPoolSendJob. This bug led to segmenation
      fault as worker thread free() given argument.
      d1a366be
  2. 06 9月, 2011 3 次提交
    • P
      link-state: util: Add equality comparison functions for structures · c246b025
      Peter Krempa 提交于
      This patch adds functions to compare structures containing network
      device configuration for equality. They serve for the purpose of
      disallowing unsupported changes to live network devices.
      c246b025
    • P
      XML: Improve XML parsing error messages · 9fd3bb7a
      Peter Krempa 提交于
      This patch modifies error handling function for the XML parser provided
      by libxml2.
      
      Originaly only a line number and error message were logged. With this
      new error handler function, the user is provided with a more complex
      description of the parsing error.
      
      Context of the error is printed in libXML2 style and filename of the
      file, that caused the error is printed. Example of an parse error:
      
      13:41:36.262: 16032: error : catchXMLError:706 :
      /etc/libvirt/qemu/rh_bad.xml:58: Opening and ending tag mismatch: name
      line 2 and domain
      </domain>
      ---------^
      
      Context of the error gives the user hints that may help to quickly
      locate a corrupt xml file.
      
      fixes BZs:
      ----------
      Bug 708735 - [RFE] Show column and line on XML parsing error
      https://bugzilla.redhat.com/show_bug.cgi?id=708735
      
      Bug 726771 - libvirt does not specify problem file if persistent xml is
      invalid
      https://bugzilla.redhat.com/show_bug.cgi?id=726771
      9fd3bb7a
    • M
      daemon: Create priority workers pool · 597fe3ce
      Michal Privoznik 提交于
      This patch annotates APIs with low or high priority.
      In low set MUST be all APIs which might eventually access monitor
      (and thus block indefinitely). Other APIs may be marked as high
      priority. However, some must be (e.g. domainDestroy).
      
      For high priority calls (HPC), there are some high priority workers
      (HPW) created in the pool. HPW can execute only HPC, although normal
      worker can process any call regardless priority. Therefore, only those
      APIs which are guaranteed to end in reasonable small amount of time
      can be marked as HPC.
      
      The size of this HPC pool is static, because HPC are expected to end
      quickly, therefore jobs assigned to this pool will be served quickly.
      It can be configured in libvirtd.conf via prio_workers variable.
      Default is set to 5.
      
      To mark API with low or high priority, append priority:{low|high} to
      it's comment in src/remote/remote_protocol.x. This is similar to
      autogen|skipgen. If not marked, the generator assumes low as default.
      597fe3ce
  3. 02 9月, 2011 1 次提交
    • O
      storage: Add fs pool formatting · 27758859
      Osier Yang 提交于
      This patch adds the ability to make the filesystem for a filesystem
      pool during a pool build.
      
      The patch adds two new flags, no overwrite and overwrite, to control
      when mkfs gets executed.  By default, the patch preserves the
      current behavior, i.e., if no flags are specified, pool build on a
      filesystem pool only makes the directory on which the filesystem
      will be mounted.
      
      If the no overwrite flag is specified, the target device is checked
      to determine if a filesystem of the type specified in the pool is
      present.  If a filesystem of that type is already present, mkfs is
      not executed and the build call returns an error.  Otherwise, mkfs
      is executed and any data present on the device is overwritten.
      
      If the overwrite flag is specified, mkfs is always executed, and any
      existing data on the target device is overwritten unconditionally.
      27758859
  4. 01 9月, 2011 1 次提交
    • D
      Don't leak memory if a cgroup is mounted multiple times · c32536e7
      Daniel P. Berrange 提交于
      It is possible (expected/likely in Fedora 15) for a cgroup controller
      to be mounted in multiple locations at the same time, due to bind
      mounts. Currently we leak memory if this happens, because we overwrite
      the previous 'mountPoint' string. Instead just accept the first match
      we find.
      
      * src/util/cgroup.c: Only accept first match for a cgroup
        controller mount
      c32536e7
  5. 30 8月, 2011 1 次提交
    • E
      build: simplify use of verify · 71a0beaf
      Eric Blake 提交于
      Back in 2008 when this line of util.h was written, gnulib's verify
      module didn't allow the use of multiple verify() in one file
      in combination with our choice of gcc -W options.  But that has
      since been fixed in gnulib, and newer gnulib even maps verify()
      to the C1x feature of _Static_assert, which gives even nicer
      diagnostics with a new enough compiler, so we might as well go
      with the simpler verify().
      
      * src/util/util.h (VIR_ENUM_IMPL): Use simpler verify, now that
      gnulib module is smarter.
      71a0beaf
  6. 26 8月, 2011 3 次提交
    • M
      hyperv: Add driver skeleton · 4d6e6f4a
      Matthias Bolte 提交于
      4d6e6f4a
    • M
      virterror: Fix error message for VIR_ERR_INVALID_ARG · 6c7299d4
      Michal Privoznik 提交于
      When a detail message is presented, nobody expects prefix 'invalid
      argument in' but something more general, like 'invalid argument:'.
      6c7299d4
    • D
      Fix keymap used to talk with QEMU · ce93f64b
      Daniel P. Berrange 提交于
      The QEMU 'sendkey' command expects keys to be encoded in the same
      way as the RFB extended keycode set. Specifically it wants extended
      keys to have the high bit of the first byte set, while the Linux
      XT KBD driver codeset uses the low bit of the second byte. To deal
      with this we introduce a new keymap 'RFB' and use that in the QEMU
      driver
      
      * include/libvirt/libvirt.h.in: Add VIR_KEYCODE_SET_RFB
      * src/qemu/qemu_driver.c: Use RFB keycode set instead of XT KBD
      * src/util/virkeycode-mapgen.py: Auto-generate the RFB keycode
        set from the XT KBD set
      * src/util/virkeycode.c: Add RFB keycode entry to table. Add a
        verify check on cardinality of the codeOffset table
      ce93f64b
  7. 25 8月, 2011 1 次提交
    • L
      util: only fchown newly created files in virFileOpenAs · b1643dc1
      Laine Stump 提交于
      virFileOpenAs takes desired uid:gid as arguments, and not only uses
      them for a fork/setuid/setgid when retrying failed open operations,
      but additionally always forces the opened file to be owned by the
      given uid:gid.
      
      One example of the problems this causes is that, when restoring a
      domain from a file that is owned by the qemu user, opening the file
      chowns it to root. if dynamic_ownership=1 this is coincidentally
      expected, but if dynamic_ownership=0, no existing file should ever
      have its ownership changed.
      
      This patch adds an extra check before calling fchown() - it only does
      it if O_CREAT was passed to virFileOpenAs() in the openflags.
      b1643dc1
  8. 24 8月, 2011 1 次提交
    • E
      maint: fix comment typos · 3a52b864
      Eric Blake 提交于
      * src/qemu/qemu_driver.c (qemuDomainSaveInternal): Fix typo.
      * src/conf/domain_event.c (virDomainEventDispatchMatchCallback):
      Likewise.
      * daemon/libvirtd.c (daemonRunStateInit): Likewise.
      * src/lxc/lxc_container.c (lxcContainerChildMountSort): Likewise.
      * src/util/virterror.c (virCopyError, virRaiseErrorFull): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxprSound): Likewise.
      3a52b864
  9. 22 8月, 2011 1 次提交
  10. 19 8月, 2011 1 次提交
    • E
      xml: add another convenience function · 751304e3
      Eric Blake 提交于
      Often, we want to use XPath functions on the just-parsed document;
      fold this into the parser function for convenience.
      
      * src/util/xml.h (virXMLParseHelper): Add argument.
      (virXMLParseStrHelper, virXMLParseFileHelper): Delete.
      (virXMLParseCtxt, virXMLParseStringCtxt, virXMLParseFileCtxt): New
      macros.
      * src/libvirt_private.syms (xml.h): Remove deleted functions.
      * src/util/xml.c (virXMLParseHelper): Add argument.
      (virXMLParseStrHelper, virXMLParseFileHelper): Delete.
      751304e3
  11. 18 8月, 2011 1 次提交
    • E
      build: fix virpidfile on mingw · c811de8f
      Eric Blake 提交于
      Regression introduced in commit b7e5ca48.
      
      Mingw lacks kill(), but we were only using it for a sanity check;
      so we can go with one less check.
      
      Also, on OOM error, this function should outright fail rather than
      claim that the pid file was successfully read.
      
      * src/util/virpidfile.c (virPidFileReadPathIfAlive): Skip kill
      call where unsupported, and report error on OOM.
      c811de8f
  12. 17 8月, 2011 2 次提交
  13. 16 8月, 2011 4 次提交
  14. 13 8月, 2011 5 次提交
    • E
      build: fix recent build failures · be427e8b
      Eric Blake 提交于
      With gcc 4.5.1:
      
      util/virpidfile.c: In function 'virPidFileAcquirePath':
      util/virpidfile.c:308:66: error: nested extern declaration of '_gl_verify_function2' [-Wnested-externs]
      
      Then in tests/commandtest.c, the new virPidFile APIs need to be used.
      
      * src/util/virpidfile.c (virPidFileAcquirePath): Move verify to
      top level.
      * tests/commandtest.c: Use new pid APIs.
      be427e8b
    • D
      Add some APIs which use locking for crashsafe pidfile handling · e1da464d
      Daniel P. Berrange 提交于
      In daemons using pidfiles to protect against concurrent
      execution there is a possibility that a crash may leave a stale
      pidfile on disk, which then prevents later restart of the daemon.
      
      To avoid this problem, introduce a pair of APIs which make
      use of virFileLock to ensure crash-safe & race condition-safe
      pidfile acquisition & releae
      
      * src/libvirt_private.syms, src/util/virpidfile.c,
        src/util/virpidfile.h: Add virPidFileAcquire and virPidFileRelease
      e1da464d
    • D
      Introduce functions for checking whether a pidfile is valid · b7e5ca48
      Daniel P. Berrange 提交于
      In some cases the caller of virPidFileRead might like extra checks
      to determine whether the pid just read is really the one they are
      expecting. This adds virPidFileReadIfAlive which will check whether
      the pid is still alive with kill(0, -1), and (on linux only) will
      look at /proc/$PID/path
      
      * libvirt_private.syms, util/virpidfile.c, util/virpidfile.h: Add
        virPidFileReadIfValid and virPidFileReadPathIfValid
      * network/bridge_driver.c: Use new APIs to check PID validity
      b7e5ca48
    • D
      Move pidfile functions into util/virpidfile.{c,h} · f80a4ed7
      Daniel P. Berrange 提交于
      The functions for manipulating pidfiles are in util/util.{c,h}.
      We will shortly be adding some further pidfile related functions.
      To avoid further growing util.c, this moves the pidfile related
      functions into a dedicated virpidfile.{c,h}. The functions are
      also all renamed to have 'virPidFile' as their name prefix
      
      * util/util.h, util/util.c: Remove all pidfile code
      * util/virpidfile.c, util/virpidfile.h: Add new APIs for pidfile
        handling.
      * lxc/lxc_controller.c, lxc/lxc_driver.c, network/bridge_driver.c,
        qemu/qemu_process.c: Add virpidfile.h include and adapt for API
        renames
      f80a4ed7
    • D
      Add virFileLock and virFileUnlock APIs · e4842705
      Daniel P. Berrange 提交于
      Add some simple wrappers around the fcntl() discretionary file
      locking capability.
      
      * src/util/util.c, src/util/util.h, src/libvirt_private.syms: Add
        virFileLock and virFileUnlock APIs
      e4842705
  15. 03 8月, 2011 3 次提交
    • E
      util: plug memory leak · c86827a2
      Eric Blake 提交于
      Leak detected by Coverity; only possible on unlikely ptsname_r
      failure.  Additionally, the man page for ptsname_r states that
      failure is merely non-zero, not necessarily -1.
      
      * src/util/util.c (virFileOpenTtyAt): Avoid leak on ptsname_r
      failure.
      c86827a2
    • E
      interface: drop dead code · d69b79ab
      Eric Blake 提交于
      Coverity detected that ifaceGetNthParent had already dereferenced
      'nth' prior to the conditional; all callers already complied with
      passing a non-NULL pointer so make this part of the contract.
      
      * src/util/interface.h (ifaceGetNthParent): Add annotations.
      * src/util/interface.c (ifaceGetNthParent): Drop useless null check.
      d69b79ab
    • E
      build: silence coverity false positives · 44ebb18e
      Eric Blake 提交于
      Coverity complained that 395 out of 409 virAsprintf calls are
      checked, and therefore assumed that the remaining cases are bugs
      waiting to happen.  But in each of these cases, a failed virAsprintf
      will properly set the target string to NULL, and pass on that
      failure to the caller, without wasting efforts to check the call.
      Adding the ignore_value silences Coverity.
      
      * src/conf/domain_audit.c (virDomainAuditGetRdev): Ignore
      virAsprintf return value, when it behaves like we need.
      * src/network/bridge_driver.c (networkDnsmasqLeaseFileNameDefault)
      (networkRadvdConfigFileName, networkBridgeDummyNicName)
      (networkRadvdPidfileBasename): Likewise.
      * src/util/storage_file.c (absolutePathFromBaseFile): Likewise.
      * src/openvz/openvz_driver.c (openvzGenerateContainerVethName):
      Likewise.
      * src/util/command.c (virCommandTranslateStatus): Likewise.
      44ebb18e
  16. 29 7月, 2011 1 次提交
  17. 27 7月, 2011 1 次提交
    • M
      bandwidth: Integrate bandwidth into portgroups · fe957f0a
      Michal Privoznik 提交于
      Every DomainNetDef has a bandwidth, as does every portgroup.
      Whenever a DomainNetDef of type NETWORK is about to be used, a call is
      made to networkAllocateActualDevice(). This function chooses the "best"
      bandwidth object and places it in the DomainActualNetDef.
      From that point on, whenever some code needs to use the bandwidth data
      for the interface, it's retrieved with virDomainNetGetActualBandwidth(),
      which will always return the "best" info as determined in the
      previous step.
      fe957f0a
  18. 26 7月, 2011 1 次提交
    • L
      util: change virFile*Pid functions to return < 0 on failure · d6354c16
      Laine Stump 提交于
      Although most functions in libvirt return 0 on success and < 0 on
      failure, there are a few functions lingering around that return errno
      (a positive value) on failure, and sometimes code calling those
      functions incorrectly assumes the <0 standard. I noticed one of these
      the other day when auditing networkStartDhcpDaemon after Guido Gunther
      found a place where success was improperly returned on failure (that
      patch has been acked and is pending a push). The problem was that it
      expected the return value from virFileReadPid to be < 0 on failure,
      but it was actually positive (it was also neglected to set the return
      code in this case, similar to the bug found by Guido).
      
      This all led to the fact that *all* of the virFile*Pid functions in
      util.c are returning errno on failure. This patch remedies that
      problem by changing them all to return -errno on failure, and makes
      any necessary changes to callers of the functions. (In the meantime, I
      also properly set the return code on failure of virFileReadPid in
      networkStartDhcpDaemon).
      d6354c16
  19. 25 7月, 2011 5 次提交
  20. 22 7月, 2011 3 次提交
    • M
      build: Use $(PYTHON) instead of python for the keycode map generator · 1a80a4e0
      Matthias Bolte 提交于
      Also prepend $(AM_V_GEN) to the command line, mark virkeycode-mapgen.py
      as executable and switch the shebang line from /bin/python to the
      commonly use /usr/bin/python.
      1a80a4e0
    • L
      util: make interface.c functions consistently return < 0 on error · f7e18208
      Laine Stump 提交于
      All of the functions in util/interface.c were returning 0 on success,
      but some returned -1 on error, and some returned a positive value
      (usually the value of errno, but sometimes just 1). Libvirt's standard
      is to return < 0 on error (in the case of functions that need to
      return errno, -errno is returned.
      
      This patch modifies all functions in interface.c to consistently
      return < 0 on error, and makes changes to callers of those functions
      where necessary.
      f7e18208
    • E
      save: add virFileDirectFd wrapper type · 519a1c43
      Eric Blake 提交于
      O_DIRECT has stringent requirements.  Rather than make lots of changes
      at each site that wants to use O_DIRECT, it is easier to offload
      the work through a helper process that mirrors the I/O between a
      pipe and the actual direct fd, so that the other end of the pipe
      no longer has to worry about constraints.
      
      Plus, if the kernel ever gains better posix_fadvise support, then we
      only have to touch a single file to let all callers benefit from a
      more efficient way to avoid file system caching.
      
      * src/util/virfile.h (virFileDirectFdFlag, virFileDirectFdNew)
      (virFileDirectFdClose, virFileDirectFdFree): New prototypes.
      * src/util/virdirect.c: Implement new wrapper object.
      * src/libvirt_private.syms (virfile.h): Export new symbols.
      * cfg.mk (useless_free_options): Add to list.
      * po/POTFILES.in: Add new translations.
      519a1c43