1. 23 9月, 2016 7 次提交
  2. 14 9月, 2016 1 次提交
  3. 13 9月, 2016 1 次提交
  4. 06 9月, 2016 13 次提交
  5. 05 8月, 2016 1 次提交
  6. 19 7月, 2016 2 次提交
  7. 13 7月, 2016 6 次提交
  8. 06 7月, 2016 2 次提交
    • 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
      qmp-output-visitor: Favor new visit_free() function · 1830f22a
      Eric Blake 提交于
      Now that we have a polymorphic visit_free(), we no longer need
      qmp_output_visitor_cleanup(); however, we still need to
      expose the subtype for qmp_output_get_qobject().
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-10-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      1830f22a
  9. 20 6月, 2016 2 次提交
  10. 16 6月, 2016 3 次提交
    • M
      block/mirror: Fix target backing BDS · 274fccee
      Max Reitz 提交于
      Currently, we are trying to move the backing BDS from the source to the
      target in bdrv_replace_in_backing_chain() which is called from
      mirror_exit(). However, mirror_complete() already tries to open the
      target's backing chain with a call to bdrv_open_backing_file().
      
      First, we should only set the target's backing BDS once. Second, the
      mirroring block job has a better idea of what to set it to than the
      generic code in bdrv_replace_in_backing_chain() (in fact, the latter's
      conditions on when to move the backing BDS from source to target are not
      really correct).
      
      Therefore, remove that code from bdrv_replace_in_backing_chain() and
      leave it to mirror_complete().
      
      Depending on what kind of mirroring is performed, we furthermore want to
      use different strategies to open the target's backing chain:
      
      - If blockdev-mirror is used, we can assume the user made sure that the
        target already has the correct backing chain. In particular, we should
        not try to open a backing file if the target does not have any yet.
      
      - If drive-mirror with mode=absolute-paths is used, we can and should
        reuse the already existing chain of nodes that the source BDS is in.
        In case of sync=full, no backing BDS is required; with sync=top, we
        just link the source's backing BDS to the target, and with sync=none,
        we use the source BDS as the target's backing BDS.
        We should not try to open these backing files anew because this would
        lead to two BDSs existing per physical file in the backing chain, and
        we would like to avoid such concurrent access.
      
      - If drive-mirror with mode=existing is used, we have to use the
        information provided in the physical image file which means opening
        the target's backing chain completely anew, just as it has been done
        already.
        If the target's backing chain shares images with the source, this may
        lead to multiple BDSs per physical image file. But since we cannot
        reliably ascertain this case, there is nothing we can do about it.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20160610185750.30956-3-mreitz@redhat.com
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      274fccee
    • A
      block: use the block job list in qmp_query_block_jobs() · f0f55ded
      Alberto Garcia 提交于
      qmp_query_block_jobs() uses bdrv_next() to look for block jobs, but
      this function can only find those in top-level BlockDriverStates.
      
      This patch uses block_job_next() instead.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Message-id: a8b7e5497b7c1fa67c12fcceae1630d01c3b1f96.1464346103.git.berto@igalia.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      f0f55ded
    • C
      blockdev: clarify error on attempt to open locked tray · 38a53d50
      Colin Lord 提交于
      When opening a device with a locked tray, gives an error explaining the
      device tray is locked and that the user should wait and try again. This
      is less confusing than the previous error, which simply stated that the
      tray was locked.
      Signed-off-by: NColin Lord <clord@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      38a53d50
  11. 08 6月, 2016 1 次提交
  12. 07 6月, 2016 1 次提交