1. 15 11月, 2013 1 次提交
  2. 14 11月, 2013 1 次提交
    • F
      block: Print its file name if backing file opening failed · b04b6b6e
      Fam Zheng 提交于
      If backing file doesn't exist, the error message is confusing and
      misleading:
      
          $ qemu /tmp/a.qcow2
          qemu: could not open disk image /tmp/a.qcow2: Could not open file: No
          such file or directory
      
      But...
      
          $ ls /tmp/a.qcow2
          /tmp/a.qcow2
      
          $ qemu-img info /tmp/a.qcow2
          image: /tmp/a.qcow2
          file format: qcow2
          virtual size: 8.0G (8589934592 bytes)
          disk size: 196K
          cluster_size: 65536
          backing file: /tmp/b.qcow2
      
      Because...
      
          $ ls /tmp/b.qcow2
          ls: cannot access /tmp/b.qcow2: No such file or directory
      
      This is not intuitive. It's better to have the missing file's name in
      the error message. With this patch:
      
          $ qemu-io -c 'read 0 512' /tmp/a.qcow2
          qemu-io: can't open device /tmp/a.qcow2: Could not open backing
          file: Could not open '/stor/vm/arch.raw': No such file or directory
          no file open, try 'help open'
      
      Which is a little bit better.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      b04b6b6e
  3. 08 11月, 2013 1 次提交
  4. 07 11月, 2013 1 次提交
  5. 29 10月, 2013 3 次提交
    • K
      block: Avoid unecessary drv->bdrv_getlength() calls · b94a2610
      Kevin Wolf 提交于
      The block layer generally keeps the size of an image cached in
      bs->total_sectors so that it doesn't have to perform expensive
      operations to get the size whenever it needs it.
      
      This doesn't work however when using a backend that can change its size
      without qemu being aware of it, i.e. passthrough of removable media like
      CD-ROMs or floppy disks. For this reason, the caching is disabled when a
      removable device is used.
      
      It is obvious that checking whether the _guest_ device has removable
      media isn't the right thing to do when we want to know whether the size
      of the host backend can change. To make things worse, non-top-level
      BlockDriverStates never have any device attached, which makes qemu
      assume they are removable, so drv->bdrv_getlength() is always called on
      the protocol layer. In the case of raw-posix, this causes unnecessary
      lseek() system calls, which turned out to be rather expensive.
      
      This patch completely changes the logic and disables bs->total_sectors
      caching only for certain block driver types, for which a size change is
      expected: host_cdrom and host_floppy on POSIX, host_device on win32; also
      the raw format in case it sits on top of one of these protocols, but in
      the common case the nested bdrv_getlength() call on the protocol driver
      will use the cache again and avoid an expensive drv->bdrv_getlength()
      call.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      b94a2610
    • T
      block: Disable BDRV_O_COPY_ON_READ for the backing file · 87a5debd
      Thibaut LAURENT 提交于
      Since commit 0ebd24e0,
      bdrv_open_common will throw an error when trying to open a file
      read-only with the BDRV_O_COPY_ON_READ flag set.
      Although BDRV_O_RDWR is unset for the backing files,
      BDRV_O_COPY_ON_READ is still passed on if copy-on-read was requested
      for the drive. Let's unset this flag too before opening the backing
      file, or bdrv_open_common will fail.
      Signed-off-by: NThibaut LAURENT <thibaut.laurent@gmail.com>
      Reviewed-by: NBenoit Canet <benoit@irqsave.net>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      87a5debd
    • M
      block: Don't copy backing file name on error · 61ed2684
      Max Reitz 提交于
      bdrv_open_backing_file() tries to copy the backing file name using
      pstrcpy directly after calling bdrv_open() to open the backing file
      without checking whether that was actually successful. If it was not,
      ps->backing_hd->file will probably be NULL and qemu will crash.
      
      Fix this by moving pstrcpy after checking whether bdrv_open() succeeded.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NBenoit Canet <benoit@irqsave.net>
      Reviewed-by: Amos_沧海桑田's avatarAmos Kong <kongjianjun@gmail.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      61ed2684
  6. 11 10月, 2013 5 次提交
  7. 07 10月, 2013 1 次提交
  8. 02 10月, 2013 1 次提交
  9. 26 9月, 2013 1 次提交
  10. 25 9月, 2013 5 次提交
  11. 21 9月, 2013 1 次提交
  12. 12 9月, 2013 5 次提交
  13. 06 9月, 2013 14 次提交