Am 03.06.2016 um 10:48 hat Fam Zheng geschrieben: > To allow overriding the default locking behavior when opening the image. > > Signed-off-by: Fam Zheng <f...@redhat.com> > --- > qapi/block-core.json | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/qapi/block-core.json b/qapi/block-core.json > index 98a20d2..23ec31d 100644 > --- a/qapi/block-core.json > +++ b/qapi/block-core.json > @@ -2032,6 +2032,20 @@ > '*read-pattern': 'QuorumReadPattern' } } > > ## > +# @BlockdevLockMode > +# > +# Describes how QEMU should lock the image. > +# > +# @off: Disabled > +# @shared: Use shared lock for both RO and RW images. > +# @exclusive: Use exclusive lock for RW images, and shared lock for RO > images.
This feels odd. If I request 'exclusive', I want to have exclusive. Reasons may include that I anticipate reopening the image r/w later for a commit operation and don't want to have this blocked by other readers. I see where you're coming from, though, because this might not be a good default. Perhaps we need to have both then, an 'exclusive' option that does what it promises and a 'default' option that infers the wanted locking mode from the writability of the image. Kevin > +# > +# Since: 2.7 > +## > +{ 'enum': 'BlockdevLockMode', > + 'data': [ 'off', 'shared', 'exclusive' ] } > + > +## > # @BlockdevOptions > # > # Options for creating a block device. Many options are available for all > @@ -2065,6 +2079,8 @@ > # @detect-zeroes: #optional detect and optimize zero writes (Since 2.1) > # (default: off) > # > +# @lock-mode: #optional how to lock the image. (default: exclusive) (Since > 2.7) > +# > # Remaining options are determined by the block driver. > # > # Since: 1.7 > @@ -2082,7 +2098,8 @@ > '*stats-account-invalid': 'bool', > '*stats-account-failed': 'bool', > '*stats-intervals': ['int'], > - '*detect-zeroes': 'BlockdevDetectZeroesOptions' }, > + '*detect-zeroes': 'BlockdevDetectZeroesOptions', > + '*lock-mode': 'BlockdevLockMode' }, > 'discriminator': 'driver', > 'data': { > 'archipelago':'BlockdevOptionsArchipelago', > -- > 2.8.2 >