Received: from eggs.gnu.org ([2001:4830:134:3::10]:34215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRVfP-0000EB-QW for qemu-devel@nongnu.org; Sun, 24 Jul 2016 22:30:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bRVfJ-0002nY-Nv for qemu-devel@nongnu.org; Sun, 24 Jul 2016 22:30:50 -0400 Received: from indium.canonical.com ([91.189.90.7]:50818) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRVfJ-0002nQ-EO for qemu-devel@nongnu.org; Sun, 24 Jul 2016 22:30:45 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.76 #1 (Debian)) id 1bRVfI-0000L5-GV for ; Mon, 25 Jul 2016 02:30:44 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 526302E80C2 for ; Mon, 25 Jul 2016 02:30:44 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Mon, 25 Jul 2016 02:25:24 -0000 From: lisiheng Reply-To: Bug 1605506 <1605506@bugs.launchpad.net> Sender: bounces@canonical.com References: <20160722071222.4694.55918.malonedeb@wampee.canonical.com> Message-Id: <20160725022525.11419.76607.launchpad@soybean.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 1605506] Re: qemu driver_mirror error "Operation not permitted" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org ** Tags added: qemu -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1605506 Title: qemu driver_mirror error "Operation not permitted" Status in QEMU: New Bug description: I use libvirtd to call qemu drive_mirror return error message "Operation = not permitted", But directly run qemu and call drive_mirror is OK; when drive_mirror target is logic device return error message "Operation = not permitted",But the file is OK; Operating Environment=EF=BC=9A OS:ubuntu 14.04 kernel:3.16.0-28-generic libvirt-bin version: 1.2.2-0ubuntu13.1.17 qemu:2.5.0 or 2.6.0 run vm user: root =EF=BC=88retry in redhat7.2 have the same problem=EF=BC=81=EF=BC=89 Here is my running process: libvirtd call prepare libvirt xml libvirt.xml i-745F35DC 65536 1 hvm destroy restart destroy /usr/local/qemu-2.5.0-20160720/bin/qemu-system-x86_64 bc-system virsh create libvirt.xml root@test:/opt/run/instance/i-745F35DC# virsh list Id Name State ---------------------------------------------------- 2 i-745F35DC running call drive_mirror: virsh qemu-monitor-command --hmp i-745F35DC 'drive_mirror -n -f drive-ide= 0-0-0 /dev/vg_bc_local/test raw' Could not open '/dev/vg_bc_local/test': Operation not permitted directly run qemu and call drive_mirror: /usr/local/qemu-2.5.0-20160720/bin/qemu-system-x86_64 -hda /tmp/image.raw= -m 64 --enable-kvm -vnc :51 -monitor stdio QEMU 2.5.0 monitor - type 'help' for more information (qemu) info block ide0-hd0 (#block135): /tmp/image.raw (raw) Cache mode: writeback (qemu) drive_mirror -n -f ide0-hd0 /dev/vg_bc_local/test raw (qemu) info block-jobs Type mirror, device ide0-hd0: Completed 41126400 of 41126400 bytes, speed= limit 0 bytes/s (qemu) block_job_cancel ide0-hd0 (qemu) info block-jobs No active jobs It is OK!!! = Here is my debugging process: Recompile qemu-2.5.0 to enable debug ../configure --prefix=3D/usr/local/qemu-2.5.0-20160720 --enable-trace-bac= kend=3Dsimple --enable-werror --disable-xen --disable-virtfs --enable-kvm -= -enable-seccomp --enable-docs --enable-debug-tcg --enable-vnc-sasl --enable= -linux-aio --enable-lzo --enable-snappy --enable-usb-redir --enable-vnc-png= --disable-vnc-jpeg --enable-uuid --disable-vhost-scsi --enable-rbd --block= -drv-rw-whitelist=3Dqcow2,raw,file,host_device,blkdebug,nbd,iscsi,rbd,cdp -= -block-drv-ro-whitelist=3Dvmdk,vhdx,vpc --target-list=3Dx86_64-softmmu CFLA= GS=3D-O0 Use libvirtd to Re-run VM and debug by gdb VM process info: root 7804 1 0 10:45 ? 00:00:10 /usr/local/qemu-2.5.0-201= 60720/bin/qemu-system-x86_64 -name i-745F35DC -S -machine pc-i440fx-2.5,acc= el=3Dkvm,usb=3Doff -cpu Westmere,+invpcid,+erms,+bmi2,+smep,+avx2,+bmi1,+fs= gsbase,+abm,+rdtscp,+pdpe1gb,+rdrand,+f16c,+avx,+osxsave,+xsave,+tsc-deadli= ne,+movbe,+pcid,+pdcm,+xtpr,+fma,+tm2,+est,+vmx,+ds_cpl,+monitor,+dtes64,+p= clmuldq,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme -m 64 -realtime mlock=3Doff -smp 1,= sockets=3D1,cores=3D1,threads=3D1 -uuid ef55dfa6-b82e-488d-a7fc-4c882f8091a= b -no-user-config -nodefaults -chardev socket,id=3Dcharmonitor,path=3D/var/= lib/libvirt/qemu/i-745F35DC.monitor,server,nowait -mon chardev=3Dcharmonito= r,id=3Dmonitor,mode=3Dcontrol -rtc base=3Dlocaltime -no-shutdown -boot stri= ct=3Don -device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 -drive f= ile=3D/tmp/image.raw,if=3Dnone,id=3Ddrive-ide0-0-0,format=3Draw,serial=3Dbc= -system,cache=3Dnone -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0= -0-0,id=3Dide0-0-0,bootindex=3D2 -vnc 0.0.0.0:0,password -k en-us -device c= irrus-vga,id=3Dvideo0,bus=3Dpci.0,addr=3D0x2 -device virtio-balloon-pci,id= =3Dballoon0,bus=3Dpci.0,addr=3D0x3 gdb -p 7804 set breakpoint (gdb) i b Num Type Disp Enb Address What 1 breakpoint keep y 0x00007f51d9e92cb1 in qmp_drive_mirror at= /opt/qemu/qemu-2.5.0/blockdev.c:3310 2 breakpoint keep y 0x00007f51da1252f2 in raw_open_common at = /opt/qemu/qemu-2.5.0/block/raw-posix.c:457 3 breakpoint keep y 0x00007f51da12500f in raw_parse_flags at = /opt/qemu/qemu-2.5.0/block/raw-posix.c:358 (gdb) call drive_mirror and debug: (gdb) raw_open_common (bs=3D0x7f4b27259ab0, options=3D0x7f4b27480290, bdrv_flag= s=3D24674, open_flags=3D0, errp=3D0x7fff4a19f548) at /opt/qemu/qemu-2.5.0/block/raw-posix.c:484 484 s->fd =3D -1; (gdb) n 485 fd =3D qemu_open(filename, s->open_flags, 0644); (gdb) s qemu_open (name=3D0x7f4b2642b5c0 "/dev/vg_bc_local/test", flags=3D2) at /= opt/qemu/qemu-2.5.0/util/osdep.c:177 177 int mode =3D 0; (gdb) n 183 if (strstart(name, "/dev/fdset/", &fdset_id_str)) { (gdb) 214 if (flags & O_CREAT) { (gdb) 223 char arg[1000] =3D {0}; (gdb) 227 ret =3D open(name, flags , mode); (gdb) p name $1 =3D 0x7f4b2642b5c0 "/dev/vg_bc_local/test" (gdb) p flags $2 =3D 2 (gdb) p mode $3 =3D 0 (gdb) n (gdb) p ret $4 =3D -1 get system erroron is :Operation not permitted = !!!!!!!!!!!!!! = Re-run VM Directly and debug by gdb /usr/local/qemu-2.5.0-20160720/bin/qemu-system-x86_64 -hda /tmp/image.raw= -m 64 --enable-kvm -vnc :51 -monitor stdio (qemu) info block ide0-hd0 (#block135): /tmp/image.raw (raw) Cache mode: writeback (qemu) drive_mirror -n -f ide0-hd0 /dev/vg_bc_local/test raw gdb debug: (gdb) i b Num Type Disp Enb Address What 1 breakpoint keep y 0x00007f51d9e92cb1 in qmp_drive_mirror at= /opt/qemu/qemu-2.5.0/blockdev.c:3310 2 breakpoint keep y 0x00007f51da1252f2 in raw_open_common at = /opt/qemu/qemu-2.5.0/block/raw-posix.c:457 3 breakpoint keep y 0x00007f51da12500f in raw_parse_flags at = /opt/qemu/qemu-2.5.0/block/raw-posix.c:358 (gdb) raw_open_common (bs=3D0x7f51dc15d350, options=3D0x7f51dc083110, bdrv_flag= s=3D24642, open_flags=3D0, errp=3D0x7fff5aaa9738) at /opt/qemu/qemu-2.5.0/block/raw-posix.c:484 484 s->fd =3D -1; (gdb) n 485 fd =3D qemu_open(filename, s->open_flags, 0644); (gdb) s qemu_open (name=3D0x7f51dca09230 "/dev/vg_bc_local/test", flags=3D2) at /= opt/qemu/qemu-2.5.0/util/osdep.c:177 177 int mode =3D 0; (gdb) n 183 if (strstart(name, "/dev/fdset/", &fdset_id_str)) { (gdb) 214 if (flags & O_CREAT) { (gdb) 223 char arg[1000] =3D {0}; (gdb) 227 ret =3D open(name, flags , mode); (gdb) p name $1 =3D 0x7f51dca09230 "/dev/vg_bc_local/test" (gdb) p flags $2 =3D 2 (gdb) p mode $3 =3D 0 (gdb) n (gdb) p ret $4 =3D 16 (gdb) To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1605506/+subscriptions