1. 01 2月, 2017 1 次提交
  2. 13 1月, 2017 2 次提交
  3. 14 11月, 2016 1 次提交
  4. 11 11月, 2016 1 次提交
    • A
      hmp: Make block_stream set an explicit job ID · 11d6fbe0
      Alberto Garcia 提交于
      A job ID is always required in order to create a block job on a
      non-root node. The default ID (obtained with bdrv_get_device_name())
      is otherwise empty in this scenario and the job cannot be created.
      
      The HMP block_stream command doesn't set a job ID and therefore it
      doesn't allow streaming to intermediate nodes. One solution is to add
      an extra parameter to set a job ID. The other solution is to simply
      use the node name passed to block_stream as job ID. This won't work
      if it's automatically generated (because it contains a '#') but is
      otherwise simple enough for all other cases.
      
      This way 'block_stream node3' will create a job with the ID 'node3'
      and the good old 'block_stream virtio0' will keep the previous
      behaviour and use 'virtio0' for the job ID.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      11d6fbe0
  5. 31 10月, 2016 1 次提交
  6. 30 10月, 2016 2 次提交
  7. 24 10月, 2016 1 次提交
  8. 13 10月, 2016 4 次提交
  9. 10 10月, 2016 1 次提交
    • D
      net: don't poke at chardev internal QemuOpts · 0a73336d
      Daniel P. Berrange 提交于
      The vhost-user & colo code is poking at the QemuOpts instance
      in the CharDriverState struct, not realizing that it is valid
      for this to be NULL. e.g. the following crash shows a codepath
      where it will be NULL:
      
       Program terminated with signal SIGSEGV, Segmentation fault.
       #0  0x000055baf6ab4adc in qemu_opt_foreach (opts=0x0, func=0x55baf696b650 <net_vhost_chardev_opts>, opaque=0x7ffc51368c00, errp=0x7ffc51368e48) at util/qemu-option.c:617
       617         QTAILQ_FOREACH(opt, &opts->head, next) {
       [Current thread is 1 (Thread 0x7f1d4970bb40 (LWP 6603))]
       (gdb) bt
       #0  0x000055baf6ab4adc in qemu_opt_foreach (opts=0x0, func=0x55baf696b650 <net_vhost_chardev_opts>, opaque=0x7ffc51368c00, errp=0x7ffc51368e48) at util/qemu-option.c:617
       #1  0x000055baf696b7da in net_vhost_parse_chardev (opts=0x55baf8ff9260, errp=0x7ffc51368e48) at net/vhost-user.c:314
       #2  0x000055baf696b985 in net_init_vhost_user (netdev=0x55baf8ff9250, name=0x55baf879d270 "hostnet2", peer=0x0, errp=0x7ffc51368e48) at net/vhost-user.c:360
       #3  0x000055baf6960216 in net_client_init1 (object=0x55baf8ff9250, is_netdev=true, errp=0x7ffc51368e48) at net/net.c:1051
       #4  0x000055baf6960518 in net_client_init (opts=0x55baf776e7e0, is_netdev=true, errp=0x7ffc51368f00) at net/net.c:1108
       #5  0x000055baf696083f in netdev_add (opts=0x55baf776e7e0, errp=0x7ffc51368f00) at net/net.c:1186
       #6  0x000055baf69608c7 in qmp_netdev_add (qdict=0x55baf7afaf60, ret=0x7ffc51368f50, errp=0x7ffc51368f48) at net/net.c:1205
       #7  0x000055baf6622135 in handle_qmp_command (parser=0x55baf77fb590, tokens=0x7f1d24011960) at /path/to/qemu.git/monitor.c:3978
       #8  0x000055baf6a9d099 in json_message_process_token (lexer=0x55baf77fb598, input=0x55baf75acd20, type=JSON_RCURLY, x=113, y=19) at qobject/json-streamer.c:105
       #9  0x000055baf6abf7aa in json_lexer_feed_char (lexer=0x55baf77fb598, ch=125 '}', flush=false) at qobject/json-lexer.c:319
       #10 0x000055baf6abf8f2 in json_lexer_feed (lexer=0x55baf77fb598, buffer=0x7ffc51369170 "}R\204\367\272U", size=1) at qobject/json-lexer.c:369
       #11 0x000055baf6a9d13c in json_message_parser_feed (parser=0x55baf77fb590, buffer=0x7ffc51369170 "}R\204\367\272U", size=1) at qobject/json-streamer.c:124
       #12 0x000055baf66221f7 in monitor_qmp_read (opaque=0x55baf77fb530, buf=0x7ffc51369170 "}R\204\367\272U", size=1) at /path/to/qemu.git/monitor.c:3994
       #13 0x000055baf6757014 in qemu_chr_be_write_impl (s=0x55baf7610a40, buf=0x7ffc51369170 "}R\204\367\272U", len=1) at qemu-char.c:387
       #14 0x000055baf6757076 in qemu_chr_be_write (s=0x55baf7610a40, buf=0x7ffc51369170 "}R\204\367\272U", len=1) at qemu-char.c:399
       #15 0x000055baf675b3b0 in tcp_chr_read (chan=0x55baf90244b0, cond=G_IO_IN, opaque=0x55baf7610a40) at qemu-char.c:2927
       #16 0x000055baf6a5d655 in qio_channel_fd_source_dispatch (source=0x55baf7610df0, callback=0x55baf675b25a <tcp_chr_read>, user_data=0x55baf7610a40) at io/channel-watch.c:84
       #17 0x00007f1d3e80cbbd in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
       #18 0x000055baf69d3720 in glib_pollfds_poll () at main-loop.c:213
       #19 0x000055baf69d37fd in os_host_main_loop_wait (timeout=126000000) at main-loop.c:258
       #20 0x000055baf69d38ad in main_loop_wait (nonblocking=0) at main-loop.c:506
       #21 0x000055baf676587b in main_loop () at vl.c:1908
       #22 0x000055baf676d3bf in main (argc=101, argv=0x7ffc5136a6c8, envp=0x7ffc5136a9f8) at vl.c:4604
       (gdb) p opts
       $1 = (QemuOpts *) 0x0
      
      The crash occurred when attaching vhost-user net via QMP:
      
      {
          "execute": "chardev-add",
          "arguments": {
              "id": "charnet2",
              "backend": {
                  "type": "socket",
                  "data": {
                      "addr": {
                          "type": "unix",
                          "data": {
                              "path": "/var/run/openvswitch/vhost-user1"
                          }
                      },
                      "wait": false,
                      "server": false
                  }
              }
          },
          "id": "libvirt-19"
      }
      {
          "return": {
      
          },
          "id": "libvirt-19"
      }
      {
          "execute": "netdev_add",
          "arguments": {
              "type": "vhost-user",
              "chardev": "charnet2",
              "id": "hostnet2"
          },
          "id": "libvirt-20"
      }
      
      Code using chardevs should not be poking at the internals of the
      CharDriverState struct. What vhost-user wants is a chardev that is
      operating as reconnectable network service, along with the ability
      to do FD passing over the connection. The colo code simply wants
      a network service. Add a feature concept to the char drivers so
      that chardev users can query the actual features they wish to have
      supported. The QemuOpts member is removed to prevent future mistakes
      in this area.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      0a73336d
  10. 04 10月, 2016 1 次提交
  11. 23 9月, 2016 3 次提交
  12. 06 9月, 2016 3 次提交
  13. 19 7月, 2016 2 次提交
  14. 13 7月, 2016 3 次提交
  15. 06 7月, 2016 3 次提交
    • E
      qapi: Add new visit_complete() function · 3b098d56
      Eric Blake 提交于
      Making each output visitor provide its own output collection
      function was the only remaining reason for exposing visitor
      sub-types to the rest of the code base.  Add a polymorphic
      visit_complete() function which is a no-op for input visitors,
      and which populates an opaque pointer for output visitors.  For
      maximum type-safety, also add a parameter to the output visitor
      constructors with a type-correct version of the output pointer,
      and assert that the two uses match.
      
      This approach was considered superior to either passing the
      output parameter only during construction (action at a distance
      during visit_free() feels awkward) or only during visit_complete()
      (defeating type safety makes it easier to use incorrectly).
      
      Most callers were function-local, and therefore a mechanical
      conversion; the testsuite was a bit trickier, but the previous
      cleanup patch minimized the churn here.
      
      The visit_complete() function may be called at most once; doing
      so lets us use transfer semantics rather than duplication or
      ref-count semantics to get the just-built output back to the
      caller, even though it means our behavior is not idempotent.
      
      Generated code is simplified as follows for events:
      
      |@@ -26,7 +26,7 @@ void qapi_event_send_acpi_device_ost(ACP
      |     QDict *qmp;
      |     Error *err = NULL;
      |     QMPEventFuncEmit emit;
      |-    QmpOutputVisitor *qov;
      |+    QObject *obj;
      |     Visitor *v;
      |     q_obj_ACPI_DEVICE_OST_arg param = {
      |         info
      |@@ -39,8 +39,7 @@ void qapi_event_send_acpi_device_ost(ACP
      |
      |     qmp = qmp_event_build_dict("ACPI_DEVICE_OST");
      |
      |-    qov = qmp_output_visitor_new();
      |-    v = qmp_output_get_visitor(qov);
      |+    v = qmp_output_visitor_new(&obj);
      |
      |     visit_start_struct(v, "ACPI_DEVICE_OST", NULL, 0, &err);
      |     if (err) {
      |@@ -55,7 +54,8 @@ void qapi_event_send_acpi_device_ost(ACP
      |         goto out;
      |     }
      |
      |-    qdict_put_obj(qmp, "data", qmp_output_get_qobject(qov));
      |+    visit_complete(v, &obj);
      |+    qdict_put_obj(qmp, "data", obj);
      |     emit(QAPI_EVENT_ACPI_DEVICE_OST, qmp, &err);
      
      and for commands:
      
      | {
      |     Error *err = NULL;
      |-    QmpOutputVisitor *qov = qmp_output_visitor_new();
      |     Visitor *v;
      |
      |-    v = qmp_output_get_visitor(qov);
      |+    v = qmp_output_visitor_new(ret_out);
      |     visit_type_AddfdInfo(v, "unused", &ret_in, &err);
      |-    if (err) {
      |-        goto out;
      |+    if (!err) {
      |+        visit_complete(v, ret_out);
      |     }
      |-    *ret_out = qmp_output_get_qobject(qov);
      |-
      |-out:
      |     error_propagate(errp, err);
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-13-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      3b098d56
    • E
      string-output-visitor: Favor new visit_free() function · e7ca5656
      Eric Blake 提交于
      Now that we have a polymorphic visit_free(), we no longer need
      string_output_visitor_cleanup(); however, we still need to
      expose the subtype for string_output_get_string().
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-9-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      e7ca5656
    • E
      opts-visitor: Favor new visit_free() function · 09204eac
      Eric Blake 提交于
      Now that we have a polymorphic visit_free(), we no longer need
      opts_visitor_cleanup(); which in turn means we no longer need
      to return a subtype from opts_visitor_new() nor a public upcast
      function.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-6-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      09204eac
  16. 27 6月, 2016 1 次提交
  17. 17 6月, 2016 1 次提交
  18. 16 6月, 2016 2 次提交
  19. 26 5月, 2016 2 次提交
    • D
      migration: define 'tls-creds' and 'tls-hostname' migration parameters · 69ef1f36
      Daniel P. Berrange 提交于
      Define two new migration parameters to be used with TLS encryption.
      The 'tls-creds' parameter provides the ID of an instance of the
      'tls-creds' object type, or rather a subclass such as 'tls-creds-x509'.
      Providing these credentials will enable use of TLS on the migration
      data stream.
      
      If using x509 certificates, together with a migration URI that does
      not include a hostname, the 'tls-hostname' parameter provides the
      hostname to use when verifying the server's x509 certificate. This
      allows TLS to be used in combination with fd: and exec: protocols
      where a TCP connection is established by a 3rd party outside of
      QEMU.
      
      NB, this requires changing the migrate_set_parameter method in the
      HMP to accept a 's' (string) value instead of 'i' (integer). This
      is backwards compatible, because the parsing of strings allows the
      quotes to be optional, thus any integer is also a valid string.
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1461751518-12128-26-git-send-email-berrange@redhat.com>
      Signed-off-by: NAmit Shah <amit.shah@redhat.com>
      69ef1f36
    • D
      migration: add reporting of errors for outgoing migration · d59ce6f3
      Daniel P. Berrange 提交于
      Currently if an application initiates an outgoing migration,
      it may or may not, get an error reported back on failure. If
      the error occurs synchronously to the 'migrate' command
      execution, the client app will see the error message. This
      is the case for DNS lookup failures. If the error occurs
      asynchronously to the monitor command though, the error
      will be thrown away and the client left guessing about
      what went wrong. This is the case for failure to connect
      to the TCP server (eg due to wrong port, or firewall
      rules, or other similar errors).
      
      In the future we'll be adding more scope for errors to
      happen asynchronously with the TLS protocol handshake.
      TLS errors are hard to diagnose even when they are well
      reported, so discarding errors entirely will make it
      impossible to debug TLS connection problems.
      
      Management apps which do migration are already using
      'query-migrate' / 'info migrate' to check up on progress
      of background migration operations and to see their end
      status. This is a fine place to also include the error
      message when things go wrong.
      
      This patch thus adds an 'error-desc' field to the
      MigrationInfo struct, which will be populated when
      the 'status' is set to 'failed':
      
      (qemu) migrate -d tcp:localhost:9001
      (qemu) info migrate
      capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off x-postcopy-ram: off
      Migration status: failed (Error connecting to socket: Connection refused)
      total time: 0 milliseconds
      
      In the HMP, when doing non-detached migration, it is
      also possible to display this error message directly
      to the app.
      
      (qemu) migrate tcp:localhost:9001
      Error connecting to socket: Connection refused
      
      Or with QMP
      
        {
          "execute": "query-migrate",
          "arguments": {}
        }
        {
          "return": {
            "status": "failed",
            "error-desc": "address resolution failed for myhost:9000: No address associated with hostname"
          }
        }
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NJuan Quintela <quintela@redhat.com>
      Message-Id: <1461751518-12128-11-git-send-email-berrange@redhat.com>
      Signed-off-by: NAmit Shah <amit.shah@redhat.com>
      d59ce6f3
  20. 23 5月, 2016 1 次提交
  21. 23 3月, 2016 1 次提交
  22. 18 3月, 2016 1 次提交
    • E
      qapi: Don't special-case simple union wrappers · 32bafa8f
      Eric Blake 提交于
      Simple unions were carrying a special case that hid their 'data'
      QMP member from the resulting C struct, via the hack method
      QAPISchemaObjectTypeVariant.simple_union_type().  But by using
      the work we started by unboxing flat union and alternate
      branches, coupled with the ability to visit the members of an
      implicit type, we can now expose the simple union's implicit
      type in qapi-types.h:
      
      | struct q_obj_ImageInfoSpecificQCow2_wrapper {
      |     ImageInfoSpecificQCow2 *data;
      | };
      |
      | struct q_obj_ImageInfoSpecificVmdk_wrapper {
      |     ImageInfoSpecificVmdk *data;
      | };
      ...
      | struct ImageInfoSpecific {
      |     ImageInfoSpecificKind type;
      |     union { /* union tag is @type */
      |         void *data;
      |-        ImageInfoSpecificQCow2 *qcow2;
      |-        ImageInfoSpecificVmdk *vmdk;
      |+        q_obj_ImageInfoSpecificQCow2_wrapper qcow2;
      |+        q_obj_ImageInfoSpecificVmdk_wrapper vmdk;
      |     } u;
      | };
      
      Doing this removes asymmetry between QAPI's QMP side and its
      C side (both sides now expose 'data'), and means that the
      treatment of a simple union as sugar for a flat union is now
      equivalent in both languages (previously the two approaches used
      a different layer of dereferencing, where the simple union could
      be converted to a flat union with equivalent C layout but
      different {} on the wire, or to an equivalent QMP wire form
      but with different C representation).  Using the implicit type
      also lets us get rid of the simple_union_type() hack.
      
      Of course, now all clients of simple unions have to adjust from
      using su->u.member to using su->u.member.data; while this touches
      a number of files in the tree, some earlier cleanup patches
      helped minimize the change to the initialization of a temporary
      variable rather than every single member access.  The generated
      qapi-visit.c code is also affected by the layout change:
      
      |@@ -7393,10 +7393,10 @@ void visit_type_ImageInfoSpecific_member
      |     }
      |     switch (obj->type) {
      |     case IMAGE_INFO_SPECIFIC_KIND_QCOW2:
      |-        visit_type_ImageInfoSpecificQCow2(v, "data", &obj->u.qcow2, &err);
      |+        visit_type_q_obj_ImageInfoSpecificQCow2_wrapper_members(v, &obj->u.qcow2, &err);
      |         break;
      |     case IMAGE_INFO_SPECIFIC_KIND_VMDK:
      |-        visit_type_ImageInfoSpecificVmdk(v, "data", &obj->u.vmdk, &err);
      |+        visit_type_q_obj_ImageInfoSpecificVmdk_wrapper_members(v, &obj->u.vmdk, &err);
      |         break;
      |     default:
      |         abort();
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1458254921-17042-13-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      32bafa8f
  23. 23 2月, 2016 2 次提交