1. 17 3月, 2015 7 次提交
    • M
      iotests: Add tests for refcount table growth · 0e8a3714
      Max Reitz 提交于
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 1423598552-24301-3-git-send-email-mreitz@redhat.com
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      0e8a3714
    • M
      qcow2: Respect new_block in alloc_refcount_block() · 14a58a4e
      Max Reitz 提交于
      When choosing a new place for the refcount table, alloc_refcount_block()
      tries to infer the number of clusters used so far from its argument
      cluster_index (which comes from the idea that if any cluster with an
      index greater than cluster_index was in use, the refcount table would
      have to be big enough already to describe cluster_index).
      
      However, there is a cluster that may be at or after cluster_index, and
      which is not covered by the refcount structures, and that is the new
      refcount block new_block. Therefore, it should be taken into account for
      the blocks_used calculation.
      
      Also, because new_block already describes (or is intended to describe)
      cluster_index, we may not put the new refcount structures there.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 1423598552-24301-2-git-send-email-mreitz@redhat.com
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      14a58a4e
    • M
      qemu-img: Avoid qerror_report_err() outside QMP handlers, again · 2867ce4a
      Markus Armbruster 提交于
      qerror_report_err() is a transitional interface to help with
      converting existing monitor commands to QMP.  It should not be used
      elsewhere.  Replace by error_report_err().
      
      Commit 6936f299 cleaned that up in qemu-img.c, but two calls have crept
      in since.  Take care of them the same way.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      2867ce4a
    • M
      block: Fix block-set-write-threshold not to use funky error class · 6ec46ad5
      Markus Armbruster 提交于
      Error classes are a leftover from the days of "rich" error objects.
      New code should always use ERROR_CLASS_GENERIC_ERROR.  Commit e2462113
      added a use of ERROR_CLASS_DEVICE_NOT_FOUND.  Replace it.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      6ec46ad5
    • M
      block: Deprecate QCOW/QCOW2 encryption · a1f688f4
      Markus Armbruster 提交于
      We've steered users away from QCOW/QCOW2 encryption for a while,
      because it's a flawed design (commit 136cd19d Describe flaws in
      qcow/qcow2 encryption in the docs).
      
      In addition to flawed crypto, we have comically bad usability, and
      plain old bugs.  Let me show you.
      
      = Example images =
      
      I'm going to use a raw image as backing file, and two QCOW2 images,
      one encrypted, and one not:
      
          $ qemu-img create -f raw backing.img 4m
          Formatting 'backing.img', fmt=raw size=4194304
          $ qemu-img create -f qcow2 -o encryption,backing_file=backing.img,backing_fmt=raw geheim.qcow2 4m
          Formatting 'geheim.qcow2', fmt=qcow2 size=4194304 backing_file='backing.img' backing_fmt='raw' encryption=on cluster_size=65536 lazy_refcounts=off
          $ qemu-img create -f qcow2 -o backing_file=backing.img,backing_fmt=raw normal.qcow2 4m
          Formatting 'normal.qcow2', fmt=qcow2 size=4194304 backing_file='backing.img' backing_fmt='raw' encryption=off cluster_size=65536 lazy_refcounts=off
      
      = Usability issues =
      
      == Confusing startup ==
      
      When no image is encrypted, and you don't give -S, QEMU starts the
      guest immediately:
      
          $ qemu-system-x86_64 -nodefaults -display none -monitor stdio normal.qcow2
          QEMU 2.2.50 monitor - type 'help' for more information
          (qemu) info status
          VM status: running
      
      But as soon as there's an encrypted image in play, the guest is *not*
      started, with no notification whatsoever:
      
          $ qemu-system-x86_64 -nodefaults -display none -monitor stdio geheim.qcow2
          QEMU 2.2.50 monitor - type 'help' for more information
          (qemu) info status
          VM status: paused (prelaunch)
      
      If the user figured out that he needs to type "cont" to enter his
      keys, the confusion enters the next level: "cont" asks for at most
      *one* key.  If more are needed, it then silently does nothing.  The
      user has to type "cont" once per encrypted image:
      
          $ qemu-system-x86_64 -nodefaults -display none -monitor stdio -drive if=none,file=geheim.qcow2 -drive if=none,file=geheim.qcow2
          QEMU 2.2.50 monitor - type 'help' for more information
          (qemu) info status
          VM status: paused (prelaunch)
          (qemu) c
          none0 (geheim.qcow2) is encrypted.
          Password: ******
          (qemu) info status
          VM status: paused (prelaunch)
          (qemu) c
          none1 (geheim.qcow2) is encrypted.
          Password: ******
          (qemu) info status
          VM status: running
      
      == Incorrect passwords not caught ==
      
      All existing encryption schemes give you the GIGO treatment: garbage
      password in, garbage data out.  Guests usually refuse to mount
      garbage, but other usage is prone to data loss.
      
      == Need to stop the guest to add an encrypted image ==
      
          $ qemu-system-x86_64 -nodefaults -display none -monitor stdio
          QEMU 2.2.50 monitor - type 'help' for more information
          (qemu) info status
          VM status: running
          (qemu) drive_add "" if=none,file=geheim.qcow2
          Guest must be stopped for opening of encrypted image
          (qemu) stop
          (qemu) drive_add "" if=none,file=geheim.qcow2
          OK
      
      Commit c3adb58f added this restriction.  Before, we could expose images
      lacking an encryption key to guests, with potentially catastrophic
      results.  See also "Use without key is not always caught".
      
      = Bugs =
      
      == Use without key is not always caught ==
      
      Encrypted images can be in an intermediate state "opened, but no key".
      The weird startup behavior and the need to stop the guest are there to
      ensure the guest isn't exposed to that state.  But other things still
      are!
      
      * drive_backup
      
          $ qemu-system-x86_64 -nodefaults -display none -monitor stdio geheim.qcow2
          QEMU 2.2.50 monitor - type 'help' for more information
          (qemu) drive_backup -f ide0-hd0 out.img raw
          Formatting 'out.img', fmt=raw size=4194304
      
        I guess this writes encrypted data to raw image out.img.  Good luck
        with figuring out how to decrypt that again.
      
      * commit
      
          $ qemu-system-x86_64 -nodefaults -display none -monitor stdio geheim.qcow2
          QEMU 2.2.50 monitor - type 'help' for more information
          (qemu) commit ide0-hd0
      
        I guess this writes encrypted data into the unencrypted raw backing
        image, effectively destroying it.
      
      == QMP device_add of usb-storage fails when it shouldn't ==
      
      When the image is encrypted, device_add creates the device, defers
      actually attaching it to when the key becomes available, then fails.
      This is wrong.  device_add must either create the device and succeed,
      or do nothing and fail.
      
          $ qemu-system-x86_64 -nodefaults -display none -usb -qmp stdio -drive if=none,id=foo,file=geheim.qcow2
          {"QMP": {"version": {"qemu": {"micro": 50, "minor": 2, "major": 2}, "package": ""}, "capabilities": []}}
          { "execute": "qmp_capabilities" }
          {"return": {}}
          { "execute": "device_add", "arguments": { "driver": "usb-storage", "id": "bar", "drive": "foo" } }
          {"error": {"class": "DeviceEncrypted", "desc": "'foo' (geheim.qcow2) is encrypted"}}
          {"execute":"device_del","arguments": { "id": "bar" } }
          {"timestamp": {"seconds": 1426003440, "microseconds": 237181}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/bar/bar.0/legacy[0]"}}
          {"timestamp": {"seconds": 1426003440, "microseconds": 238231}, "event": "DEVICE_DELETED", "data": {"device": "bar", "path": "/machine/peripheral/bar"}}
          {"return": {}}
      
      This stuff is worse than useless, it's a trap for users.
      
      If people become sufficiently interested in encrypted images to
      contribute a cryptographically sane implementation for QCOW2 (or
      whatever other format), then rewriting the necessary support around it
      from scratch will likely be easier and yield better results than
      fixing up the existing mess.
      
      Let's deprecate the mess now, drop it after a grace period, and move
      on.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      a1f688f4
    • M
      qemu-img: Fix convert, amend error messages for unknown options · 97a2ca7a
      Markus Armbruster 提交于
      Message quality regressed in commit dc523cd3.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      97a2ca7a
    • M
      iotests: Update 051's reference output · 0c304110
      Markus Armbruster 提交于
      Commit c4bacafb improved error reporting, but neglected to update
      051.out.  Commit 2726958d tried to redress, but didn't get it quite
      right (punctuation difference), and shortly after commit
      ae071cc8..master improved error reporting some more, neglecting 051.out
      some more.  Sorry!
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      0c304110
  2. 16 3月, 2015 26 次提交
  3. 14 3月, 2015 6 次提交
  4. 13 3月, 2015 1 次提交