1. 27 3月, 2012 1 次提交
    • S
      Change the default of mdns_adv to false · 53e1d56d
      Stef Walter 提交于
       * Don't advertise information on the network without consent of
         the user, either through manual configuration, or a user
         interface that drives this option.
       * Since libvirtd must be configured for network access anyway
         (for all but ssh), this setting was not useful "out of the box",
         so changing this default setting does not remove "out of the box"
         functionality.
      53e1d56d
  2. 02 3月, 2012 1 次提交
    • E
      build: use correct type for pid and similar types · 3e2c3d8f
      Eric Blake 提交于
      No thanks to 64-bit windows, with 64-bit pid_t, we have to avoid
      constructs like 'int pid'.  Our API in libvirt-qemu cannot be
      changed without breaking ABI; but then again, libvirt-qemu can
      only be used on systems that support UNIX sockets, which rules
      out Windows (even if qemu could be compiled there) - so for all
      points on the call chain that interact with this API decision,
      we require a different variable name to make it clear that we
      audited the use for safety.
      
      Adding a syntax-check rule only solves half the battle; anywhere
      that uses printf on a pid_t still needs to be converted, but that
      will be a separate patch.
      
      * cfg.mk (sc_correct_id_types): New syntax check.
      * src/libvirt-qemu.c (virDomainQemuAttach): Document why we didn't
      use pid_t for pid, and validate for overflow.
      * include/libvirt/libvirt-qemu.h (virDomainQemuAttach): Tweak name
      for syntax check.
      * src/vmware/vmware_conf.c (vmwareExtractPid): Likewise.
      * src/driver.h (virDrvDomainQemuAttach): Likewise.
      * tools/virsh.c (cmdQemuAttach): Likewise.
      * src/remote/qemu_protocol.x (qemu_domain_attach_args): Likewise.
      * src/qemu_protocol-structs (qemu_domain_attach_args): Likewise.
      * src/util/cgroup.c (virCgroupPidCode, virCgroupKillInternal):
      Likewise.
      * src/qemu/qemu_command.c(qemuParseProcFileStrings): Likewise.
      (qemuParseCommandLinePid): Use pid_t for pid.
      * daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
      * src/conf/domain_conf.h (_virDomainObj): Likewise.
      * src/probes.d (rpc_socket_new): Likewise.
      * src/qemu/qemu_command.h (qemuParseCommandLinePid): Likewise.
      * src/qemu/qemu_driver.c (qemudGetProcessInfo, qemuDomainAttach):
      Likewise.
      * src/qemu/qemu_process.c (qemuProcessAttach): Likewise.
      * src/qemu/qemu_process.h (qemuProcessAttach): Likewise.
      * src/uml/uml_driver.c (umlGetProcessInfo): Likewise.
      * src/util/virnetdev.h (virNetDevSetNamespace): Likewise.
      * src/util/virnetdev.c (virNetDevSetNamespace): Likewise.
      * tests/testutils.c (virtTestCaptureProgramOutput): Likewise.
      * src/conf/storage_conf.h (_virStoragePerms): Use mode_t, uid_t,
      and gid_t rather than int.
      * src/security/security_dac.c (virSecurityDACSetOwnership): Likewise.
      * src/conf/storage_conf.c (virStorageDefParsePerms): Avoid
      compiler warning.
      3e2c3d8f
  3. 29 2月, 2012 2 次提交
  4. 28 12月, 2011 1 次提交
    • E
      daemon: clean up daemonization · e957b670
      Eric Blake 提交于
      Valgrind detected a pipe fd leak before the parent exits on success,
      introduced in commit 4296cea2; by itself, the leak is not bad, since
      we immediately called _exit(), but we might as well be clean to make
      valgrind analysis easier.  Meanwhile, if the daemon grandchild detects
      an error, the parent failed to flush the error message before exiting.
      Also, we had the possibility of both parent and child returning to the
      caller, such that the user could see duplicated reports of failure
      from the two return paths.  And we might as well be robust to the
      (unlikely) situation of being started with stdin closed.
      
      * daemon/libvirtd.c (daemonForkIntoBackground): Use exit if an
      error message was generated, avoid fd leaks for valgrind's sake,
      avoid returning to caller in both parent and child, and don't
      close a just-dup'd stdin.
      Based on a report by Alex Jia.
      
      * How to reproduce?
        % service libvirtd stop
        % valgrind -v --track-fds=yes /usr/sbin/libvirtd --daemon
      
      * Actual valgrind result:
      
      ==16804== FILE DESCRIPTORS: 7 open at exit.
      ==16804== Open file descriptor 7:
      ==16804==    at 0x321FAD8B87: pipe (in /lib64/libc-2.12.so)
      ==16804==    by 0x41F34D: daemonForkIntoBackground (libvirtd.c:186)
      ==16804==    by 0x4207A0: main (libvirtd.c:1420)
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e957b670
  5. 24 11月, 2011 1 次提交
  6. 25 10月, 2011 1 次提交
    • E
      waitpid: improve safety · 69d044c0
      Eric Blake 提交于
      Based on a report by Coverity.  waitpid() can leak resources if it
      fails with EINTR, so it should never be used without checking return
      status.  But we already have a helper function that does that, so
      use it in more places.
      
      * src/lxc/lxc_container.c (lxcContainerAvailable): Use safer
      virWaitPid.
      * daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
      * tests/testutils.c (virtTestCaptureProgramOutput, virtTestMain):
      Likewise.
      * src/libvirt.c (virConnectAuthGainPolkit): Simplify with virCommand.
      69d044c0
  7. 12 10月, 2011 1 次提交
    • O
      daemon: Always advertise libvirtd service · 33b55fd8
      Osier Yang 提交于
      This is a regression introduced by new RPC codes, previously
      we advertise the service via ssh even if the daemon doesn't
      listen on TLS port (TCP is not choosed). Now the service is
      only advertised when it listens on TLS or TCP port. This breaks
      upper layer apps which intends to discover the service, such
      as virt-manager.
      33b55fd8
  8. 20 9月, 2011 1 次提交
  9. 13 9月, 2011 1 次提交
    • D
      Do not log invalid operations in libvirtd logs · 7f2498ef
      Daniel Veillard 提交于
        This is a bit painful for example when starting virt-manager
      it tends to clutter libvirtd.log with invalid operation on cpu pinning
      for defined but not running domains. A priori those kind of errors
      don't indicate an error when executing the command but on a precondition
      for running the API, and honnestly while the application should report
      it, logging it as an error in libvirtd.log is not really useful,
      
         Related bug: https://bugzilla.redhat.com/show_bug.cgi?id=590807
      
      * daemon/libvirtd.c: extend daemonErrorLogFilter() to filter out
         errors of type VIR_ERR_OPERATION_INVALID
      7f2498ef
  10. 06 9月, 2011 1 次提交
    • 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
  11. 02 9月, 2011 1 次提交
  12. 25 8月, 2011 1 次提交
  13. 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
  14. 19 8月, 2011 1 次提交
    • M
      daemon: initialize GnuTLS · 74c75671
      Michal Privoznik 提交于
      When spice_tls is set but listen_tls is not, we don't initialize
      GnuTLS library. So any later gnutls call (e.g. during migration,
      where we initialize a certificate) will access uninitialized GnuTLS
      internal structs and throws an error.
      
      Although, we might now initialize GnuTLS twice, it is safe according
      to the documentation:
      
          This function can be called many times,
          but will only do something the first time.
      
      This patch creates 2 functions: virNetTLSInit and virNetTLSDeinit
      with respect to written above.
      74c75671
  15. 17 8月, 2011 1 次提交
    • P
      daemon: Add early libvirtd start verbose errors. · 6452b1eb
      Peter Krempa 提交于
      Early errors during start of libvirtd didn't have
      an error reporting mechanism and caused libvirtd
      to exit silently (only the return value indicated
      an error).
      
      Libvirt logging is initialized very early using
      enviroment variables and the internal error reporting
      API is used to report early errors.
      
       v2 changes:
       - print errors unconditionaly before logging starts
       - fix message to US spelling
       v2.5 changes:
       - initialize logging from enviroment
       - log all early errors using VIR_ERROR
       v3 changes:
       - move virSetLogFromEnv() after virInitialize()
      
      fixes: https://bugzilla.redhat.com/show_bug.cgi?id=728654
      6452b1eb
  16. 15 8月, 2011 1 次提交
    • O
      daemon: Fix regression of libvirtd reloading support · 9e093f0b
      Osier Yang 提交于
      This is introduced by commit df0b57a9, which forgot to
      add signal handler for SIGHUP.
      
      A simple reproduce method:
      
      1) Create a domain XML under /etc/libvirt/qemu
      2) % kill -SIGHUP $(pidof libvirtd)
      3) % virsh list --all (the new created domain XML is not listed)
      9e093f0b
  17. 13 8月, 2011 1 次提交
    • D
      Convert libvirtd to use crash-safe pidfile APIs · c8a3a265
      Daniel P. Berrange 提交于
      Remove the current libvirtd pidfile handling code, in favour of
      calling out to the new APIs. This ensures libvirtd's pidfile
      handling is crashsafe
      
      This also means that the non-root libvirtd instances (for handling
      qemu:///session URIs) can now safely use pidfiles without racing
      
      * daemon/libvirtd.c: Switch to use virPidFileAcquire and
        virPidFileRelease
      c8a3a265
  18. 04 8月, 2011 1 次提交
  19. 22 7月, 2011 3 次提交
    • D
      Allow certificate sanity checking to be disabled · 07f9b6f0
      Daniel P. Berrange 提交于
      When libvirtd starts it it will sanity check its own certs,
      and before libvirt clients connect to a remote server they
      will sanity check their own certs. This patch allows such
      sanity checking to be skipped. There is no strong reason to
      need to do this, other than to bypass possible libvirt bugs
      in sanity checking, or for testing purposes.
      
      libvirt.conf gains tls_no_sanity_certificate parameter to
      go along with tls_no_verify_certificate. The remote driver
      client URIs gain a no_sanity URI parameter
      
      * daemon/test_libvirtd.aug, daemon/libvirtd.conf,
        daemon/libvirtd.c, daemon/libvirtd.aug: Add parameter to
        allow cert sanity checks to be skipped
      * src/remote/remote_driver.c: Add no_sanity parameter to
        skip cert checks
      * src/rpc/virnettlscontext.c, src/rpc/virnettlscontext.h:
        Add new parameter for skipping sanity checks independantly
        of skipping session cert validation checks
      07f9b6f0
    • D
      Ensure that libvirtd shuts down if initialization fails · 92509413
      Daniel P. Berrange 提交于
      If the virStateInitialize call fails we must shutdown libvirtd
      since drivers will not be available. Just free'ing the virNetServer
      is not sufficient, we must send a SIGTERM to ourselves so that
      we interrupt the event loop and trigger a orderly shutdown
      
      * daemon/libvirtd.c: Kill ourselves if state init fails
      * src/rpc/virnetserver.c: Add some debugging to event loop
      92509413
    • E
      build: rename files.h to virfile.h · 8e22e089
      Eric Blake 提交于
      In preparation for a future patch adding new virFile APIs.
      
      * src/util/files.h, src/util/files.c: Move...
      * src/util/virfile.h, src/util/virfile.c: ...here, and rename
      functions to virFile prefix.  Macro names are intentionally
      left alone.
      * *.c: All '#include "files.h"' uses changed.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
      * src/libvirt_private.syms: Likewise.
      * docs/hacking.html.in: Likewise.
      * HACKING: Regenerate.
      8e22e089
  20. 12 7月, 2011 2 次提交
    • J
      Fix build when using polkit0 · b8adfcc6
      Jim Fehlig 提交于
      V2: Remove policy kit references from virNetServer and use DBus APIs
          directly, if available.
      b8adfcc6
    • E
      maint: rename virtaudit to match file contents · 2ceb35e1
      Eric Blake 提交于
      * src/util/virtaudit.[ch]: Rename...
      * src/util/viraudit.[ch]: ...to match virAudit* API.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * daemon/libvirtd.c: Likewise.
      * po/POTFILES.in: Likewise.
      * src/libvirt_private.syms: Likewise.
      * src/qemu/qemu_audit.c: Likewise.
      2ceb35e1
  21. 09 7月, 2011 1 次提交
  22. 08 7月, 2011 1 次提交
    • D
      Don't exit if the libvirtd config does not exist · 8e2e4780
      Daniel P. Berrange 提交于
      It is common for the $HOME/.libvirt/libvirtd.conf file to not
      exist. Treat this situation as non-fatal since we can carry
      on with our default settings just fine.
      
      * daemon/libvirtd.c: Treat ENOENT as non-fatal when loading
        config
      8e2e4780
  23. 02 7月, 2011 1 次提交
  24. 01 7月, 2011 2 次提交
    • D
      Add conditionals to allow build without SASL · 0e4b921a
      Daniel P. Berrange 提交于
      * daemon/libvirtd.c, daemon/remote.c: Add #if HAVE_SASL and
        suitable function stubs to allow build without SASL
      0e4b921a
    • D
      Fix hardcoded limit on client requests in RPC code · 27111b35
      Daniel P. Berrange 提交于
      The virNetServerClient object had a hardcoded limit of 10 requests
      per client. Extend constructor to allow it to be passed in as a
      configurable variable. Wire this up to the 'max_client_requests'
      config parameter in libvirtd
      
      * daemon/libvirtd.c: Pass max_client_requests into services
      * src/rpc/virnetserverservice.c, src/rpc/virnetserverservice.h: Pass
        nrequests_client_max to clients
      * src/rpc/virnetserverclient.c, src/rpc/virnetserverclient.h: Allow
        configurable request limit
      27111b35
  25. 29 6月, 2011 2 次提交
    • J
      daemon: Fix build without polkit · 26dbed15
      Jiri Denemark 提交于
      26dbed15
    • D
      Convert libvirtd over to the new RPC handling APIs · df0b57a9
      Daniel P. Berrange 提交于
      This guts the libvirtd daemon, removing all its networking and
      RPC handling code. Instead it calls out to the new virServerPtr
      APIs for all its RPC & networking work
      
      As a fallout all libvirtd daemon error reporting now takes place
      via the normal internal error reporting APIs. There is no need
      to call separate error reporting APIs in RPC code, nor should
      code use VIR_WARN/VIR_ERROR for reporting fatal problems anymore.
      
      * daemon/qemu_dispatch_*.h, daemon/remote_dispatch_*.h: Remove
        old generated dispatcher code
      * daemon/qemu_dispatch.h, daemon/remote_dispatch.h: New dispatch
        code
      * daemon/dispatch.c, daemon/dispatch.h: Remove obsoleted code
      * daemon/remote.c, daemon/remote.h: Rewrite for new dispatch
        APIs
      * daemon/libvirtd.c, daemon/libvirtd.h: Remove all networking
        code
      * daemon/stream.c, daemon/stream.h: Update for new APIs
      * daemon/Makefile.am: Link to libvirt-net-rpc-server.la
      df0b57a9
  26. 21 6月, 2011 1 次提交
    • C
      Promote virEvent*Handle/Timeout to public API · 6094ad7b
      Cole Robinson 提交于
      Since we virEventRegisterDefaultImpl is now a public API, callers need
      a way to invoke the default registered Handle and Timeout functions. We
      already have general functions for these internally, so promote
      them to the public API.
      
      v2:
          Actually add APIs to libvirt.h
      6094ad7b
  27. 08 6月, 2011 1 次提交
    • E
      daemon: plug memory leak · f17eeede
      Eric Blake 提交于
      Detected by Coverity.  Commit ef21beda was incomplete; it solved
      a leak one one path, but not on the other.
      
      * daemon/libvirtd.c (qemudSetLogging): Avoid leak on success.
      f17eeede
  28. 03 6月, 2011 1 次提交
    • E
      libvirtd: avoid leak on failure · ef21beda
      Eric Blake 提交于
      Spotted by Coverity.  Only possible on an OOM condition, so
      unlikely to bite in the wild.
      
      * daemon/libvirtd.c (qemudSetLogging): Don't leak memory.
      ef21beda
  29. 16 5月, 2011 1 次提交
    • D
      Pass graphics setup from dst back to src via migration cookies · 72de0d28
      Daniel P. Berrange 提交于
      Extend the QEMU migration cookie structure to allow information
      about the destination host graphics setup to be passed by to
      the source host. This will enable seamless migration of any
      connected graphics clients
      
      * src/qemu/qemu_migration.c: Add graphics info to migration
        cookies
      * daemon/libvirtd.c: Always initialize gnutls to enable
        x509 cert parsing in QEMU
      72de0d28
  30. 12 5月, 2011 2 次提交
    • E
      maint: omit translation for all VIR_INFO · cb84580a
      Eric Blake 提交于
      We were 31/73 on whether to translate; since less than 50% translated
      and since VIR_INFO is less than VIR_WARN which also doesn't translate,
      this makes sense.
      
      * cfg.mk (sc_prohibit_gettext_markup): Add VIR_INFO, since it
      falls between WARN and DEBUG.
      * daemon/libvirtd.c (qemudDispatchSignalEvent, remoteCheckAccess)
      (qemudDispatchServer): Adjust offenders.
      * daemon/remote.c (remoteDispatchAuthPolkit): Likewise.
      * src/network/bridge_driver.c (networkReloadIptablesRules)
      (networkStartNetworkDaemon, networkShutdownNetworkDaemon)
      (networkCreate, networkDefine, networkUndefine): Likewise.
      * src/qemu/qemu_driver.c (qemudDomainDefine)
      (qemudDomainUndefine): Likewise.
      * src/storage/storage_driver.c (storagePoolCreate)
      (storagePoolDefine, storagePoolUndefine, storagePoolStart)
      (storagePoolDestroy, storagePoolDelete, storageVolumeCreateXML)
      (storageVolumeCreateXMLFrom, storageVolumeDelete): Likewise.
      * src/util/bridge.c (brProbeVnetHdr): Likewise.
      * po/POTFILES.in: Drop src/util/bridge.c.
      cb84580a
    • L
      libvirt,logging: cleanup VIR_XXX0() · b65f37a4
      Lai Jiangshan 提交于
      These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
      
      How do these coversions works? The magic is using the gcc extension of ##.
      When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to
      avoid compile error.
      
      example: origin				after CPP
      	high_level_api("%d", a_int)	low_level_api("%d", a_int)
      	high_level_api("a  string")	low_level_api("a  string")
      
      About 400 conversions.
      
      8 special conversions:
      VIR_XXXX0("") -> VIR_XXXX("msg") (avoid empty format) 2 conversions
      VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions
      VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal)
        (for security) 6 conversions
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      b65f37a4
  31. 05 4月, 2011 1 次提交
  32. 28 3月, 2011 1 次提交
    • D
      Remove the Open Nebula driver · 4591df76
      Daniel P. Berrange 提交于
      The Open Nebula driver has been unmaintained since it was first
      introduced. The only commits have been for tree-wide cleanups.
      It also has a major design flaw, in that it only knows about guests
      that it has created itself, which makes it of very limited use.
      
      Discussions wrt evolution of the VMWare ESX driver, concluded that
      it should limit itself to single-node ESX operation and not try to
      manage the multi-node architecture of VirtualCenter. Open Nebula
      is a cluster like Virtual Center, not a single node system, so
      the same reasoning applies.
      
      The DeltaCloud project includes an Open Nebula driver and is a much
      better fit architecturally, since it is explicitly targetting the
      distributed multihost cluster scenario.
      
      Thus this patch deletes the libvirt Open Nebula driver with the
      recommendation that people use DeltaCloud for managing it instead.
      
      * configure.ac: Remove probe for xmlrpc & --with-one arg
      * daemon/Makefile.am, daemon/libvirtd.c, src/Makefile.am: Remove
        ONE driver build
      * src/opennebula/one_client.c, src/opennebula/one_client.h,
        src/opennebula/one_conf.c, src/opennebula/one_conf.h,
        src/opennebula/one_driver.c, src/opennebula/one_driver.c: Delete
        files
      * autobuild.sh, libvirt.spec.in, mingw32-libvirt.spec.in: Remove
        build rules for Open Nebula
      * docs/drivers.html.in, docs/sitemap.html.in: Remove reference
        to OpenNebula
      * docs/drvone.html.in: Delete file
      4591df76
  33. 18 3月, 2011 1 次提交
    • J
      Add libxenlight driver · 2b84e445
      Jim Fehlig 提交于
      Add a new xen driver based on libxenlight [1], which is the primary
      toolstack starting with Xen 4.1.0.  The driver is stateful and runs
      privileged only.
      
      Like the existing xen-unified driver, the libxenlight driver is
      accessed with xen:// URI.  Driver selection is based on the status
      of xend.  If xend is running, the libxenlight driver will not load
      and xen:// connections are handled by xen-unified.  If xend is not
      running *and* the libxenlight driver is available, xen://
      connections are deferred to the libxenlight driver.
      
      V6:
       - Address several code style issues noted by Daniel Veillard
       - Make drive work with xen:/// URI
       - Hold domain object reference while domain is injected in
         libvirt event loop.  Race found and fixed by Markus Groß.
      
      V5:
       - Ensure events are unregistered when domain private data
         is destroyed.  Discovered and fixed by Markus Groß.
      
      V4:
       - Handle restart of libvirtd, reconnecting to previously
         started domains
       - Rebased to current master
       - Tested against Xen 4.1 RC7-pre (c/s 22961:c5d121fd35c0)
      
      V3:
        - Reserve vnc port within driver when autoport=yes
      
      V2:
        - Update to Xen 4.1 RC6-pre (c/s 22940:5a4710640f81)
        - Rebased to current master
        - Plug memory leaks found by Stefano Stabellini and valgrind
        - Handle SHUTDOWN_crash domain death event
      
      [1] http://lists.xensource.com/archives/html/xen-devel/2009-11/msg00436.html
      2b84e445