1. 21 4月, 2016 1 次提交
  2. 03 12月, 2014 1 次提交
    • J
      Replace virStreamFree with virObjectUnref · 1725a468
      John Ferlan 提交于
      Since virStreamFree will call virObjectUnref anyway, let's just use that
      directly so as to avoid the possibility that we inadvertently clear out
      a pending error message when using the public API.
      1725a468
  3. 05 9月, 2014 1 次提交
    • E
      maint: use consistent if-else braces in remaining spots · d194d6e7
      Eric Blake 提交于
      I'm about to add a syntax check that enforces our documented
      HACKING style of always using matching {} on if-else statements.
      
      This patch focuses on all remaining problems, where there weren't
      enough issues to warrant splitting it further.
      
      * src/remote/remote_driver.c (doRemoteOpen): Correct use of {}.
      * src/security/virt-aa-helper.c (vah_add_path, valid_path, main):
      Likewise.
      * src/rpc/virnetsocket.c (virNetSocketNewConnectLibSSH2):
      Likewise.
      * src/esx/esx_vi_types.c (esxVI_Type_FromString): Likewise.
      * src/uml/uml_driver.c (umlDomainDetachDevice): Likewise.
      * src/util/viralloc.c (virShrinkN): Likewise.
      * src/util/virbuffer.c (virBufferURIEncodeString): Likewise.
      * src/util/virdbus.c (virDBusCall): Likewise.
      * src/util/virnetdev.c (virNetDevValidateConfig): Likewise.
      * src/util/virnetdevvportprofile.c
      (virNetDevVPortProfileGetNthParent): Likewise.
      * src/util/virpci.c (virPCIDeviceIterDevices)
      (virPCIDeviceWaitForCleanup)
      (virPCIDeviceIsBehindSwitchLackingACS): Likewise.
      * src/util/virsocketaddr.c (virSocketAddrGetNumNetmaskBits):
      Likewise.
      * src/util/viruri.c (virURIParseParams): Likewise.
      * daemon/stream.c (daemonStreamHandleAbort): Likewise.
      * tests/testutils.c (virtTestResult): Likewise.
      * tests/cputest.c (cpuTestBaseline): Likewise.
      * tools/virsh-domain.c (cmdDomPMSuspend): Likewise.
      * tools/virsh-host.c (cmdNodeSuspend): Likewise.
      * src/esx/esx_vi_generator.py (Type.generate_typefromstring):
      Tweak generated code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d194d6e7
  4. 25 3月, 2014 1 次提交
  5. 18 3月, 2014 1 次提交
  6. 01 10月, 2013 1 次提交
  7. 10 7月, 2013 1 次提交
  8. 12 4月, 2013 1 次提交
  9. 21 12月, 2012 3 次提交
  10. 12 10月, 2012 1 次提交
  11. 21 9月, 2012 1 次提交
  12. 07 8月, 2012 1 次提交
  13. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  14. 20 7月, 2012 1 次提交
  15. 04 12月, 2011 1 次提交
    • E
      maint: fix improper use of 'an' · 3a9ce767
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=648855 mentioned a
      misuse of 'an' where 'a' is proper; that has since been fixed,
      but a search found other problems (some were a spelling error for
      'and', while most were fixed by 'a').
      
      * daemon/stream.c: Fix grammar.
      * src/conf/domain_conf.c: Likewise.
      * src/conf/domain_event.c: Likewise.
      * src/esx/esx_driver.c: Likewise.
      * src/esx/esx_vi.c: Likewise.
      * src/rpc/virnetclient.c: Likewise.
      * src/rpc/virnetserverprogram.c: Likewise.
      * src/storage/storage_backend_fs.c: Likewise.
      * src/util/conf.c: Likewise.
      * src/util/dnsmasq.c: Likewise.
      * src/util/iptables.c: Likewise.
      * src/xen/xen_hypervisor.c: Likewise.
      * src/xen/xend_internal.c: Likewise.
      * src/xen/xs_internal.c: Likewise.
      * tools/virsh.c: Likewise.
      3a9ce767
  16. 16 11月, 2011 1 次提交
    • D
      Fix handling of stream EOF · 1d46b2e9
      Daniel P. Berrange 提交于
      Very occasionally the sequence of events from poll would result
      in getting a HANGUP on its own, instead of a HANGUP+READABLE
      at the same time. In the former case we would send back an error
      event to the client, but never send the empty packet to indicate
      EOF.
      1d46b2e9
  17. 27 9月, 2011 1 次提交
  18. 01 9月, 2011 2 次提交
    • 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
    • D
      Avoid use-after-free on streams, due to message callbacks · 1b72ad2e
      Daniel P. Berrange 提交于
      When sending outbound stream RPC messages, a callback is
      used to re-enable stream data transmission. If the stream
      aborts while one of these messages is outstanding, the
      stream may have been free'd by the time it is invoked. This
      results in a use-after-free error
      
      * daemon/stream.c: Ref-count streams to avoid use-after-free
      1b72ad2e
  19. 31 8月, 2011 1 次提交
  20. 18 8月, 2011 1 次提交
    • D
      Don't attempt to read from a stream if it is closed · dbf04dac
      Daniel P. Berrange 提交于
      The I/O event callback processes incoming packets first, and then
      does outgoing packets. If the incoming packet caused the stream to
      close, then the attempt to process outgoing data resulted in an
      error. This caused libvirt to then send an error back to the client,
      but the stream had already been stopped. This confused the client
      since it sees 2 error events.
      
      * daemon/stream.c: Don't attempt read if stream is closed
      dbf04dac
  21. 17 8月, 2011 1 次提交
    • D
      Ensure client streams are closed when marking a client for close · f682c253
      Daniel P. Berrange 提交于
      Every active stream results in a reference being held on the
      virNetServerClientPtr object. This meant that if a client quit
      with any streams active, although all I/O was stopped the
      virNetServerClientPtr object would leak. This causes libvirtd
      to leak any file handles associated with open streams when a
      client quit
      
      To fix this, when we call virNetServerClientClose there is a
      callback invoked which lets the daemon release the streams
      and thus the extra references
      
      * daemon/remote.c: Add a hook to close all streams
      * daemon/stream.c, daemon/stream.h: Add API for releasing
        all streams
      * src/rpc/virnetserverclient.c, src/rpc/virnetserverclient.h:
        Allow registration of a hook to trigger when closing client
      f682c253
  22. 08 7月, 2011 2 次提交
    • D
      Fix sending of reply to final RPC message · 3cfdc57b
      Daniel P. Berrange 提交于
      The dispatch for the CLOSE RPC call was invoking the method
      virNetServerClientClose(). This caused the client connection
      to be immediately terminated. This meant the reply to the
      final RPC message was never sent. Prior to the RPC rewrite
      we merely flagged the connection for closing, and actually
      closed it when the next RPC call dispatch had completed.
      
      * daemon/remote.c: Flag connection for a delayed close
      * daemon/stream.c: Update to use new API for closing
        failed connection
      * src/rpc/virnetserverclient.c, src/rpc/virnetserverclient.h:
        Add support for a delayed connection close. Rename the
        virNetServerClientMarkClose method to virNetServerClientImmediateClose
        to clarify its semantics
      3cfdc57b
    • D
      Fix potential crash in libvirtd with active streams · 3e5d48ef
      Daniel P. Berrange 提交于
      If a client disconnects while it has a stream active, there is
      a race condition which could see libvirtd crash. This is because
      the client struct may be freed before the last stream event has
      triggered. This is trivially solved by holding an extra reference
      on the client for the stream callbak
      
      * daemon/stream.c: Acquire reference on client when adding the
        stream callback
      3e5d48ef
  23. 01 7月, 2011 2 次提交
    • D
      Fix release of virNetMessagePtr instances in streams processing · c69ba670
      Daniel P. Berrange 提交于
      If a message packet for a invalid stream is received it is just
      free'd. This is not good because it doesn't let the client RPC
      request counter decrement. If a stream is shutdown with pending
      packets the message also isn't released properly because of an
      incorrect header type
      
      * daemon/stream.c: Fix message header type
      * src/rpc/virnetserverprogram.c: Send dummy reply instead of
        free'ing ignored stream message
      c69ba670
    • D
      Fix release of filtered stream messages · df65adf1
      Daniel P. Berrange 提交于
      The stream code was reusing a stream message object before
      it was removed from the linked list of filtered messages.
      This caused any later queued messages to be completely lost.
      
      * daemon/stream.c: Delay reuse of stream message until
        after it is removed from the queue
      df65adf1
  24. 29 6月, 2011 1 次提交
    • 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
  25. 17 5月, 2011 1 次提交
    • M
      Fix error reporting in stream creation code · 5b77f1d5
      Matthias Bolte 提交于
      virStreamNew needs to dispatch the error that virGetStream reports
      on failure.
      
      remoteCreateClientStream can fail due to virStreamNew or due to
      VIR_ALLOC. Report OOM error for VIR_ALLOC failure to report errors
      in all error cases.
      
      Remove OOM error reporting from remoteCreateClientStream callers.
      5b77f1d5
  26. 12 5月, 2011 1 次提交
    • 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
  27. 18 4月, 2011 1 次提交
    • D
      Merge all returns paths from dispatcher into single path · 158ba873
      Daniel P. Berrange 提交于
      The dispatcher functions have numerous places where they
      return to the caller. This leads to duplicated cleanup
      code, often resulting in memory leaks. It makes it harder
      to ensure that errors are dispatched before freeing objects,
      which may overwrite the original error.
      
      The standard pattern is now
      
          remoteDispatchXXX(...) {
              int rv = -1;
      
              ....
              if (XXX < 0)
                goto cleanup;
              ...
              if (XXXX < 0)
                goto cleanup;
              ...
      
              rv = 0;
          cleanup:
              if (rv < 0)
                 remoteDispatchError(rerr);
              ...free all other stuff..
              return rv;
          }
      
      * daemon/remote.c: Centralize all cleanup paths
      * daemon/stream.c: s/remoteDispatchConnError/remoteDispatchError/
      * daemon/dispatch.c, daemon/dispatch.h: Replace
        remoteDispatchConnError with remoteDispatchError
        removing unused virConnectPtr
      158ba873
  28. 29 3月, 2011 1 次提交
  29. 21 2月, 2011 1 次提交
    • E
      maint: kill all remaining uses of old DEBUG macro · 994e7567
      Eric Blake 提交于
      Done mechanically with:
      $ git grep -l '\bDEBUG0\? *(' | xargs -L1 sed -i 's/\bDEBUG0\? *(/VIR_&/'
      
      followed by manual deletion of qemudDebug in daemon/libvirtd.c, along
      with a single 'make syntax-check' fallout in the same file, and the
      actual deletion in src/util/logging.h.
      
      * src/util/logging.h (DEBUG, DEBUG0): Delete.
      * daemon/libvirtd.h (qemudDebug): Likewise.
      * global: Change remaining clients over to VIR_DEBUG counterpart.
      994e7567
  30. 12 11月, 2010 1 次提交
    • D
      Fix busy-wait loop on closed file descriptor · c5d1a995
      Daniel P. Berrange 提交于
      When closing open streams after a client quits, the event
      callback was not removed. This mean that poll() was using
      a closed FD and returning POLLNVAL in a busy-wait loop.
      
      * daemon/stream.c: Disconnect stream callbacks
      c5d1a995
  31. 30 9月, 2009 1 次提交
  32. 29 9月, 2009 3 次提交
    • D
      Handle outgoing data streams in libvirtd · 4f17809a
      Daniel P. Berrange 提交于
      * daemon/dispatch.c: Set streamTX flag on outgoing data packets
      * daemon/qemud.h: Add streamTX flag to track outgoing data
      * daemon/qemud.c: Re-enable further TX when outgoing data packet
        has been fully sent.
      * daemon/stream.h, daemon/stream.c: Add method for enabling TX.
        Support reading from streams and transmitting data out to client
      4f17809a
    • D
      Handle incoming data streams in libvirtd · d790a66d
      Daniel P. Berrange 提交于
      * daemon/stream.c: Handle incoming stream data packets, queuing until
        stream becomes writable. Handle stream completion handshake
      * po/POTFILES.in: Add daemon/stream.c
      d790a66d
    • D
      Helper functions for processing data streams in libvirtd · 11573f3e
      Daniel P. Berrange 提交于
      Defines the extensions to the remote protocol for generic
      data streams. Adds a bunch of helper code to the libvirtd
      daemon for working with data streams.
      
      * daemon/Makefile.am: Add stream.c/stream.h to build
      * daemon/stream.c, qemud/stream.h: Generic helper functions for
        creating new streams, associating streams with clients, finding
        existing streams for a client and removing/deleting streams.
      * src/remote/remote_protocol.x: Add a new 'REMOTE_STREAM' constant
        for the 'enum remote_message_type' for encoding stream data
        in wire messages. Add a new 'REMOTE_CONTINUE' constant to
        'enum remote_message_status' to indicate further data stream
        messsages are expected to follow.  Document how the
        remote_message_header is used to encode data streams
      * src/remote/remote_protocol.h: Regenerate
      * daemon/dispatch.c: Remove assumption that a error message
        sent to client is always type=REMOTE_REPLY. It may now
        also be type=REMOTE_STREAM. Add convenient method for
        sending outgoing stream data packets. Log and ignore
        non-filtered incoming stream packets. Add a method for
        serializing a stream error message
      * daemon/dispatch.h:  Add API for serializing stream errors
        and sending stream data packets
      * daemon/qemud.h: Add struct qemud_client_stream for tracking
        active data streams for clients. Tweak filter function
        operation so that it accepts a client object too.
      * daemon/qemud.c: Refactor code for free'ing message objects
        which have been fully transmitted into separate method.
        Release all active streams when client shuts down. Change
        filter function to be responsible for queueing the message
      11573f3e