1. 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
  2. 16 9月, 2011 1 次提交
    • E
      rpc: convert unknown procedures to VIR_ERR_NO_SUPPORT · 4a075f7e
      Eric Blake 提交于
      Libvirt special-cases a specific VIR_ERR_RPC from the remote driver
      back into VIR_ERR_NO_SUPPORT on the client, so that clients can
      handle missing rpc functions the same whether the hypervisor driver
      is local or remote.  However, commit c1b22644 introduced a regression:
      VIR_FROM_THIS changed from VIR_FROM_REMOTE to VIR_FROM_RPC, so the
      special casing no longer works if the server uses the newer error
      domain.
      
      * src/rpc/virnetclientprogram.c
      (virNetClientProgramDispatchError): Also cater to 0.9.3 and newer.
      4a075f7e
  3. 01 9月, 2011 1 次提交
    • D
      Fix tracking of RPC messages wrt streams · b3fb288e
      Daniel P. Berrange 提交于
      Commit 2c85644b attempted to
      fix a problem with tracking RPC messages from streams by doing
      
      -            if (msg->header.type == VIR_NET_REPLY) {
      +            if (msg->header.type == VIR_NET_REPLY ||
      +                (msg->header.type == VIR_NET_STREAM &&
      +                 msg->header.status != VIR_NET_CONTINUE)) {
                       client->nrequests--;
      
      In other words any stream packet, with status NET_OK or NET_ERROR
      would cause nrequests to be decremented. This is great if the
      packet from from a synchronous virStreamFinish or virStreamAbort
      API call, but wildly wrong if from a server initiated abort.
      The latter resulted in 'nrequests' being decremented below zero.
      This then causes all I/O for that client to be stopped.
      
      Instead of trying to infer whether we need to decrement the
      nrequests field, from the message type/status, introduce an
      explicit 'bool tracked' field to mark whether the virNetMessagePtr
      object is subject to tracking.
      
      Also add a virNetMessageClear function to allow a message
      contents to be cleared out, without adversely impacting the
      'tracked' field as a naive memset() would do
      
      * src/rpc/virnetmessage.c, src/rpc/virnetmessage.h: Add
        a 'bool tracked' field and virNetMessageClear() API
      * daemon/remote.c, daemon/stream.c, src/rpc/virnetclientprogram.c,
        src/rpc/virnetclientstream.c, src/rpc/virnetserverclient.c,
        src/rpc/virnetserverprogram.c: Switch over to use
        virNetMessageClear() and pass in the 'bool tracked' value
        when creating messages.
      b3fb288e
  4. 08 7月, 2011 1 次提交
    • D
      Fix leak of 'msg' object in client stream code · 927dfcf6
      Daniel P. Berrange 提交于
      In one exit path we forgot to free the virNetMessage object causing
      a large memory leak for streams which send a lot of data. Some other
      paths were calling VIR_FREE directly instead of virNetMessageFree
      although this was (currently) harmless.
      
      * src/rpc/virnetclientstream.c: Fix leak of msg object
      * src/rpc/virnetclientprogram.c: Call virNetMessageFree instead
        of VIR_FREE
      927dfcf6
  5. 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