Re: [Qemu-devel] [PATCH 0/2] qemu-img: Let "info" warn and go ahead without -U

2018-01-10 Thread Daniel P. Berrange
On Wed, Jan 10, 2018 at 03:07:12PM +0100, Kevin Wolf wrote:
> Am 10.01.2018 um 13:49 hat Daniel P. Berrange geschrieben:
> > On Mon, Jan 08, 2018 at 03:41:36PM +0100, Kevin Wolf wrote:
> > > Am 05.01.2018 um 07:55 hat Fam Zheng geschrieben:
> > > > Management and users are accustomed to "qemu-img info" to query status 
> > > > of
> > > > images even when they are used by guests. Since image locking was 
> > > > added, the -U
> > > > (--force-share) option is needed for that to work. The reason has been 
> > > > that due
> > > > to possible race with image header update, the output can be misleading.
> > > > 
> > > > But what are likely to happen after we emit the error are that, for 
> > > > interactive
> > > > users, '-U' will be used and the command retried; for management (nova, 
> > > > RHV,
> > > > etc.), the operation is broken with no knob to workaround this.
> > > > 
> > > > This series changes that error to a warning so that it doesn't get in 
> > > > the way.
> > > 
> > > Are management tools actually doing this? There is no good reason to
> > > call 'qemu-img info' for an image that is in use by a VM.
> > 
> > OpenStack will frequently call 'qemu-img info' for disks that are in use by
> > VMs. It is looking at the sizes to understand the relation between the 
> > current
> > size used by qcow2 vs the possible future usage. In this context, it does 
> > not
> > matter if the data is slightly outdated, as it will catch up next time it 
> > reads
> > it a few mins later.
> > 
> > It has been patched to just retry with -U to avoid this error on new
> > QEMU.
> 
> The proper, though somewhat more intrusive fix would be to use QMP
> commands for images of running VMs. You already need to do the same for
> anything modifying the image (to avoid corruption), so I think doing the
> same with 'query-block' instead of 'qemu-img info' for guaranteed
> consistent results on running VMs only makes sense.

The problem with 'query-block' is that you assume the code that is
processing this set of disk images knows which image is used where.

This code in question merely sees a directory full of images, and does
not directly know whether any of them are in use or not. So trying to
use query-block would make it significantly more complex for little
obvious benefit to OpenStack.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [Qemu-devel] [PATCH 0/2] qemu-img: Let "info" warn and go ahead without -U

2018-01-10 Thread Kevin Wolf
Am 10.01.2018 um 13:49 hat Daniel P. Berrange geschrieben:
> On Mon, Jan 08, 2018 at 03:41:36PM +0100, Kevin Wolf wrote:
> > Am 05.01.2018 um 07:55 hat Fam Zheng geschrieben:
> > > Management and users are accustomed to "qemu-img info" to query status of
> > > images even when they are used by guests. Since image locking was added, 
> > > the -U
> > > (--force-share) option is needed for that to work. The reason has been 
> > > that due
> > > to possible race with image header update, the output can be misleading.
> > > 
> > > But what are likely to happen after we emit the error are that, for 
> > > interactive
> > > users, '-U' will be used and the command retried; for management (nova, 
> > > RHV,
> > > etc.), the operation is broken with no knob to workaround this.
> > > 
> > > This series changes that error to a warning so that it doesn't get in the 
> > > way.
> > 
> > Are management tools actually doing this? There is no good reason to
> > call 'qemu-img info' for an image that is in use by a VM.
> 
> OpenStack will frequently call 'qemu-img info' for disks that are in use by
> VMs. It is looking at the sizes to understand the relation between the current
> size used by qcow2 vs the possible future usage. In this context, it does not
> matter if the data is slightly outdated, as it will catch up next time it 
> reads
> it a few mins later.
> 
> It has been patched to just retry with -U to avoid this error on new
> QEMU.

The proper, though somewhat more intrusive fix would be to use QMP
commands for images of running VMs. You already need to do the same for
anything modifying the image (to avoid corruption), so I think doing the
same with 'query-block' instead of 'qemu-img info' for guaranteed
consistent results on running VMs only makes sense.

Kevin



Re: [Qemu-devel] [PATCH 0/2] qemu-img: Let "info" warn and go ahead without -U

2018-01-10 Thread Kashyap Chamarthy
On Mon, Jan 08, 2018 at 03:41:36PM +0100, Kevin Wolf wrote:
> Am 05.01.2018 um 07:55 hat Fam Zheng geschrieben:
> > Management and users are accustomed to "qemu-img info" to query status of
> > images even when they are used by guests. Since image locking was added, 
> > the -U
> > (--force-share) option is needed for that to work. The reason has been that 
> > due
> > to possible race with image header update, the output can be misleading.
> > 
> > But what are likely to happen after we emit the error are that, for 
> > interactive
> > users, '-U' will be used and the command retried; for management (nova, RHV,
> > etc.), the operation is broken with no knob to workaround this.
> > 
> > This series changes that error to a warning so that it doesn't get in the 
> > way.
> 
> Are management tools actually doing this? There is no good reason to
> call 'qemu-img info' for an image that is in use by a VM.

Yes, Nova does use 'qemu-img info' in a few places (haven't audited them
all) for a running guest.  From a quick look at the code, at-least
during Nova's live snaphot (as part of libvirt's "shallow rebase") it is
used.

> If no, NACK. Automatically disabling locking because it can be
> inconvenient defeats the purpose of locking.
> 
> If yes, clearly indicate that this usage is deprecated and we'll turn
> this into an error again with 2.13. Then management tools can be fixed
> in time.

Yes, for completness' sake, Nova upstream is already patched to use the
`qemu-img` '--force-share' flag that comes with QEMU >= 2.10.

-- 
/kashyap



Re: [Qemu-devel] [PATCH 0/2] qemu-img: Let "info" warn and go ahead without -U

2018-01-10 Thread Daniel P. Berrange
On Mon, Jan 08, 2018 at 03:41:36PM +0100, Kevin Wolf wrote:
> Am 05.01.2018 um 07:55 hat Fam Zheng geschrieben:
> > Management and users are accustomed to "qemu-img info" to query status of
> > images even when they are used by guests. Since image locking was added, 
> > the -U
> > (--force-share) option is needed for that to work. The reason has been that 
> > due
> > to possible race with image header update, the output can be misleading.
> > 
> > But what are likely to happen after we emit the error are that, for 
> > interactive
> > users, '-U' will be used and the command retried; for management (nova, RHV,
> > etc.), the operation is broken with no knob to workaround this.
> > 
> > This series changes that error to a warning so that it doesn't get in the 
> > way.
> 
> Are management tools actually doing this? There is no good reason to
> call 'qemu-img info' for an image that is in use by a VM.

OpenStack will frequently call 'qemu-img info' for disks that are in use by
VMs. It is looking at the sizes to understand the relation between the current
size used by qcow2 vs the possible future usage. In this context, it does not
matter if the data is slightly outdated, as it will catch up next time it reads
it a few mins later.

It has been patched to just retry with -U to avoid this error on new
QEMU.

> If no, NACK. Automatically disabling locking because it can be
> inconvenient defeats the purpose of locking.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [Qemu-devel] [PATCH 0/2] qemu-img: Let "info" warn and go ahead without -U

2018-01-08 Thread Kevin Wolf
Am 05.01.2018 um 07:55 hat Fam Zheng geschrieben:
> Management and users are accustomed to "qemu-img info" to query status of
> images even when they are used by guests. Since image locking was added, the 
> -U
> (--force-share) option is needed for that to work. The reason has been that 
> due
> to possible race with image header update, the output can be misleading.
> 
> But what are likely to happen after we emit the error are that, for 
> interactive
> users, '-U' will be used and the command retried; for management (nova, RHV,
> etc.), the operation is broken with no knob to workaround this.
> 
> This series changes that error to a warning so that it doesn't get in the way.

Are management tools actually doing this? There is no good reason to
call 'qemu-img info' for an image that is in use by a VM.

If no, NACK. Automatically disabling locking because it can be
inconvenient defeats the purpose of locking.

If yes, clearly indicate that this usage is deprecated and we'll turn
this into an error again with 2.13. Then management tools can be fixed
in time.

Kevin



[Qemu-devel] [PATCH 0/2] qemu-img: Let "info" warn and go ahead without -U

2018-01-04 Thread Fam Zheng
Management and users are accustomed to "qemu-img info" to query status of
images even when they are used by guests. Since image locking was added, the -U
(--force-share) option is needed for that to work. The reason has been that due
to possible race with image header update, the output can be misleading.

But what are likely to happen after we emit the error are that, for interactive
users, '-U' will be used and the command retried; for management (nova, RHV,
etc.), the operation is broken with no knob to workaround this.

This series changes that error to a warning so that it doesn't get in the way.

Fam

Fam Zheng (2):
  qemu-img: Move img_open error reporting to callers
  qemu-img: info: try -U automatically

 qemu-img.c | 129 +
 tests/qemu-iotests/043.out |   6 +--
 tests/qemu-iotests/153.out |   3 +-
 3 files changed, 88 insertions(+), 50 deletions(-)

-- 
2.14.3