1. 19 7月, 2016 2 次提交
  2. 13 7月, 2016 6 次提交
  3. 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
  4. 20 6月, 2016 2 次提交
  5. 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
  6. 08 6月, 2016 1 次提交
  7. 07 6月, 2016 2 次提交
  8. 26 5月, 2016 6 次提交
  9. 19 5月, 2016 8 次提交
  10. 12 5月, 2016 2 次提交
  11. 05 4月, 2016 2 次提交
    • K
      block: Forbid I/O throttling on nodes with multiple parents for 2.6 · 76b22320
      Kevin Wolf 提交于
      As the patches to move I/O throttling to BlockBackend didn't make it in
      time for the 2.6 release, but the release adds new ways of configuring
      VMs whose behaviour would change once the move is done, we need to
      outlaw such configurations temporarily.
      
      The problem exists whenever a BDS has more users than just its BB, for
      example it is used as a backing file for another node. (This wasn't
      possible in 2.5 yet as we introduced node references to specify a
      backing file only recently.) In these cases, the throttling would
      apply to these other users now, but after moving throttling to the
      BlockBackend the other users wouldn't be throttled any more.
      
      This patch prevents making new references to a throttled node as well as
      using monitor commands to throttle a node with multiple parents.
      
      Compared to 2.5 this changes behaviour in some corner cases where
      references were allowed before, like bs->file or Quorum children. It
      seems reasonable to assume that users didn't use I/O throttling on such
      low level nodes. With the upcoming move of throttling into BlockBackend,
      such configurations won't be possible anyway.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      76b22320
    • P
      block: forbid x-blockdev-del from acting on DriveInfo · 5cf87fd6
      Paolo Bonzini 提交于
      Failing on -drive/drive_add created BlockBackends was a
      requirement for x-blockdev-del, but it sneaked through
      the patch review.  Let's fix it now.
      
      Example:
      
      $ x86_64-softmmu/qemu-system-x86_64 -drive if=none,file=null-co://,id=null -qmp stdio
      >> {'execute':'qmp_capabilities'}
      << {"return": {}}
      >> {'execute':'x-blockdev-del','arguments':{'id':'null'}}
      << {"error": {"class": "GenericError", "desc": "Deleting block backend added with drive-add is not supported"}}
      
      And without a DriveInfo:
      
      >> { "execute": "blockdev-add", "arguments": { "options": { "driver":"null-co", "id":"null2"}}}
      << {"return": {}}
      >> {'execute':'x-blockdev-del','arguments':{'id':'null2'}}
      << {"return": {}}
      Suggested-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      5cf87fd6
  12. 30 3月, 2016 4 次提交