qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-block] [PATCH v1 0/6] Report format specific info for LUKS block d


From: Daniel P. Berrange
Subject: [Qemu-block] [PATCH v1 0/6] Report format specific info for LUKS block driver
Date: Tue, 7 Jun 2016 11:11:09 +0100

The 'qemu-img info' tool has ability to print format specific
information, eg with qcow2 it reports two extra items:

  $ qemu-img info ~/VirtualMachines/demo.qcow2
  image: /home/berrange/VirtualMachines/demo.qcow2
  file format: qcow2
  virtual size: 3.0G (3221225472 bytes)
  disk size: 140K
  cluster_size: 65536
  Format specific information:
      compat: 0.10
      refcount bits: 16


This is not currently wired up for the LUKS driver. This patch
series adds that support so that we can report useful data about
the LUKS volume such as the crypto algorithm choices, key slot
usage and other volume metadata.

The first patch extends the crypto API to allow querying of the
format specific metadata

The second patches extends the block API to allow the LUKS driver
to report the format specific metadata.

    $ qemu-img info ~/VirtualMachines/demo.luks
    image: /home/berrange/VirtualMachines/demo.luks
    file format: luks
    virtual size: 98M (102760448 bytes)
    disk size: 100M
    encrypted: yes
    Format specific information:
        cipher-alg: aes-128
        cipher-mode: xts
        ivgen-alg: plain64
        hash-alg: sha1
        payload-offset: 2097152
        master-key-iters: 142375
        uuid: 6ddee74b-3a22-408c-8909-6789d4fa2594
        slots:
            [0]:
                active: true
                iters: 572706
                stripes: 4000
                key-offset: 8
            [1]:
                active: false
                iters: 0
                stripes: 4000
                key-offset: 264
            [2]:
                active: false
                iters: 0
                stripes: 4000
                key-offset: 520
            [3]:
                active: false
                iters: 0
                stripes: 4000
                key-offset: 776
            [4]:
                active: false
                iters: 0
                stripes: 4000
                key-offset: 1032
            [5]:
                active: false
                iters: 0
                stripes: 4000
                key-offset: 1288
            [6]:
                active: false
                iters: 0
                stripes: 4000
                key-offset: 1544
            [7]:
                active: false
                iters: 0
                stripes: 4000
                key-offset: 1800

The remaining 4 patches are improvements to QAPI and the core
block layer to fix a problem whereby struct fields are output
in (apparently) random ordering. This is because the QAPI type
is converted into a QObject for pretty-printing, thus throwing
away any struct field ordering information.

To address this I created a new TextOutputVisitor which can
directly pretty-print QAPI types. I then changed the code
generator to create qapi_stringify_TYPENAME() methods for
all QAPI types. Finally I changed the block layer over to
use this stringify approach instead.

I'm not sure if QAPI maintainers will find the idea of adding
qapi_stringify_TYPENAME() methods desirable or not. It is of
course valid to directly use the TextOutputVisitor from the
block layer. I felt there might be some use in debugging to
have a convenient qapi_stringify_TYPENAME() method around
though - personally I often find it helpful to be able to
easily dump an QAPI object or any QObject to a humand friendly
format for debugging and the less code I need write to add
this temporary debug output the better.

Daniel P. Berrange (6):
  crypto: add support for querying parameters for block encryption
  block: export LUKS specific data to qemu-img info
  qapi: assert that visitor impls have required callbacks
  qapi: add a text output visitor for pretty printing types
  qapi: generate a qapi_stringify_TYPENAME method for all types
  block: convert to use qapi_stringify_ImageInfoSpecific

 block/crypto.c                     |  80 +++++++++++++
 block/qapi.c                       | 101 +---------------
 crypto/block-luks.c                |  66 ++++++++++-
 crypto/block.c                     |  17 +++
 crypto/blockpriv.h                 |   4 +
 include/crypto/block.h             |  16 +++
 include/qapi/text-output-visitor.h |  73 ++++++++++++
 include/qapi/visitor-impl.h        |   5 +-
 include/qapi/visitor.h             |   5 +-
 qapi/Makefile.objs                 |   1 +
 qapi/block-core.json               |  34 +++++-
 qapi/crypto.json                   |  65 ++++++++++
 qapi/opts-visitor.c                |   5 +-
 qapi/qapi-dealloc-visitor.c        |   4 +-
 qapi/qapi-visit-core.c             |  24 +++-
 qapi/qmp-input-visitor.c           |   5 +-
 qapi/qmp-output-visitor.c          |   4 +-
 qapi/string-input-visitor.c        |   5 +-
 qapi/string-output-visitor.c       |   5 +-
 qapi/text-output-visitor.c         | 235 +++++++++++++++++++++++++++++++++++++
 scripts/qapi-types.py              |  45 +++++++
 scripts/qapi-visit.py              |   5 +-
 22 files changed, 682 insertions(+), 122 deletions(-)
 create mode 100644 include/qapi/text-output-visitor.h
 create mode 100644 qapi/text-output-visitor.c

-- 
2.5.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]