1. 12 6月, 2016 1 次提交
  2. 07 6月, 2016 1 次提交
  3. 02 6月, 2016 2 次提交
  4. 26 5月, 2016 3 次提交
  5. 23 5月, 2016 1 次提交
  6. 12 5月, 2016 1 次提交
    • E
      tests: Add check-qnull · 7d7a337e
      Eric Blake 提交于
      Add a new test, for checking reference counting of qnull(). As
      part of the new file, move a previous reference counting change
      added in commit a8615640 to a more logical place.
      
      Note that while most of the check-q*.c leave visitor stuff to
      the test-qmp-*-visitor.c, in this case we actually want the
      visitor tests in our new file because we are validating the
      reference count of qnull_, which is an internal detail that
      test-qmp-*-visitor should not be peeking into (or put another
      way, qnull() is the only special case where we don't have
      independent allocation of a QObject, so none of the other
      visitor tests require the layering violation present in this
      test).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1461879932-9020-14-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      7d7a337e
  7. 20 4月, 2016 1 次提交
    • Y
      qemu-ga: do not run qga test when guest agent disabled · fb91f30b
      Yang Hongyang 提交于
      When configure with --disable-guest-agent, make check will fail with:
      ERROR:tests/test-qga.c:74:fixture_setup: assertion failed (error == NULL):
       Failed to execute child process "/home/xx/qemu/qemu-ga" (No such file or
      directory) (g-exec-error-quark, 8)
      make: *** [check-tests/test-qga] Error 1
      
      This check was commented out by bab47d9a. I think that was by
      mistake, because the commit message of that commit didn't mention
      this change.
      Signed-off-by: NYang Hongyang <hongyang.yang@easystack.cn>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Cc: qemu-stable@nongnu.org
      fb91f30b
  8. 08 4月, 2016 1 次提交
    • G
      Sort the fw_cfg file list · bab47d9a
      Gerd Hoffmann 提交于
      Entries are inserted in filename order instead of being
      appended to the end in case sorting is enabled.
      
      This will avoid any future issues of moving the file creation
      around, it doesn't matter what order they are created now,
      the will always be in filename order.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      
      Added machine type handling for compatibility.  This was
      a fairly complex change, this will preserve the order of fw_cfg
      for older versions no matter what order the firmware files
      actually come in.  A list is kept of the correct legacy order
      and the entries will be inserted based upon their order in
      the list.  Except that some entries are ordered (in a specific
      area of the list) based upon what order they appear on the
      command line.  Special handling is added for those entries.
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      bab47d9a
  9. 05 4月, 2016 1 次提交
  10. 30 3月, 2016 2 次提交
    • Z
      tests/test-filter-redirector: Add unit test for filter-redirector · 9fd3c5d5
      Zhang Chen 提交于
      In this unit test,we will test the filter redirector function.
      
      Case 1, tx traffic flow:
      
      qemu side              | test side
                             |
      +---------+            |  +-------+
      | backend <---------------+ sock0 |
      +----+----+            |  +-------+
           |                 |
      +----v----+  +-------+ |
      |  rd0    +->+chardev| |
      +---------+  +---+---+ |
                       |     |
      +---------+      |     |
      |  rd1    <------+     |
      +----+----+            |
           |                 |
      +----v----+            |  +-------+
      |  rd2    +--------------->sock1  |
      +---------+            |  +-------+
                             +
      
      a. we(sock0) inject packet to qemu socket backend
      b. backend pass packet to filter redirector0(rd0)
      c. rd0 redirect packet to out_dev(chardev) which is connected with
      filter redirector1's(rd1) in_dev
      d. rd1 read this packet from in_dev, and pass to next filter redirector2(rd2)
      e. rd2 redirect packet to rd2's out_dev which is connected with an opened socketed(sock1)
      f. we read packet from sock1 and compare to what we inject
      
      Start qemu with:
      
      "-netdev socket,id=qtest-bn0,fd=%d "
      "-device rtl8139,netdev=qtest-bn0,id=qtest-e0 "
      "-chardev socket,id=redirector0,path=%s,server,nowait "
      "-chardev socket,id=redirector1,path=%s,server,nowait "
      "-chardev socket,id=redirector2,path=%s,nowait "
      "-object filter-redirector,id=qtest-f0,netdev=qtest-bn0,"
      "queue=tx,outdev=redirector0 "
      "-object filter-redirector,id=qtest-f1,netdev=qtest-bn0,"
      "queue=tx,indev=redirector2 "
      "-object filter-redirector,id=qtest-f2,netdev=qtest-bn0,"
      "queue=tx,outdev=redirector1 "
      
      --------------------------------------
      Case 2, rx traffic flow
      qemu side              | test side
                             |
      +---------+            |  +-------+
      | backend +---------------> sock1 |
      +----^----+            |  +-------+
           |                 |
      +----+----+  +-------+ |
      |  rd0    +<-+chardev| |
      +---------+  +---+---+ |
                       ^     |
      +---------+      |     |
      |  rd1    +------+     |
      +----^----+            |
           |                 |
      +----+----+            |  +-------+
      |  rd2    <---------------+sock0  |
      +---------+            |  +-------+
      
      a. we(sock0) insert packet to filter redirector2(rd2)
      b. rd2 pass packet to filter redirector1(rd1)
      c. rd1 redirect packet to out_dev(chardev) which is connected with
         filter redirector0's(rd0) in_dev
      d. rd0 read this packet from in_dev, and pass ti to qemu backend which is
         connected with an opened socketed(sock1)
      e. we read packet from sock1 and compare to what we inject
      
      Start qemu with:
      
      "-netdev socket,id=qtest-bn0,fd=%d "
      "-device rtl8139,netdev=qtest-bn0,id=qtest-e0 "
      "-chardev socket,id=redirector0,path=%s,server,nowait "
      "-chardev socket,id=redirector1,path=%s,server,nowait "
      "-chardev socket,id=redirector2,path=%s,nowait "
      "-object filter-redirector,id=qtest-f0,netdev=qtest-bn0,"
      "queue=rx,outdev=redirector0 "
      "-object filter-redirector,id=qtest-f1,netdev=qtest-bn0,"
      "queue=rx,indev=redirector2 "
      "-object filter-redirector,id=qtest-f2,netdev=qtest-bn0,"
      "queue=rx,outdev=redirector1 "
      Signed-off-by: NZhang Chen <zhangchen.fnst@cn.fujitsu.com>
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      Signed-off-by: NLi Zhijian <lizhijian@cn.fujitsu.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      9fd3c5d5
    • Z
      tests/test-filter-mirror:add filter-mirror unit test · 06809ecf
      Zhang Chen 提交于
      In this unit test we will test the mirror function.
      
      start qemu with:
            -netdev socket,id=qtest-bn0,fd=sockfd
            -device e1000,netdev=qtest-bn0,id=qtest-e0
            -chardev socket,id=mirror0,path=/tmp/filter-mirror-test.sock,server,nowait
            -object filter-mirror,id=qtest-f0,netdev=qtest-bn0,queue=tx,outdev=mirror0
      
      We inject packet to netdev socket id = qtest-bn0,
      filter-mirror will copy and mirror the packet to mirror0.
      we read packet from mirror0 and then compare to what we injected.
      Signed-off-by: NZhang Chen <zhangchen.fnst@cn.fujitsu.com>
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      06809ecf
  11. 23 3月, 2016 1 次提交
    • A
      qemu-log: new option -dfilter to limit output · 3514552e
      Alex Bennée 提交于
      When debugging big programs or system emulation sometimes you want both
      the verbosity of cpu,exec et all but don't want to generate lots of logs
      for unneeded stuff. This patch adds a new option -dfilter which allows
      you to specify interesting address ranges in the form:
      
        -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,...
      
      Then logging code can use the new qemu_log_in_addr_range() function to
      decide if it will output logging information for the given range.
      Signed-off-by: NAlex Bennée <alex.bennee@linaro.org>
      Message-Id: <1458052224-9316-7-git-send-email-alex.bennee@linaro.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      3514552e
  12. 22 3月, 2016 1 次提交
  13. 17 3月, 2016 5 次提交
  14. 05 3月, 2016 1 次提交
  15. 19 2月, 2016 1 次提交
    • E
      qapi: Forbid 'any' inside an alternate · 46534309
      Eric Blake 提交于
      The whole point of an alternate is to allow some type-safety while
      still accepting more than one JSON type.  Meanwhile, the 'any'
      type exists to bypass type-safety altogether.  The two are
      incompatible: you can't accept every type, and still tell which
      branch of the alternate to use for the parse; fix this to give a
      sane error instead of a Python stack trace.
      
      Note that other types that can't be alternate members are caught
      earlier, by check_type().
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1455778109-6278-4-git-send-email-eblake@redhat.com>
      [Commit message tweaked]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      46534309
  16. 17 2月, 2016 1 次提交
    • D
      nbd: convert block client to use I/O channels for connection setup · 064097d9
      Daniel P. Berrange 提交于
      This converts the NBD block driver client to use the QIOChannelSocket
      class for initial connection setup. The NbdClientSession struct has
      two pointers, one to the master QIOChannelSocket providing the raw
      data channel, and one to a QIOChannel which is the current channel
      used for I/O. Initially the two point to the same object, but when
      TLS support is added, they will point to different objects.
      
      The qemu-img & qemu-io tools now need to use MODULE_INIT_QOM to
      ensure the QIOChannel object classes are registered. The qemu-nbd
      tool already did this.
      
      In this initial conversion though, all I/O is still actually done
      using the raw POSIX sockets APIs.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1455129674-17255-4-git-send-email-berrange@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      064097d9
  17. 16 2月, 2016 1 次提交
  18. 26 1月, 2016 1 次提交
  19. 23 12月, 2015 1 次提交
  20. 19 12月, 2015 2 次提交
    • D
      crypto: add QCryptoSecret object class for password/key handling · ac1d8878
      Daniel P. Berrange 提交于
      Introduce a new QCryptoSecret object class which will be used
      for providing passwords and keys to other objects which need
      sensitive credentials.
      
      The new object can provide secret values directly as properties,
      or indirectly via a file. The latter includes support for file
      descriptor passing syntax on UNIX platforms. Ordinarily passing
      secret values directly as properties is insecure, since they
      are visible in process listings, or in log files showing the
      CLI args / QMP commands. It is possible to use AES-256-CBC to
      encrypt the secret values though, in which case all that is
      visible is the ciphertext.  For ad hoc developer testing though,
      it is fine to provide the secrets directly without encryption
      so this is not explicitly forbidden.
      
      The anticipated scenario is that libvirtd will create a random
      master key per QEMU instance (eg /var/run/libvirt/qemu/$VMNAME.key)
      and will use that key to encrypt all passwords it provides to
      QEMU via '-object secret,....'.  This avoids the need for libvirt
      (or other mgmt apps) to worry about file descriptor passing.
      
      It also makes life easier for people who are scripting the
      management of QEMU, for whom FD passing is significantly more
      complex.
      
      Providing data inline (insecure, only for ad hoc dev testing)
      
        $QEMU -object secret,id=sec0,data=letmein
      
      Providing data indirectly in raw format
      
        printf "letmein" > mypasswd.txt
        $QEMU -object secret,id=sec0,file=mypasswd.txt
      
      Providing data indirectly in base64 format
      
        $QEMU -object secret,id=sec0,file=mykey.b64,format=base64
      
      Providing data with encryption
      
        $QEMU -object secret,id=master0,file=mykey.b64,format=base64 \
              -object secret,id=sec0,data=[base64 ciphertext],\
      	           keyid=master0,iv=[base64 IV],format=base64
      
      Note that 'format' here refers to the format of the ciphertext
      data. The decrypted data must always be in raw byte format.
      
      More examples are shown in the updated docs.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ac1d8878
    • D
      util: add base64 decoding function · 89bc0b6c
      Daniel P. Berrange 提交于
      The standard glib provided g_base64_decode doesn't provide any
      kind of sensible error checking on its input. Add a QEMU custom
      wrapper qbase64_decode which can be used with untrustworthy
      input that can contain invalid base64 characters, embedded
      NUL characters, or not be NUL terminated at all.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      89bc0b6c
  21. 18 12月, 2015 6 次提交
    • D
      io: add QIOChannelBuffer class · d98e4eb7
      Daniel P. Berrange 提交于
      Add a QIOChannel subclass that is capable of performing I/O
      to/from a memory buffer. This implementation does not attempt
      to support concurrent readers & writers. It is designed for
      serialized access where by a single thread at a time may write
      data, seek and then read data back out.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d98e4eb7
    • D
      io: add QIOChannelCommand class · 195e14d0
      Daniel P. Berrange 提交于
      Add a QIOChannel subclass that is capable of performing I/O
      to/from a separate process, via a pair of pipes. The command
      can be used for unidirectional or bi-directional I/O.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      195e14d0
    • D
      io: add QIOChannelTLS class · ed8ee42c
      Daniel P. Berrange 提交于
      Add a QIOChannel subclass that can run the TLS protocol over
      the top of another QIOChannel instance. The object provides a
      simplified API to perform the handshake when starting the TLS
      session. The layering of TLS over the underlying channel does
      not have to be setup immediately. It is possible to take an
      existing QIOChannel that has done some handshake and then swap
      in the QIOChannelTLS layer. This allows for use with protocols
      which start TLS right away, and those which start plain text
      and then negotiate TLS.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ed8ee42c
    • D
      io: add QIOChannelFile class · d6e48869
      Daniel P. Berrange 提交于
      Add a QIOChannel subclass that is capable of operating on things
      that are files, such as plain files, pipes, character/block
      devices, but notably not sockets.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d6e48869
    • D
      io: add QIOChannelSocket class · 559607ea
      Daniel P. Berrange 提交于
      Implement a QIOChannel subclass that supports sockets I/O.
      The implementation is able to manage a single socket file
      descriptor, whether a TCP/UNIX listener, TCP/UNIX connection,
      or a UDP datagram. It provides APIs which can listen and
      connect either asynchronously or synchronously. Since there
      is no asynchronous DNS lookup API available, it uses the
      QIOTask helper for spawning a background thread to ensure
      non-blocking operation.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      559607ea
    • D
      io: add QIOTask class for async operations · b02db2d9
      Daniel P. Berrange 提交于
      A number of I/O operations need to be performed asynchronously
      to avoid blocking the main loop. The caller of such APIs need
      to provide a callback to be invoked on completion/error and
      need access to the error, if any. The small QIOTask provides
      a simple framework for dealing with such probes. The API
      docs inline provide an outline of how this is to be used.
      
      Some functions don't have the ability to run asynchronously
      (eg getaddrinfo always blocks), so to facilitate their use,
      the task class provides a mechanism to run a blocking
      function in a thread, while triggering the completion
      callback in the main event loop thread. This easily allows
      any synchronous function to be made asynchronous, albeit
      at the cost of spawning a thread.
      
      In this series, the QIOTask class will be used for things like
      the TLS handshake, the websockets handshake and TCP connect()
      progress.
      
      The concept of QIOTask is inspired by the GAsyncResult
      interface / GTask class in the GIO libraries. The min
      version requirements on glib don't allow those to be
      used from QEMU, so QIOTask provides a facsimilie which
      can be easily switched to GTask in the future if the
      min version is increased.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b02db2d9
  22. 17 12月, 2015 5 次提交
    • E
      qapi: Detect base class loops · bac5429c
      Eric Blake 提交于
      It should be fairly obvious that qapi base classes need to
      form an acyclic graph, since QMP cannot specify the same
      key more than once, while base classes are included as flat
      members alongside other members added by the child.  But the
      old check_member_clash() parser function was not prepared to
      check for this, and entered an infinite recursion (at least
      until Python gives up, complaining about nesting too deep).
      
      Now that check_member_clash() has been recently removed,
      attempts at self-inheritance trigger an assertion failure
      introduced by commit ac88219a.  The obvious fix is to turn
      the assertion into a conditional.
      
      This patch includes both the tests (base-cycle-direct and
      base-cycle-indirect) and the fix, since the .err file output
      for the unfixed case is not useful (particularly when it was
      warning about unbounded recursion, as that limit may be
      platform-specific).
      
      We don't need to worry about cycles in flat unions (neither
      the base type nor the type of a variant can be a union) nor
      in alternates (alternate branches cannot themselves be an
      alternate).  But if we later allow a union type as a variant,
      we will still be okay, as QAPISchemaObjectTypeVariants.check()
      triggers the same QAPISchemaObjectType.check() that will
      detect any loops.
      
      Likewise, we need not worry about the case of diamond
      inheritance where the same class is used for a flat union base
      class and one of its variants; either both uses will introduce
      a collision in trying to insert the same member name twice, or
      the shared type is empty and changes nothing.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1449033659-25497-16-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      bac5429c
    • E
      qapi: Move duplicate collision checks to schema check() · 01cfbaa4
      Eric Blake 提交于
      With the recent commit 'qapi: Detect collisions in C member
      names', we have two different locations for detecting clashes -
      one at parse time, and another at QAPISchema*.check() time.
      Remove all of the ad hoc parser checks, and delete associated
      code (for example, the global check_member_clash() method is
      no longer needed).
      
      Testing this showed that the test union-bad-branch wasn't adding
      much: union-clash-branches also exposes the error message when
      branches collide, and we've recently fixed things to avoid an
      implicit collision with max.  Likewise, the error for
      enum-clash-member changes to report our new detection of
      upper case in a value name, unless we modify the test to use
      all lower case.
      
      The wording of several error messages has changed, but the
      change is generally an improvement rather than a regression.
      
      No change to generated code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1449033659-25497-15-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      01cfbaa4
    • E
      qapi: Enforce (or whitelist) case conventions on qapi members · 893e1f2c
      Eric Blake 提交于
      We document that members of enums and objects should be
      'lower-case', although we were not enforcing it.  We have to
      whitelist a few pre-existing entities that violate the norms.
      Add three new tests to expose the new error message, each of
      which first uses the whitelisted name 'UuidInfo' to prove the
      whitelist works, then triggers the failure (this is the same
      pattern used in the existing returns-whitelist.json test).
      
      Note that by adding this check, we have effectively forbidden
      an entity with a case-insensitive clash of member names, for
      any entity that is not on the whitelist (although there is
      still the possibility to clash via '-' vs. '_').
      
      Not done here: a future patch should also add naming convention
      support and whitelist exceptions for command, event, and type
      names.
      
      The additions to QAPISchemaMember.check_clash() check whether
      info['name'] is in the whitelist (the top-most entity name at
      the point 'info' tracks), rather than self.owner (the type,
      possibly implicit, that directly owns the member), because it
      is easier to maintain the whitelist by the names actually in
      the user's .json file, rather than worrying about the names
      of implicit types.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1449033659-25497-14-git-send-email-eblake@redhat.com>
      [Simplified a bit as per discussion with Eric]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      893e1f2c
    • E
      qapi: Remove obsolete tests for MAX collision · 04e0639d
      Eric Blake 提交于
      Now that we no longer collide with an implicit _MAX enum member,
      we no longer need to reject it in the ad hoc parser, and can
      remove several tests that are no longer needed.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1447836791-369-24-git-send-email-eblake@redhat.com>
      [Commit message tweaked]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      04e0639d
    • E
      qapi: Tighten the regex on valid names · 59a92fee
      Eric Blake 提交于
      We already documented that qapi names should match specific
      patterns (such as starting with a letter unless it was an enum
      value or a downstream extension).  Tighten that from a suggestion
      into a hard requirement, which frees up names beginning with a
      single underscore for qapi internal usage.
      
      The tighter regex doesn't forbid everything insane that a user
      could provide (for example, a user could name a type 'Foo-lookup'
      to collide with the generated 'Foo_lookup[]' for an enum 'Foo'),
      but does a good job at protecting the most obvious uses, and
      also happens to reserve single leading underscore for later use.
      
      The handling of enum values starting with a digit is tricky:
      commit 9fb081e0 introduced a subtle bug by using c_name() on
      a munged value, which would allow an enum to include the
      member 'q-int' in spite of our reservation.  Furthermore,
      munging with a leading '_' would fail our tighter regex.  So
      fix it by only munging for leading digits (which are never
      ticklish in c_name()) and by using a different prefix (I
      picked 'D', although any letter should do).
      
      Add new tests, reserved-member-underscore and reserved-enum-q,
      to demonstrate the tighter checking.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1447836791-369-22-git-send-email-eblake@redhat.com>
      Message-Id: <1447883135-18020-1-git-send-email-eblake@redhat.com>
      [Eric's fixup squashed in]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      59a92fee