[Bug 1605506] Re: qemu driver_mirror error "Operation not permitted"

2019-12-22 Thread Launchpad Bug Tracker
[Expired for QEMU because there has been no activity for 60 days.]

** Changed in: qemu
   Status: Incomplete => Expired

-- 
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:
  Expired

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:
  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
  (retry in redhat7.2 have the same problem!)

  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
   IdName   State
  
   2 i-745F35DC running
  call drive_mirror:
  virsh qemu-monitor-command --hmp i-745F35DC 'drive_mirror -n -f 
drive-ide0-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=/usr/local/qemu-2.5.0-20160720 
--enable-trace-backend=simple --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=qcow2,raw,file,host_device,blkdebug,nbd,iscsi,rbd,cdp 
--block-drv-ro-whitelist=vmdk,vhdx,vpc --target-list=x86_64-softmmu CFLAGS=-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-20160720/bin/qemu-system-x86_64 -name i-745F35DC -S 
-machine pc-i440fx-2.5,accel=kvm,usb=off -cpu 
Westmere,+invpcid,+erms,+bmi2,+smep,+avx2,+bmi1,+fsgsbase,+abm,+rdtscp,+pdpe1gb,+rdrand,+f16c,+avx,+osxsave,+xsave,+tsc-deadline,+movbe,+pcid,+pdcm,+xtpr,+fma,+tm2,+est,+vmx,+ds_cpl,+monitor,+dtes64,+pclmuldq,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme
 -m 64 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 
ef55dfa6-b82e-488d-a7fc-4c882f8091ab -no-user-config -nodefaults -chardev 
socket,id=charmonitor,path=/var/lib/libvirt/qemu/i-745F35DC.monitor,server,nowait
 -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime 
-no-shutdown -boot strict=on -device 
piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive 
file=/tmp/image.raw,if=none,id=drive-ide0-0-0,format=raw,serial=bc-system,cache=none
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=2 
-vnc 0.0.0.0:0,password -k en-us -device 
cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device 
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

  gdb -p  7804
  set breakpoint
  (gdb) i b
  Num Type   Disp Enb AddressWhat
  1   breakpoint keep y   0x7f51d9e92cb1 in qmp_drive_mirror at 
/opt/qemu/qemu-2.5.0/blockdev.c:3310
  2   breakpoint keep y   0x7f51da1252f2 in raw_open_common at 
/opt/qemu/qemu-2.5.0/block/raw-posix.c:457
  3   breakpoint keep y   0x7f51da12500f 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=0x7f4b27259ab0, options=0x7f4b27480290, bdrv_flags=24674, 
open_flags=0, errp=0x7fff4a19f548)
  at /opt/qemu/qemu-2.5.0/block/raw-posix.c:484
  484s->fd = -1;
  (gdb) n
  485fd = qemu_open(filename, s->open_flags, 0644);
  (gdb) s
  qemu_open (name=0x7f4b2642b5c0 "/dev/vg_bc_local/test", flags=2) at 
/opt/qemu/qemu-2.5.0/util/osdep.c:177
  177int mode = 0;
  (gdb) n
  183if (strstart(name, "/dev/fdset/", _id_str)) {
 

[Bug 1605506] Re: qemu driver_mirror error "Operation not permitted"

2019-10-23 Thread Thomas Huth
Do you have SELinux or AppArmor or something similar enabled?

** Changed in: qemu
   Status: New => Incomplete

-- 
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:
  Incomplete

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:
  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
  (retry in redhat7.2 have the same problem!)

  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
   IdName   State
  
   2 i-745F35DC running
  call drive_mirror:
  virsh qemu-monitor-command --hmp i-745F35DC 'drive_mirror -n -f 
drive-ide0-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=/usr/local/qemu-2.5.0-20160720 
--enable-trace-backend=simple --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=qcow2,raw,file,host_device,blkdebug,nbd,iscsi,rbd,cdp 
--block-drv-ro-whitelist=vmdk,vhdx,vpc --target-list=x86_64-softmmu CFLAGS=-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-20160720/bin/qemu-system-x86_64 -name i-745F35DC -S 
-machine pc-i440fx-2.5,accel=kvm,usb=off -cpu 
Westmere,+invpcid,+erms,+bmi2,+smep,+avx2,+bmi1,+fsgsbase,+abm,+rdtscp,+pdpe1gb,+rdrand,+f16c,+avx,+osxsave,+xsave,+tsc-deadline,+movbe,+pcid,+pdcm,+xtpr,+fma,+tm2,+est,+vmx,+ds_cpl,+monitor,+dtes64,+pclmuldq,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme
 -m 64 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 
ef55dfa6-b82e-488d-a7fc-4c882f8091ab -no-user-config -nodefaults -chardev 
socket,id=charmonitor,path=/var/lib/libvirt/qemu/i-745F35DC.monitor,server,nowait
 -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime 
-no-shutdown -boot strict=on -device 
piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive 
file=/tmp/image.raw,if=none,id=drive-ide0-0-0,format=raw,serial=bc-system,cache=none
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=2 
-vnc 0.0.0.0:0,password -k en-us -device 
cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device 
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

  gdb -p  7804
  set breakpoint
  (gdb) i b
  Num Type   Disp Enb AddressWhat
  1   breakpoint keep y   0x7f51d9e92cb1 in qmp_drive_mirror at 
/opt/qemu/qemu-2.5.0/blockdev.c:3310
  2   breakpoint keep y   0x7f51da1252f2 in raw_open_common at 
/opt/qemu/qemu-2.5.0/block/raw-posix.c:457
  3   breakpoint keep y   0x7f51da12500f 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=0x7f4b27259ab0, options=0x7f4b27480290, bdrv_flags=24674, 
open_flags=0, errp=0x7fff4a19f548)
  at /opt/qemu/qemu-2.5.0/block/raw-posix.c:484
  484s->fd = -1;
  (gdb) n
  485fd = qemu_open(filename, s->open_flags, 0644);
  (gdb) s
  qemu_open (name=0x7f4b2642b5c0 "/dev/vg_bc_local/test", flags=2) at 
/opt/qemu/qemu-2.5.0/util/osdep.c:177
  177int mode = 0;
  (gdb) n
  183if (strstart(name, "/dev/fdset/", _id_str)) {
  

[Qemu-devel] [Bug 1605506] Re: qemu driver_mirror error "Operation not permitted"

2016-07-24 Thread lisiheng
** 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:
  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
  (retry in redhat7.2 have the same problem!)

  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
   IdName   State
  
   2 i-745F35DC running
  call drive_mirror:
  virsh qemu-monitor-command --hmp i-745F35DC 'drive_mirror -n -f 
drive-ide0-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=/usr/local/qemu-2.5.0-20160720 
--enable-trace-backend=simple --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=qcow2,raw,file,host_device,blkdebug,nbd,iscsi,rbd,cdp 
--block-drv-ro-whitelist=vmdk,vhdx,vpc --target-list=x86_64-softmmu CFLAGS=-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-20160720/bin/qemu-system-x86_64 -name i-745F35DC -S 
-machine pc-i440fx-2.5,accel=kvm,usb=off -cpu 
Westmere,+invpcid,+erms,+bmi2,+smep,+avx2,+bmi1,+fsgsbase,+abm,+rdtscp,+pdpe1gb,+rdrand,+f16c,+avx,+osxsave,+xsave,+tsc-deadline,+movbe,+pcid,+pdcm,+xtpr,+fma,+tm2,+est,+vmx,+ds_cpl,+monitor,+dtes64,+pclmuldq,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme
 -m 64 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 
ef55dfa6-b82e-488d-a7fc-4c882f8091ab -no-user-config -nodefaults -chardev 
socket,id=charmonitor,path=/var/lib/libvirt/qemu/i-745F35DC.monitor,server,nowait
 -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime 
-no-shutdown -boot strict=on -device 
piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive 
file=/tmp/image.raw,if=none,id=drive-ide0-0-0,format=raw,serial=bc-system,cache=none
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=2 
-vnc 0.0.0.0:0,password -k en-us -device 
cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device 
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

  gdb -p  7804
  set breakpoint
  (gdb) i b
  Num Type   Disp Enb AddressWhat
  1   breakpoint keep y   0x7f51d9e92cb1 in qmp_drive_mirror at 
/opt/qemu/qemu-2.5.0/blockdev.c:3310
  2   breakpoint keep y   0x7f51da1252f2 in raw_open_common at 
/opt/qemu/qemu-2.5.0/block/raw-posix.c:457
  3   breakpoint keep y   0x7f51da12500f 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=0x7f4b27259ab0, options=0x7f4b27480290, bdrv_flags=24674, 
open_flags=0, errp=0x7fff4a19f548)
  at /opt/qemu/qemu-2.5.0/block/raw-posix.c:484
  484s->fd = -1;
  (gdb) n
  485fd = qemu_open(filename, s->open_flags, 0644);
  (gdb) s
  qemu_open (name=0x7f4b2642b5c0 "/dev/vg_bc_local/test", flags=2) at 
/opt/qemu/qemu-2.5.0/util/osdep.c:177
  177int mode = 0;
  (gdb) n
  183if (strstart(name, "/dev/fdset/", _id_str)) {
  (gdb)
  214if (flags & O_CREAT) {
  (gdb)
  223char arg[1000] = {0};
  (gdb)
  227ret =