* [Qemu-devel] need to resurrect no-lock option? @ 2017-09-20 9:26 Christian Ehrhardt 2017-09-20 9:51 ` Fam Zheng 2017-09-21 12:33 ` Stefan Hajnoczi 0 siblings, 2 replies; 8+ messages in thread From: Christian Ehrhardt @ 2017-09-20 9:26 UTC (permalink / raw) To: qemu-devel, Fam Zheng Hi, this might have been discussed in the wake of the lock changes that took place in 2.10 but I can't find anything clear enough to follow in the current case. There was an old submission [1] by Fam to make it possible to no-lock qemu-img and others if needed. But it seems nothing like it made it along to the locking we have in 2.10. One (maybe more) case where missing this causes pain is e.g. running an info check on a running guest. In general info shouldn't need a write lock anyway, but without --no-lock that use case is broken. Repro of the case is rather simple: $ qemu-img create -f qcow2 /tmp/test.qcow2 1M $ qemu-system-x86_64 -hda /tmp/test.qcow2 -enable-kvm -nodefaults -nographic & $ qemu-img info /tmp/test.qcow2 qemu-img: Could not open '/tmp/test.qcow2': Failed to get shared "write" lock Is another process using the image? [1]: https://lists.gnu.org/archive/html/qemu-block/2016-04/msg00349.html -- Christian Ehrhardt Software Engineer, Ubuntu Server Canonical Ltd ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] need to resurrect no-lock option? 2017-09-20 9:26 [Qemu-devel] need to resurrect no-lock option? Christian Ehrhardt @ 2017-09-20 9:51 ` Fam Zheng 2017-09-20 10:04 ` Christian Ehrhardt 2017-09-21 12:33 ` Stefan Hajnoczi 1 sibling, 1 reply; 8+ messages in thread From: Fam Zheng @ 2017-09-20 9:51 UTC (permalink / raw) To: Christian Ehrhardt; +Cc: qemu-devel On Wed, 09/20 11:26, Christian Ehrhardt wrote: > Hi, > this might have been discussed in the wake of the lock changes that took > place in 2.10 but I can't find anything clear enough to follow in the > current case. > There was an old submission [1] by Fam to make it possible to no-lock > qemu-img and others if needed. But it seems nothing like it made it along > to the locking we have in 2.10. > > One (maybe more) case where missing this causes pain is e.g. running an > info check on a running guest. > In general info shouldn't need a write lock anyway, but without --no-lock > that use case is broken. The --no-lock option was later revised into --force-share, so... > > Repro of the case is rather simple: > $ qemu-img create -f qcow2 /tmp/test.qcow2 1M > $ qemu-system-x86_64 -hda /tmp/test.qcow2 -enable-kvm -nodefaults > -nographic & > $ qemu-img info /tmp/test.qcow2 > qemu-img: Could not open '/tmp/test.qcow2': Failed to get shared "write" > lock > Is another process using the image? ... you can do this: $ qemu-img info --force-share /tmp/test.qcow2 image: /tmp/test.qcow2 file format: qcow2 virtual size: 1.0M (1048576 bytes) disk size: 196K cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: false refcount bits: 16 corrupt: false Fam ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] need to resurrect no-lock option? 2017-09-20 9:51 ` Fam Zheng @ 2017-09-20 10:04 ` Christian Ehrhardt 0 siblings, 0 replies; 8+ messages in thread From: Christian Ehrhardt @ 2017-09-20 10:04 UTC (permalink / raw) To: Fam Zheng; +Cc: qemu-devel On Wed, Sep 20, 2017 at 11:51 AM, Fam Zheng <famz@redhat.com> wrote: > On Wed, 09/20 11:26, Christian Ehrhardt wrote: > > Hi, > > this might have been discussed in the wake of the lock changes that took > > place in 2.10 but I can't find anything clear enough to follow in the > > current case. > > There was an old submission [1] by Fam to make it possible to no-lock > > qemu-img and others if needed. But it seems nothing like it made it along > > to the locking we have in 2.10. > > > > One (maybe more) case where missing this causes pain is e.g. running an > > info check on a running guest. > > In general info shouldn't need a write lock anyway, but without --no-lock > > that use case is broken. > > The --no-lock option was later revised into --force-share, so... > Thanks for the remapping of this old patch to what it ended up! Test works for me, need to check with other affected cases. > > > Repro of the case is rather simple: > > $ qemu-img create -f qcow2 /tmp/test.qcow2 1M > > $ qemu-system-x86_64 -hda /tmp/test.qcow2 -enable-kvm -nodefaults > > -nographic & > > $ qemu-img info /tmp/test.qcow2 > > qemu-img: Could not open '/tmp/test.qcow2': Failed to get shared "write" > > lock > > Is another process using the image? > > ... you can do this: > > $ qemu-img info --force-share /tmp/test.qcow2 > image: /tmp/test.qcow2 > file format: qcow2 > virtual size: 1.0M (1048576 bytes) > disk size: 196K > cluster_size: 65536 > Format specific information: > compat: 1.1 > lazy refcounts: false > refcount bits: 16 > corrupt: false > > Fam > -- Christian Ehrhardt Software Engineer, Ubuntu Server Canonical Ltd ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] need to resurrect no-lock option? 2017-09-20 9:26 [Qemu-devel] need to resurrect no-lock option? Christian Ehrhardt 2017-09-20 9:51 ` Fam Zheng @ 2017-09-21 12:33 ` Stefan Hajnoczi 2017-09-21 12:43 ` Daniel P. Berrange 1 sibling, 1 reply; 8+ messages in thread From: Stefan Hajnoczi @ 2017-09-21 12:33 UTC (permalink / raw) To: Christian Ehrhardt; +Cc: qemu-devel, Fam Zheng On Wed, Sep 20, 2017 at 11:26:11AM +0200, Christian Ehrhardt wrote: > Hi, > this might have been discussed in the wake of the lock changes that took > place in 2.10 but I can't find anything clear enough to follow in the > current case. > There was an old submission [1] by Fam to make it possible to no-lock > qemu-img and others if needed. But it seems nothing like it made it along > to the locking we have in 2.10. > > One (maybe more) case where missing this causes pain is e.g. running an > info check on a running guest. > In general info shouldn't need a write lock anyway, but without --no-lock > that use case is broken. It's still an invalid use case. There is no guarantee that qemu-img will see a consistent version of the image file. Metadata could change underneath qemu-img because QEMU may still write to it. QEMU may also have some metadata cached so there's no guarantee that qemu-img sees an up-to-date image. Why do you need to run qemu-img on a disk image that is in use? > Repro of the case is rather simple: > $ qemu-img create -f qcow2 /tmp/test.qcow2 1M > $ qemu-system-x86_64 -hda /tmp/test.qcow2 -enable-kvm -nodefaults > -nographic & > $ qemu-img info /tmp/test.qcow2 > qemu-img: Could not open '/tmp/test.qcow2': Failed to get shared "write" > lock > Is another process using the image? > > [1]: https://lists.gnu.org/archive/html/qemu-block/2016-04/msg00349.html > > -- > Christian Ehrhardt > Software Engineer, Ubuntu Server > Canonical Ltd ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] need to resurrect no-lock option? 2017-09-21 12:33 ` Stefan Hajnoczi @ 2017-09-21 12:43 ` Daniel P. Berrange 2017-09-21 12:55 ` Fam Zheng 2017-09-21 13:18 ` Daniel P. Berrange 0 siblings, 2 replies; 8+ messages in thread From: Daniel P. Berrange @ 2017-09-21 12:43 UTC (permalink / raw) To: Stefan Hajnoczi; +Cc: Christian Ehrhardt, Fam Zheng, qemu-devel On Thu, Sep 21, 2017 at 01:33:20PM +0100, Stefan Hajnoczi wrote: > On Wed, Sep 20, 2017 at 11:26:11AM +0200, Christian Ehrhardt wrote: > > Hi, > > this might have been discussed in the wake of the lock changes that took > > place in 2.10 but I can't find anything clear enough to follow in the > > current case. > > There was an old submission [1] by Fam to make it possible to no-lock > > qemu-img and others if needed. But it seems nothing like it made it along > > to the locking we have in 2.10. > > > > One (maybe more) case where missing this causes pain is e.g. running an > > info check on a running guest. > > In general info shouldn't need a write lock anyway, but without --no-lock > > that use case is broken. > > It's still an invalid use case. There is no guarantee that qemu-img > will see a consistent version of the image file. Metadata could change > underneath qemu-img because QEMU may still write to it. QEMU may also > have some metadata cached so there's no guarantee that qemu-img sees an > up-to-date image. > > Why do you need to run qemu-img on a disk image that is in use? You have a directory full of images and you want to understand current usage vs potential future usage. For this you need to get the virtual size, which rquires 'qemu-img info' for non-raw files. Actually it would be even better served by the new 'measure' command recently added. The job analyzing this directory of images may not have any context as to whether each file is in use by a running QEMU, so would just blindly call 'qemu-img info' on each file it finds. There's of course potential that opening the image in 'qemu-img info' could hit problems if the running QEMU changed qcow2 metadata, but generally that would not have serious negative impact and would be self-correcting next time the job analysed the directory. 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 :| ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] need to resurrect no-lock option? 2017-09-21 12:43 ` Daniel P. Berrange @ 2017-09-21 12:55 ` Fam Zheng 2017-09-21 13:18 ` Daniel P. Berrange 1 sibling, 0 replies; 8+ messages in thread From: Fam Zheng @ 2017-09-21 12:55 UTC (permalink / raw) To: Daniel P. Berrange; +Cc: Stefan Hajnoczi, qemu-devel, Christian Ehrhardt On Thu, 09/21 13:43, Daniel P. Berrange wrote: > On Thu, Sep 21, 2017 at 01:33:20PM +0100, Stefan Hajnoczi wrote: > > On Wed, Sep 20, 2017 at 11:26:11AM +0200, Christian Ehrhardt wrote: > > > Hi, > > > this might have been discussed in the wake of the lock changes that took > > > place in 2.10 but I can't find anything clear enough to follow in the > > > current case. > > > There was an old submission [1] by Fam to make it possible to no-lock > > > qemu-img and others if needed. But it seems nothing like it made it along > > > to the locking we have in 2.10. > > > > > > One (maybe more) case where missing this causes pain is e.g. running an > > > info check on a running guest. > > > In general info shouldn't need a write lock anyway, but without --no-lock > > > that use case is broken. > > > > It's still an invalid use case. There is no guarantee that qemu-img > > will see a consistent version of the image file. Metadata could change > > underneath qemu-img because QEMU may still write to it. QEMU may also > > have some metadata cached so there's no guarantee that qemu-img sees an > > up-to-date image. > > > > Why do you need to run qemu-img on a disk image that is in use? > > You have a directory full of images and you want to understand current usage > vs potential future usage. For this you need to get the virtual size, which > rquires 'qemu-img info' for non-raw files. Actually it would be even better > served by the new 'measure' command recently added. > > The job analyzing this directory of images may not have any context as to > whether each file is in use by a running QEMU, so would just blindly call > 'qemu-img info' on each file it finds. There's of course potential that > opening the image in 'qemu-img info' could hit problems if the running QEMU > changed qcow2 metadata, but generally that would not have serious negative > impact and would be self-correcting next time the job analysed the directory. Probably it's helpful to add a hint about "--force-share" the in the error message of "qemu-img info" when hitting an image lock failure? Fam ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] need to resurrect no-lock option? 2017-09-21 12:43 ` Daniel P. Berrange 2017-09-21 12:55 ` Fam Zheng @ 2017-09-21 13:18 ` Daniel P. Berrange 2017-09-22 7:27 ` Kevin Wolf 1 sibling, 1 reply; 8+ messages in thread From: Daniel P. Berrange @ 2017-09-21 13:18 UTC (permalink / raw) To: Stefan Hajnoczi; +Cc: Fam Zheng, qemu-devel, Christian Ehrhardt On Thu, Sep 21, 2017 at 01:43:17PM +0100, Daniel P. Berrange wrote: > On Thu, Sep 21, 2017 at 01:33:20PM +0100, Stefan Hajnoczi wrote: > > On Wed, Sep 20, 2017 at 11:26:11AM +0200, Christian Ehrhardt wrote: > > > Hi, > > > this might have been discussed in the wake of the lock changes that took > > > place in 2.10 but I can't find anything clear enough to follow in the > > > current case. > > > There was an old submission [1] by Fam to make it possible to no-lock > > > qemu-img and others if needed. But it seems nothing like it made it along > > > to the locking we have in 2.10. > > > > > > One (maybe more) case where missing this causes pain is e.g. running an > > > info check on a running guest. > > > In general info shouldn't need a write lock anyway, but without --no-lock > > > that use case is broken. > > > > It's still an invalid use case. There is no guarantee that qemu-img > > will see a consistent version of the image file. Metadata could change > > underneath qemu-img because QEMU may still write to it. QEMU may also > > have some metadata cached so there's no guarantee that qemu-img sees an > > up-to-date image. > > > > Why do you need to run qemu-img on a disk image that is in use? > > You have a directory full of images and you want to understand current usage > vs potential future usage. For this you need to get the virtual size, which > rquires 'qemu-img info' for non-raw files. Actually it would be even better > served by the new 'measure' command recently added. > > The job analyzing this directory of images may not have any context as to > whether each file is in use by a running QEMU, so would just blindly call > 'qemu-img info' on each file it finds. There's of course potential that > opening the image in 'qemu-img info' could hit problems if the running QEMU > changed qcow2 metadata, but generally that would not have serious negative > impact and would be self-correcting next time the job analysed the directory. FYI this scenario has already hit OpenStack with breakage on new QMEU https://bugs.launchpad.net/nova/+bug/1718295 and thus they're just going to add '--force-shared' for all usage of qemu-img info. 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 :| ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] need to resurrect no-lock option? 2017-09-21 13:18 ` Daniel P. Berrange @ 2017-09-22 7:27 ` Kevin Wolf 0 siblings, 0 replies; 8+ messages in thread From: Kevin Wolf @ 2017-09-22 7:27 UTC (permalink / raw) To: Daniel P. Berrange Cc: Stefan Hajnoczi, Fam Zheng, qemu-devel, Christian Ehrhardt Am 21.09.2017 um 15:18 hat Daniel P. Berrange geschrieben: > On Thu, Sep 21, 2017 at 01:43:17PM +0100, Daniel P. Berrange wrote: > > On Thu, Sep 21, 2017 at 01:33:20PM +0100, Stefan Hajnoczi wrote: > > > On Wed, Sep 20, 2017 at 11:26:11AM +0200, Christian Ehrhardt wrote: > > > > Hi, > > > > this might have been discussed in the wake of the lock changes that took > > > > place in 2.10 but I can't find anything clear enough to follow in the > > > > current case. > > > > There was an old submission [1] by Fam to make it possible to no-lock > > > > qemu-img and others if needed. But it seems nothing like it made it along > > > > to the locking we have in 2.10. > > > > > > > > One (maybe more) case where missing this causes pain is e.g. running an > > > > info check on a running guest. > > > > In general info shouldn't need a write lock anyway, but without --no-lock > > > > that use case is broken. > > > > > > It's still an invalid use case. There is no guarantee that qemu-img > > > will see a consistent version of the image file. Metadata could change > > > underneath qemu-img because QEMU may still write to it. QEMU may also > > > have some metadata cached so there's no guarantee that qemu-img sees an > > > up-to-date image. > > > > > > Why do you need to run qemu-img on a disk image that is in use? > > > > You have a directory full of images and you want to understand current usage > > vs potential future usage. For this you need to get the virtual size, which > > rquires 'qemu-img info' for non-raw files. Actually it would be even better > > served by the new 'measure' command recently added. > > > > The job analyzing this directory of images may not have any context as to > > whether each file is in use by a running QEMU, so would just blindly call > > 'qemu-img info' on each file it finds. There's of course potential that > > opening the image in 'qemu-img info' could hit problems if the running QEMU > > changed qcow2 metadata, but generally that would not have serious negative > > impact and would be self-correcting next time the job analysed the directory. > > FYI this scenario has already hit OpenStack with breakage on new QMEU > > https://bugs.launchpad.net/nova/+bug/1718295 > > and thus they're just going to add '--force-shared' for all usage of > qemu-img info. As you know, the information returned by qemu-img with --force-shared is not reliable if a VM is writing to the image. If you're okay with that, you can use it, but I think it's appropriate to require an option for this. If you need something that works reliably with images that are in use, we should be talking about QMP commands instead and libvirt should decide which method needs to be used for each call. Kevin ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-09-22 7:27 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-09-20 9:26 [Qemu-devel] need to resurrect no-lock option? Christian Ehrhardt 2017-09-20 9:51 ` Fam Zheng 2017-09-20 10:04 ` Christian Ehrhardt 2017-09-21 12:33 ` Stefan Hajnoczi 2017-09-21 12:43 ` Daniel P. Berrange 2017-09-21 12:55 ` Fam Zheng 2017-09-21 13:18 ` Daniel P. Berrange 2017-09-22 7:27 ` Kevin Wolf
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).