qemu driver_mirror error "Operation not permitted"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Expired
|
Undecided
|
Unassigned |
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:
libvirt-bin version: 1.2.2-0ubuntu13
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
<?xml version=
<name>
<memory>
<vcpu>1</vcpu>
<cpu mode="host-
<os>
<features>
<on_
<on_
<on_
<devices>
<graphics type="vnc" passwd="" autoport="yes" keymap="en-us" listen="0.0.0.0"/>
<disk type="file" device="disk">
<driver name="qemu" type="raw" cache="none"/>
<source file="/
<target dev="hda" bus="ide"/>
</disk>
</devices>
<clock offset=
</domain>
virsh create libvirt.xml
root@test:
Id Name State
-------
2 i-745F35DC running
call drive_mirror:
virsh qemu-monitor-
Could not open '/dev/vg_
directly run qemu and call drive_mirror:
/usr/local/
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_
(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=
Use libvirtd to Re-run VM and debug by gdb
VM process info:
root 7804 1 0 10:45 ? 00:00:10 /usr/local/
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/
2 breakpoint keep y 0x00007f51da1252f2 in raw_open_common at /opt/qemu/
3 breakpoint keep y 0x00007f51da12500f in raw_parse_flags at /opt/qemu/
(gdb)
call drive_mirror and debug:
(gdb)
raw_open_common (bs=0x7f4b27259ab0, options=
at /opt/qemu/
484 s->fd = -1;
(gdb) n
485 fd = qemu_open(filename, s->open_flags, 0644);
(gdb) s
qemu_open (name=0x7f4b264
177 int mode = 0;
(gdb) n
183 if (strstart(name, "/dev/fdset/", &fdset_id_str)) {
(gdb)
214 if (flags & O_CREAT) {
(gdb)
223 char arg[1000] = {0};
(gdb)
227 ret = open(name, flags , mode);
(gdb) p name
$1 = 0x7f4b2642b5c0 "/dev/vg_
(gdb) p flags
$2 = 2
(gdb) p mode
$3 = 0
(gdb) n
(gdb) p ret
$4 = -1
get system erroron is :Operation not permitted
!!!!!!!!!!!!!!
Re-run VM Directly and debug by gdb
/usr/local/
(qemu) info block
ide0-hd0 (#block135): /tmp/image.raw (raw)
Cache mode: writeback
(qemu) drive_mirror -n -f ide0-hd0 /dev/vg_
gdb debug:
(gdb) i b
Num Type Disp Enb Address What
1 breakpoint keep y 0x00007f51d9e92cb1 in qmp_drive_mirror at /opt/qemu/
2 breakpoint keep y 0x00007f51da1252f2 in raw_open_common at /opt/qemu/
3 breakpoint keep y 0x00007f51da12500f in raw_parse_flags at /opt/qemu/
(gdb)
raw_open_common (bs=0x7f51dc15d350, options=
at /opt/qemu/
484 s->fd = -1;
(gdb) n
485 fd = qemu_open(filename, s->open_flags, 0644);
(gdb) s
qemu_open (name=0x7f51dca
177 int mode = 0;
(gdb) n
183 if (strstart(name, "/dev/fdset/", &fdset_id_str)) {
(gdb)
214 if (flags & O_CREAT) {
(gdb)
223 char arg[1000] = {0};
(gdb)
227 ret = open(name, flags , mode);
(gdb) p name
$1 = 0x7f51dca09230 "/dev/vg_
(gdb) p flags
$2 = 2
(gdb) p mode
$3 = 0
(gdb) n
(gdb) p ret
$4 = 16
(gdb)
tags: | added: qemu |
Changed in qemu: | |
status: | New → Confirmed |
status: | Confirmed → New |
Do you have SELinux or AppArmor or something similar enabled?