1. 03 8月, 2013 1 次提交
  2. 27 7月, 2013 6 次提交
    • S
      misc: Use g_assert_not_reached for code which is expected to be unreachable · dfc6f865
      Stefan Weil 提交于
      The macro g_assert_not_reached is a better self documenting replacement
      for assert(0) or assert(false).
      Signed-off-by: NStefan Weil <sw@weilnetz.de>
      Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
      dfc6f865
    • I
      Implement sync modes for drive-backup. · fc5d3f84
      Ian Main 提交于
      This patch adds sync-modes to the drive-backup interface and
      implements the FULL, NONE and TOP modes of synchronization.
      
      FULL performs as before copying the entire contents of the drive
      while preserving the point-in-time using CoW.
      NONE only copies new writes to the target drive.
      TOP copies changes to the topmost drive image and preserves the
      point-in-time using CoW.
      
      For sync mode TOP are creating a new target image using the same backing
      file as the original disk image.  Then any new data that has been laid
      on top of it since creation is copied in the main backup_run() loop.
      There is an extra check in the 'TOP' case so that we don't bother to copy
      all the data of the backing file as it already exists in the target.
      This is where the bdrv_co_is_allocated() is used to determine if the
      data exists in the topmost layer or below.
      
      Also any new data being written is intercepted via the write_notifier
      hook which ends up calling backup_do_cow() to copy old data out before
      it gets overwritten.
      
      For mode 'NONE' we create the new target image and only copy in the
      original data from the disk image starting from the time the call was
      made.  This preserves the point in time data by only copying the parts
      that are *going to change* to the target image.  This way we can
      reconstruct the final image by checking to see if the given block exists
      in the new target image first, and if it does not, you can get it from
      the original image.  This is basically an optimization allowing you to
      do point-in-time snapshots with low overhead vs the 'FULL' version.
      
      Since there is no old data to copy out the loop in backup_run() for the
      NONE case just calls qemu_coroutine_yield() which only wakes up after
      an event (usually cancel in this case).  The rest is handled by the
      before_write notifier which again calls backup_do_cow() to write out
      the old data so it can be preserved.
      Signed-off-by: NIan Main <imain@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      fc5d3f84
    • K
      blockdev: Split up 'cache' option · 29c4e2b5
      Kevin Wolf 提交于
      The old 'cache' option really encodes three different boolean flags into
      a cache mode name, without providing all combinations. Make them three
      separate options instead and translate the old option to the new ones
      for drive_init().
      
      The specific boolean options take precedence if the old cache option is
      specified as well, so the following options are equivalent:
      
      -drive file=x,cache=none,cache.no-flush=true
      -drive file=x,cache.writeback=true,cache.direct=true,cache.no-flush=true
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      29c4e2b5
    • K
      blockdev: Rename 'readonly' option to 'read-only' · 0f227a94
      Kevin Wolf 提交于
      Option name cleanup before it becomes a QMP API.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      0f227a94
    • K
      blockdev: Rename I/O throttling options for QMP · 57975222
      Kevin Wolf 提交于
      In QMP, we want to use dashes instead of underscores in QMP argument
      names, and use nested options for throttling.
      
      The new option names affect the command line as well, but for
      compatibility drive_init() will convert the old option names before
      calling into the code that will be shared between -drive and
      blockdev-add.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      57975222
    • K
      block: Allow "driver" option on the top level · 74fe54f2
      Kevin Wolf 提交于
      This is traditionally -drive format=..., which is now translated into
      the new driver option. This gives us a more consistent way to select the
      driver of BlockDriverStates that can be used in QMP context, too.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      74fe54f2
  3. 15 7月, 2013 1 次提交
    • S
      blockdev: add sync mode to drive-backup QMP command · b53169ea
      Stefan Hajnoczi 提交于
      The drive-backup command is similar to the drive-mirror command, except
      no guest data written after the command executes gets copied.  Add a
      sync mode argument which determines whether the entire disk is copied,
      just allocated clusters, or only clusters being written to by the guest.
      
      Currently only sync mode 'full' is supported - it copies the entire disk.
      For read-only point-in-time snapshots we may only need sync mode 'none'
      since the target can be a qcow2 file using the guest's disk as its
      backing file (no need to copy the entire disk).  Finally, sync mode
      'top' is useful if we wish to preserve the backing chain.
      
      Note that this patch just adds the sync mode argument to drive-backup.
      It does not implement sync modes 'top' or 'none'.  This patch is
      necessary so we can add a drive-backup HMP command that behaves like the
      existing drive-mirror HMP command and takes a sync mode.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      b53169ea
  4. 28 6月, 2013 7 次提交
  5. 24 6月, 2013 1 次提交
  6. 17 6月, 2013 1 次提交
  7. 05 6月, 2013 1 次提交
    • S
      blockdev: reset werror/rerror on drive_del · 293c51a6
      Stefan Hajnoczi 提交于
      Paolo Bonzini <pbonzini@redhat.com> suggested the following test case:
      
      1. Launch a guest and wait at the GRUB boot menu:
      
        qemu-system-x86_64 -enable-kvm -m 1024 \
         -drive if=none,cache=none,file=test.img,id=foo,werror=stop,rerror=stop
         -device virtio-blk-pci,drive=foo,id=virtio0,addr=4
      
      2. Hot unplug the device:
      
        (qemu) drive_del foo
      
      3. Select the first boot menu entry
      
      Without this patch the guest pauses due to ENOMEDIUM.  The guest is
      stuck in a continuous pause loop since the I/O request is retried and
      fails immediately again when the guest is resumed.
      
      With this patch the error is reported to the guest.
      
      Note that this scenario actually happens sometimes during libvirt disk
      hot unplug, where device_del is followed by drive_del.  I/O may still be
      submitted to the drive after drive_del if the guest does not process the
      PCI hot unplug notification.
      Reported-by: NDafna Ron <dron@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      293c51a6
  8. 04 6月, 2013 1 次提交
    • F
      block: add block driver read only whitelist · b64ec4e4
      Fam Zheng 提交于
      We may want to include a driver in the whitelist for read only tasks
      such as diagnosing or exporting guest data (with libguestfs as a good
      example). This patch introduces a readonly whitelist option, and for
      backward compatibility, the old configure option --block-drv-whitelist
      is now an alias to rw whitelist.
      
      Drivers in readonly list is only permitted to open file readonly, and
      returns -ENOTSUP for RW opening.
      
      E.g. To include vmdk readonly, and others read+write:
          ./configure --target-list=x86_64-softmmu \
                      --block-drv-rw-whitelist=qcow2,raw,file,qed \
                      --block-drv-ro-whitelist=vmdk
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      b64ec4e4
  9. 24 5月, 2013 6 次提交
  10. 03 5月, 2013 1 次提交
  11. 26 4月, 2013 1 次提交
  12. 09 4月, 2013 1 次提交
    • P
      hw: move headers to include/ · 0d09e41a
      Paolo Bonzini 提交于
      Many of these should be cleaned up with proper qdev-/QOM-ification.
      Right now there are many catch-all headers in include/hw/ARCH depending
      on cpu.h, and this makes it necessary to compile these files per-target.
      However, fixing this does not belong in these patches.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0d09e41a
  13. 06 4月, 2013 1 次提交
  14. 23 3月, 2013 2 次提交
    • K
      block: Allow omitting the file name when using driver-specific options · c2ad1b0c
      Kevin Wolf 提交于
      After this patch, using -drive with an empty file name continues to open
      the file if driver-specific options are used. If no driver-specific
      options are specified, the semantics stay as it was: It defines a drive
      without an inserted medium.
      
      In order to achieve this, bdrv_open() must be made safe to work with a
      NULL filename parameter. The assumption that is made is that only block
      drivers which implement bdrv_parse_filename() support using driver
      specific options and could therefore work without a filename. These
      drivers must make sure to cope with NULL in their implementation of
      .bdrv_open() (this is only NBD for now). For all other drivers, the
      block layer code will make sure to error out before calling into their
      code - they can't possibly work without a filename.
      
      Now an NBD connection can be opened like this:
      
        qemu-system-x86_64 -drive file.driver=nbd,file.port=1234,file.host=::1
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      c2ad1b0c
    • P
      block: complete all IOs before resizing a device · 92b7a08d
      Peter Lieven 提交于
      this patch ensures that all pending IOs are completed
      before a device is resized. this is especially important
      if a device is shrinked as it the bdrv_check_request()
      result is invalidated.
      Signed-off-by: NPeter Lieven <pl@kamp.de>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      92b7a08d
  15. 15 3月, 2013 4 次提交
  16. 23 2月, 2013 4 次提交
  17. 26 1月, 2013 1 次提交