1. 16 11月, 2011 1 次提交
  2. 07 11月, 2011 1 次提交
    • D
      Fix sending/receiving of FDs when stream returns EAGAIN · b2c62316
      Daniel P. Berrange 提交于
      The code calling sendfd/recvfd was mistakenly assuming those
      calls would never block. They can in fact return EAGAIN and
      this is causing us to drop the client connection when blocking
      ocurrs while sending/receiving FDs.
      
      Fixing this is a little hairy on the incoming side, since at
      the point where we see the EAGAIN, we already thought we had
      finished receiving all data for the packet. So we play a little
      trick to reset bufferOffset again and go back into polling for
      more data.
      
      * src/rpc/virnetsocket.c, src/rpc/virnetsocket.h: Update
        virNetSocketSendFD/RecvFD to return 0 on EAGAIN, or 1
        on success
      * src/rpc/virnetclient.c: Move decoding of header & fds
        out of virNetClientCallDispatch and into virNetClientIOHandleInput.
        Handling blocking when sending/receiving FDs
      * src/rpc/virnetmessage.h: Add a 'donefds' field to track
        how many FDs we've sent / received
      * src/rpc/virnetserverclient.c: Handling blocking when
        sending/receiving FDs
      b2c62316
  3. 28 10月, 2011 1 次提交
    • D
      Add client side support for FD passing · 36a9c83d
      Daniel P. Berrange 提交于
      Extend the RPC client code to allow file descriptors to be sent
      to the server with calls, and received back with replies.
      
      * src/remote/remote_driver.c: Stub extra args
      * src/libvirt_private.syms, src/rpc/virnetclient.c,
        src/rpc/virnetclient.h, src/rpc/virnetclientprogram.c,
        src/rpc/virnetclientprogram.h: Extend APIs to allow
        FD passing
      36a9c83d
  4. 11 10月, 2011 1 次提交
    • D
      Rewrite all the DTrace/SystemTAP probing · ddf3bd32
      Daniel P. Berrange 提交于
      The libvirtd daemon had a few crude system tap probes. Some of
      these were broken during the RPC rewrite. The new modular RPC
      code is structured in a way that allows much more effective
      tracing. Instead of trying to hook up the original probes,
      define a new set of probes for the RPC and event code.
      
      The master probes file is now src/probes.d.  This contains
      probes for virNetServerClientPtr, virNetClientPtr, virSocketPtr
      virNetTLSContextPtr and virNetTLSSessionPtr modules. Also add
      probes for the poll event loop.
      
      The src/dtrace2systemtap.pl script can convert the probes.d
      file into a libvirt_probes.stp file to make use from systemtap
      much simpler.
      
      The src/rpc/gensystemtap.pl script can generate a set of
      systemtap functions for translating RPC enum values into
      printable strings. This works for all RPC header enums (program,
      type, status, procedure) and also the authentication enum
      
      The PROBE macro will automatically generate a VIR_DEBUG
      statement, so any place with a PROBE can remove any existing
      manual DEBUG statements.
      
      * daemon/libvirtd.stp, daemon/probes.d: Remove obsolete probing
      * daemon/libvirtd.h: Remove probe macros
      * daemon/Makefile.am: Remove all probe buildings/install
      * daemon/remote.c: Update authentication probes
      * src/dtrace2systemtap.pl, src/rpc/gensystemtap.pl: Scripts
        to generate STP files
      * src/internal.h: Add probe macros
      * src/probes.d: Master list of probes
      * src/rpc/virnetclient.c, src/rpc/virnetserverclient.c,
        src/rpc/virnetsocket.c, src/rpc/virnettlscontext.c,
        src/util/event_poll.c: Insert probe points, removing any
        DEBUG statements that duplicate the info
      ddf3bd32
  5. 23 9月, 2011 1 次提交
    • D
      Fix synchronous reading of stream data · cb610092
      Daniel P. Berrange 提交于
      commit 984840a2 removed the
      notification of waiting calls when VIR_NET_CONTINUE messages
      arrive. This was to fix the case of a virStreamAbort() call
      being prematurely notified of completion.
      
      The problem is that sometimes there are dummy calls from a
      virStreamRecv() call waiting that *do* need to be notified.
      
      These dummy calls should have a status VIR_NET_CONTINUE. So
      re-add the notification upon VIR_NET_CONTINUE, but only if
      the waiter also has a status of VIR_NET_CONTINUE.
      
      * src/rpc/virnetclient.c: Notify waiting call if stream data
        arrives
      * src/rpc/virnetclientstream.c:  Mark dummy stream read packet
        with status VIR_NET_CONTINUE
      cb610092
  6. 18 8月, 2011 1 次提交
    • D
      Ensure async packets never get marked for sync replies · 984840a2
      Daniel P. Berrange 提交于
      If a client had initiated a stream abort, it will have a call
      waiting for a reply in the queue. If more data continues to
      arrive on the stream, the abort command could mistakenly get
      signalled as complete. Remove the code from async data processing
      that looked for waiting calls. Add a sanity check to ensure no
      async call can ever be marked as needing a reply
      
      * src/rpc/virnetclient.c: Ensure async data packets can't
        trigger a reply
      984840a2
  7. 17 8月, 2011 1 次提交
  8. 15 8月, 2011 1 次提交
  9. 22 7月, 2011 2 次提交
    • O
      remote/ssh: optional "keyfile" parameter. · 6b01c83a
      Oskari Saarenmaa 提交于
      New optional parameter "keyfile" for ssh transport allows the user to select
      the private key to be used to authenticate to the remote host.
      6b01c83a
    • 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
  10. 20 7月, 2011 1 次提交
  11. 19 7月, 2011 4 次提交
    • D
      Add an explicit virNetClientClose method · e06c8ede
      Daniel P. Berrange 提交于
      Since the I/O callback registered against virNetSocket will
      hold a reference on the virNetClient, we can't rely on the
      virNetClientFree to be able to close the network connection.
      The last reference will only go away when the event callback
      fires (likely due to EOF from the server).
      
      This is sub-optimal and can potentially cause a leak of the
      virNetClient object if the server were to not explicitly
      close the socket itself
      
      * src/remote/remote_driver.c: Explicitly close the client
        object when disconnecting
      * src/rpc/virnetclient.c, src/rpc/virnetclient.h: Add a
        virNetClientClose method
      e06c8ede
    • D
      Use a virFreeCallback on virNetSocket to ensure safe release · 7ea2ef4c
      Daniel P. Berrange 提交于
      When unregistering an I/O callback from a virNetSocket object,
      there is still a chance that an event may come in on the callback.
      In this case it is possible that the virNetSocket might have been
      freed already. Make use of a virFreeCallback when registering
      the I/O callbacks and hold a reference for the entire time the
      callback is set.
      
      * src/rpc/virnetsocket.c: Register a free function for the
        file handle watch
      * src/rpc/virnetsocket.h, src/rpc/virnetserverservice.c,
        src/rpc/virnetserverclient.c, src/rpc/virnetclient.c: Add
        a free function for the socket I/O watches
      7ea2ef4c
    • D
      Add some debugging for virNetClient reference counting · 06c0d184
      Daniel P. Berrange 提交于
      * src/rpc/virnetclient.c: Add debugging of ref counts
      06c0d184
    • D
      Unregister event callback if a fatal error occurs during dispatch · 07b39a94
      Daniel P. Berrange 提交于
      If we get an I/O error in the async event callback for an RPC
      client, we might not have consumed all pending data off the
      wire. This could result in the callback being immediately
      invoked again. At which point the same I/O might occur. And
      we're invoked again. And again...And again...
      
      Unregistering the async event callback if an error occurs is
      a good safety net. The real error will be seen when the next
      RPC method is invoked
      
      * src/rpc/virnetclient.c: Unregister event callback on error
      07b39a94
  12. 15 7月, 2011 1 次提交
    • D
      Fix reporting of cert validation failures · f2845177
      Daniel P. Berrange 提交于
      If the server succesfully validates the client cert, it will send
      back a single byte, under TLS. If it fails, it will close the
      connection. In this case, we were just reporting the standard
      I/O error. The original RPC code had a special case hack for the
      GNUTLS_E_UNEXPECTED_PACKET_LENGTH error code to make us report
      a more useful error message
      
      * src/rpc/virnetclient.c: Return ENOMSG if we get
        GNUTLS_E_UNEXPECTED_PACKET_LENGTH
      * src/rpc/virnettlscontext.c: Report cert failure if we
        see ENOMSG
      f2845177
  13. 12 7月, 2011 1 次提交
    • O
      remote/ssh: support for no_verify. · 9a0e6a8f
      Oskari Saarenmaa 提交于
      Set StrictHostKeyChecking=no to auto-accept new ssh host keys if the
      no_verify extra parameter was specified.  This won't disable host key
      checking for already known hosts.  Includes a test and documentation.
      9a0e6a8f
  14. 08 7月, 2011 1 次提交
    • E
      build: use gnulib pthread_sigmask · 8437e738
      Eric Blake 提交于
      Gnulib finally learned how to do pthread_sigmask on mingw.
      
      * .gnulib: Update to latest, for pthread_sigmask.
      * bootstrap.conf (gnulib_modules): Add pthread_sigmask.
      * configure.ac (AC_CHECK_FUNCS): Drop redundant check.
      * src/rpc/virnetclient.c (virNetClientSetTLSSession)
      (virNetClientIOEventLoop): Make code unconditional.
      * src/util/command.c (virFork): Likewise.
      * tools/virsh.c (doMigrate, cmdMigrate): Likewise.
      8437e738
  15. 04 7月, 2011 1 次提交
    • E
      rpc: silence coverity warning · dd0c42ab
      Eric Blake 提交于
      Coverity noted that 4 out of 5 calls to virNetClientStreamRaiseError
      checked the return value.  This case expects a particular value, so
      warn if our expectations went wrong due to some bug elsewhere.
      
      * src/rpc/virnetclient.c (virNetClientCallDispatchStream): Warn on
        unexpected scenario.
      dd0c42ab
  16. 01 7月, 2011 1 次提交
    • E
      rpc: avoid freeing uninitialized variable · 0a8a79af
      Eric Blake 提交于
      Detected by Coverity.  Both are instances of bad things happening
      if pipe2 fails; the virNetClientNew failure could free garbage,
      and virNetSocketNewConnectCommand could close random fds.
      
      Note: POSIX doesn't guarantee the contents of fd[0] and fd[1]
      after pipe failure: http://austingroupbugs.net/view.php?id=467
      We may need to introduce a virPipe2 wrapper that guarantees
      that on pipe failure, the fds are explicitly set to -1, rather
      than our current state of assuming the fds are unchanged from
      their value prior to the failed pipe call.
      
      * src/rpc/virnetclient.c (virNetClientNew): Initialize variable.
      * src/rpc/virnetsocket.c (virNetSocketNewConnectCommand):
      Likewise.
      0a8a79af
  17. 29 6月, 2011 2 次提交
    • D
      Ensure that EOF is dispatched to the stream callback · 516235c0
      Daniel P. Berrange 提交于
      When the remote client receives end of file on the stream
      it never invokes the stream callback. Applications relying
      on async event driven I/O will thus never see the EOF
      condition on the stream
      
      * src/rpc/virnetclient.c, src/rpc/virnetclientstream.c:
        Ensure EOF is dispatched
      516235c0
    • D
      Fix propagation of RPC errors from streams · 16c6e2b4
      Daniel P. Berrange 提交于
      If a streams error is raised, virNetClientIOEventLoop
      returns 0, but an error is set. Check for this and
      propagate it if present
      
      * src/rpc/virnetclient.c: Propagate streams error
      16c6e2b4
  18. 24 6月, 2011 1 次提交
    • D
      Introduce generic RPC client objects · 434de30d
      Daniel P. Berrange 提交于
      To facilitate creation of new clients using XDR RPC services,
      pull alot of the remote driver code into a set of reusable
      objects.
      
       - virNetClient: Encapsulates a socket connection to a
         remote RPC server. Handles all the network I/O for
         reading/writing RPC messages. Delegates RPC encoding
         and decoding to the registered programs
      
       - virNetClientProgram: Handles processing and dispatch
         of RPC messages for a single RPC (program,version).
         A program can register to receive async events
         from a client
      
       - virNetClientStream: Handles generic I/O stream
         integration to RPC layer
      
      Each new client program now merely needs to define the list of
      RPC procedures & events it wants and their handlers. It does
      not need to deal with any of the network I/O functionality at
      all.
      434de30d