1. 06 7月, 2016 1 次提交
  2. 20 6月, 2016 2 次提交
  3. 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
  4. 08 6月, 2016 1 次提交
  5. 07 6月, 2016 2 次提交
  6. 26 5月, 2016 6 次提交
  7. 19 5月, 2016 8 次提交
  8. 12 5月, 2016 2 次提交
  9. 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
  10. 30 3月, 2016 7 次提交
    • K
      block: Remove BDRV_O_CACHE_WB · 61de4c68
      Kevin Wolf 提交于
      The previous patches have successively made blk->enable_write_cache the
      true source for the information whether a writethrough mode must be
      implemented. The corresponding BDRV_O_CACHE_WB is only useless baggage
      we're carrying around, so now's the time to remove it.
      
      At the same time, we remove the 'cache.writeback' option parsing on the
      BDS level as the only effect was setting the BDRV_O_CACHE_WB flag.
      
      This change requires test cases that explicitly enabled the option to
      drop it. Other than that and the change of the error message when
      writethrough is enabled on the BDS level (from "Can't set writethrough
      mode" to "doesn't support the option"), there should be no change in
      behaviour.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      61de4c68
    • K
      block: Use bdrv_parse_cache_mode() in drive_init() · 04feb4a5
      Kevin Wolf 提交于
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      04feb4a5
    • K
      block: Always set writeback mode in blk_new_open() · 72e775c7
      Kevin Wolf 提交于
      All callers of blk_new_open() either don't rely on the WCE bit set after
      blk_new_open() because they explicitly set it anyway, or they pass
      BDRV_O_CACHE_WB unconditionally.
      
      This patch changes blk_new_open() so that it always enables writeback
      mode and asserts that BDRV_O_CACHE_WB is clear. For those callers that
      used to pass BDRV_O_CACHE_WB unconditionally, the flag is removed now.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      72e775c7
    • K
      e4b24b49
    • K
      block: Reject writethrough mode except at the root · 73ac451f
      Kevin Wolf 提交于
      Writethrough mode is going to become a BlockBackend feature rather than
      a BDS one, so forbid it in places where we won't be able to support it
      when the code finally matches the envisioned design.
      
      We only allowed setting the cache mode of non-root nodes after the 2.5
      release, so we're still free to make this change.
      
      The target of block jobs is now always opened in a writeback mode
      because it doesn't have a BlockBackend attached. This makes more sense
      anyway because block jobs know when to flush. If the graph is modified
      on job completion, the original cache mode moves to the new root, so
      for the guest device writethough always stays enabled if it was
      configured this way.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      73ac451f
    • K
      block: Remove copy-on-read from bdrv_move_feature_fields() · 4c844983
      Kevin Wolf 提交于
      Ever since we first introduced bdrv_append() in commit 8802d1fd ('qapi:
      Introduce blockdev-group-snapshot-sync command'), the copy-on-read flag
      was moved to the new top layer when taking a snapshot. The only problem
      is that it doesn't make a whole lot of sense.
      
      The use case for manually enabled CoR is to avoid reading data twice
      from a slow remote image, so we want to save it to a local overlay, say
      an ISO image accessed via HTTP to a local qcow2 overlay. When taking a
      snapshot, we end up with a backing chain like this:
      
          http <- local.qcow2 <- snap_overlay.qcow2
      
      There is no point in doing CoR from local.qcow2 into snap_overlay.qcow2,
      we just want to keep copying data from the remote source into
      local.qcow2.
      
      The other use case of CoR is in the context of streaming, which isn't
      very interesting for bdrv_move_feature_fields() because op blockers
      prevent this combination.
      
      This patch makes the copy-on-read flag stay on the image for which it
      was originally set and prevents it from being propagated to the new
      overlay. It is no longer intended to move CoR to the BlockBackend level.
      In order for this to make sense, we also need to keep the respective
      image read-write.
      
      As a side effect of these changes, creating a live snapshot image (as
      opposed to using an existing externally created one) on top of a COR
      block device works now. It used to fail because it tried to open its
      backing file both read-only and with COR.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      4c844983
    • K
      block: Remove bdrv_make_anon() · 63eaaae0
      Kevin Wolf 提交于
      The call in hmp_drive_del() is dead code because blk_remove_bs() is
      called a few lines above. The only other remaining user is
      bdrv_delete(), which only abuses bdrv_make_anon() to remove it from the
      named nodes list. This path inlines the list entry removal into
      bdrv_delete() and removes bdrv_make_anon().
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      63eaaae0
  11. 23 3月, 2016 1 次提交
  12. 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
  13. 17 3月, 2016 4 次提交