qemu-discuss
[Top][All Lists]
Advanced

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

Re: Permission error when run block-commit


From: Derek
Subject: Re: Permission error when run block-commit
Date: Mon, 24 Feb 2020 18:58:15 +0800

Hi, Max

Thanks for your suggestion.
I'll try it.

I tried to render the block nodes by scripts/render_block_graph.py.
image1: https://imgur.com/ivOSf2h

And, I also created the block nodes like the script
qemu-system-x86_64 \
-name vm -enable-kvm -cpu qemu64,+kvmclock -m 1024 \
-drive 
if=none,id=middle_disk0,driver=qcow2,file.filename=${dir}/middle.qcow2,file.locking=off,\
backing.driver=qcow2,backing.file.filename=${dir}/primary.qcow2,backing.file.locking=off
\
-drive 
if=ide,id=top-disk0,driver=qcow2,file.filename=${dir}/top.qcow2,backing=middle_disk0
\
-qmp stdio \
-qmp unix:/tmp/qmp-sock,server,nowait \
-vnc :0

The block nodes layout is here.
image2: https://imgur.com/1VhPPD0

Is any method to remove "detach" the middle_disk0 Block Backend by qmp
command or qemu internal API, and turn the image1 into image2?

Thanks.
Jing-Wei


Max Reitz <address@hidden> 於 2020年2月24日 週一 下午6:04寫道:
>
> On 24.02.20 08:56, Jing-Wei Su wrote:
> > Hi, all
> >
> > I was trying to do block-commit, and the disk layout is the following 
> > diagram.
> >
> >         +----------------------+
> >          |      top-disk         |
> >          +---------------------+
> >                     | (backing)
> >         +----------------------+
> >          |     middle-disk    |
> >          +---------------------+
> >                     | (backing)
> >         +----------------------+
> >          |      base-disk      |
> >          +---------------------+
> >
> > The script for running the vm is
> > qemu-system-x86_64 -name vm -enable-kvm -cpu qemu64,+kvmclock -m 1024 \
> > -drive 
> > if=none,id=middle_disk0,driver=qcow2,file.filename=${dir}/middle.qcow2,file.locking=off,\
> > backing.driver=qcow2,backing.file.filename=${dir}/down.qcow2,backing.file.locking=off
> > \
> > -drive 
> > if=ide,id=top-disk0,driver=qcow2,file.filename=${dir}/top.qcow2,backing=middle_disk0
> > \
> > -qmp stdio -vnc :0
> >
> > After booting the vm, I issued the block-commit command:
> > {
> >     "execute": "block-commit",
> >     "arguments": {
> >         "device": "top-disk0",
> >         "job-id": "job0",
> >         "top": "/mnt/NFV/qemu/top.qcow2",
> >         "base": "/mnt/NFV/qemu/down.qcow2"
> >     }
> > }
> >
> > But, I got the ERROR
> > {"error": {"class": "GenericError", "desc": "Conflicts with use by
> > middle_disk0 as 'root', which uses 'consistent read' on #block116"}}
> >
> > I cannot figure out what makes this ERROR.
> > Is any idea about the root cause and how to solve the error?
>
> You cannot commit from top to base while there is something attached to
> the middle.  That “something” here is “middle_disk0”, as the error
> message explains.  (Yes, you specify if=none, but that doesn’t change
> the fact that -drive always creates what’s called a BlockBackend that
> appears as a user of the given block device.)
>
> If you want to build block graphs in separate command-line options, you
> should use -blockdev, like so:
>
> -blockdev node_name=middle_disk0,driver=qcow2,\
> file.driver=file,file.filename=${dir}/middle.qcow2,backing.driver=qcow2,\
> backing.file.driver=file,backing.file.filename=${dir}/down.qcow2
>
> (Instead of the -drive if=none above)
>
> You can also use JSON:
>
> -blockdev '{"node-name": "middle_disk0", "driver": "qcow2",
>             "file": { "driver": "file",
>                       "filename": "${dir}/middle.qcow2" },
>             "backing": {
>                 "driver": "qcow2",
>                 "file": { "driver": "file",
>                           "filename": "${dir}/down.qcow2" }
>             } }'
>
> Hope that helps,
>
> Max
>



reply via email to

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