1. 20 10月, 2014 14 次提交
  2. 03 10月, 2014 5 次提交
  3. 25 9月, 2014 4 次提交
  4. 11 9月, 2014 1 次提交
    • M
      blockdev: Refuse to drive_del something added with blockdev-add · 48f364dd
      Markus Armbruster 提交于
      For some device models, the guest can prevent unplug.  Some users need a
      way to forcibly revoke device model access to the block backend then, so
      the underlying images can be safely used for something else.
      
      drive_del lets you do that.  Unfortunately, it conflates revoking access
      with destroying the backend.
      
      Commit 9063f814 made drive_del immediately destroy the root BDS.  Nice:
      the device name becomes available for reuse immediately.  Not so nice:
      the device model's pointer to the root BDS dangles, and we're prone to
      crash when the memory gets reused.
      
      Commit d22b2f41 fixed that by hiding the root BDS instead of destroying
      it.  Destruction only happens on unplug.  "Hiding" means removing it
      from bdrv_states and graph_bdrv_states; see bdrv_make_anon().
      
      This "destroy on revoke" is a misfeature we don't want to carry
      forward to blockdev-add, just like "destroy on unplug" (commit
      2d246f01).  So make drive_del fail on anything added with blockdev-add.
      
      We'll add separate QMP commands to revoke device model access and to
      destroy backends.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      48f364dd
  5. 08 9月, 2014 1 次提交
  6. 29 8月, 2014 2 次提交
  7. 20 8月, 2014 2 次提交
    • S
      block: acquire AioContext in qmp_block_resize() · 927e0e76
      Stefan Hajnoczi 提交于
      Make block_resize safe for dataplane where another thread may be running
      the BlockDriverState's AioContext.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      927e0e76
    • M
      block: Use g_new() & friends where that makes obvious sense · 5839e53b
      Markus Armbruster 提交于
      g_new(T, n) is neater than g_malloc(sizeof(T) * n).  It's also safer,
      for two reasons.  One, it catches multiplication overflowing size_t.
      Two, it returns T * rather than void *, which lets the compiler catch
      more type errors.
      
      Patch created with Coccinelle, with two manual changes on top:
      
      * Add const to bdrv_iterate_format() to keep the types straight
      
      * Convert the allocation in bdrv_drop_intermediate(), which Coccinelle
        inexplicably misses
      
      Coccinelle semantic patch:
      
          @@
          type T;
          @@
          -g_malloc(sizeof(T))
          +g_new(T, 1)
          @@
          type T;
          @@
          -g_try_malloc(sizeof(T))
          +g_try_new(T, 1)
          @@
          type T;
          @@
          -g_malloc0(sizeof(T))
          +g_new0(T, 1)
          @@
          type T;
          @@
          -g_try_malloc0(sizeof(T))
          +g_try_new0(T, 1)
          @@
          type T;
          expression n;
          @@
          -g_malloc(sizeof(T) * (n))
          +g_new(T, n)
          @@
          type T;
          expression n;
          @@
          -g_try_malloc(sizeof(T) * (n))
          +g_try_new(T, n)
          @@
          type T;
          expression n;
          @@
          -g_malloc0(sizeof(T) * (n))
          +g_new0(T, n)
          @@
          type T;
          expression n;
          @@
          -g_try_malloc0(sizeof(T) * (n))
          +g_try_new0(T, n)
          @@
          type T;
          expression p, n;
          @@
          -g_realloc(p, sizeof(T) * (n))
          +g_renew(T, p, n)
          @@
          type T;
          expression p, n;
          @@
          -g_try_realloc(p, sizeof(T) * (n))
          +g_try_renew(T, p, n)
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      5839e53b
  8. 01 7月, 2014 4 次提交
    • J
      block: add backing-file option to block-stream · 13d8cc51
      Jeff Cody 提交于
      On some image chains, QEMU may not always be able to resolve the
      filenames properly, when updating the backing file of an image
      after a block job.
      
      For instance, certain relative pathnames may fail, or drives may
      have been specified originally by file descriptor (e.g. /dev/fd/???),
      or a relative protocol pathname may have been used.
      
      In these instances, QEMU may lack the information to be able to make
      the correct choice, but the user or management layer most likely does
      have that knowledge.
      
      With this extension to the block-stream api, the user is able to change
      the backing file of the active layer as part of the block-stream
      operation.
      
      This allows the change to be 'safe', in the sense that if the attempt
      to write the active image metadata fails, then the block-stream
      operation returns failure, without disrupting the guest.
      
      If a backing file string is not specified in the command, the backing
      file string to use is determined in the same manner as it was
      previously.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      13d8cc51
    • J
      block: extend block-commit to accept a string for the backing file · 54e26900
      Jeff Cody 提交于
      On some image chains, QEMU may not always be able to resolve the
      filenames properly, when updating the backing file of an image
      after a block commit.
      
      For instance, certain relative pathnames may fail, or drives may
      have been specified originally by file descriptor (e.g. /dev/fd/???),
      or a relative protocol pathname may have been used.
      
      In these instances, QEMU may lack the information to be able to make
      the correct choice, but the user or management layer most likely does
      have that knowledge.
      
      With this extension to the block-commit api, the user is able to change
      the backing file of the overlay image as part of the block-commit
      operation.
      
      This allows the change to be 'safe', in the sense that if the attempt
      to write the overlay image metadata fails, then the block-commit
      operation returns failure, without disrupting the guest.
      
      If the commit top is the active layer, then specifying the backing
      file string will be treated as an error (there is no overlay image
      to modify in that case).
      
      If a backing file string is not specified in the command, the backing
      file string to use is determined in the same manner as it was
      previously.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      54e26900
    • J
      block: add QAPI command to allow live backing file change · fa40e656
      Jeff Cody 提交于
      This allows a user to make a live change to the backing file recorded in
      an open image.
      
      The image file to modify can be specified 2 ways:
      
      1) image filename
      2) image node-name
      
      Note: this does not cause the backing file itself to be reopened; it
      merely changes the backing filename in the image file structure, and
      in internal BDS structures.
      
      It is the responsibility of the user to pass a filename string that
      can be resolved when the image chain is reopened, and the filename
      string is not validated.
      
      A good analogy for this command is that it is a live version of
      'qemu-img rebase -u', with respect to changing the backing file string.
      
      [Jeff is offline so I respun this patch in his absence.  Dropped image
      filename since using node-name is preferred and this is a new command.
      No need to introduce the limitations of finding images by filename.
      --Stefan]
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      fa40e656
    • J
      block: make 'top' argument to block-commit optional · 7676e2c5
      Jeff Cody 提交于
      Now that active layer block-commit is supported, the 'top' argument
      no longer needs to be mandatory.
      
      Change it to optional, with the default being the active layer in the
      device chain.
      
      [kwolf: Rebased and resolved conflict in tests/qemu-iotests/040]
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NBenoit Canet <benoit@irqsave.net>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      7676e2c5
  9. 28 6月, 2014 1 次提交
  10. 27 6月, 2014 2 次提交
  11. 23 6月, 2014 1 次提交
  12. 16 6月, 2014 3 次提交