Hide Forgot
Description of problem: Run virsh detach-disk/interface/device with --persistent option,it does not work well Version-Release number of selected component (if applicable): libvirt-0.9.4-21.el6.x86_64 qemu-kvm-0.12.1.2-2.207.el6 kernel-2.6.32-214.el6 How reproducible: always Steps to Reproduce: 1.Start a kvm guest #virsh start test 2.Attach disk to the guest. # virsh attach-disk test /var/lib/libvirt/images/foo.img vdb Disk attached successfully 3.Check the xml file of the guest. # virsh dumpxml test <domain type='kvm' id='31'> <name>test</name> <disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/var/lib/libvirt/images/foo.img'/> <target dev='vdb' bus='virtio'/> <alias name='virtio-disk1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </disk> 4.Detach disk with --persistent option # virsh detach-disk test vdb --persistent error: Failed to detach disk error: invalid argument: no target device vdb If I run detach-disk without --persistent option it can be detached successfully. # virsh detach-disk test vdb Disk detached successfully If I run attach-disk with --persistent option,then use detach-disk with --persistent option,it will detach successfully. # virsh attach-disk test /var/lib/libvirt/images/foo.img vdb --persistent Disk attached successfully # virsh detach-disk test vdb --persistent Disk detached successfully Actual results: As steps 4 describes. Expected results: Disk detached successfully with --persistent option. If libvirt doesn't allow user to use detach-disk/interface/device with '--persistent' option when users haven't used attach-disk/interface/device with '--persistent',It is better to be documented. Additional info: I tried attach-interface/device,it has the same error and give wrong error message. # virsh attach-interface --domain test --type network --source default --target vnet0 --mac 52:54:00:c8:f1:42 --model e1000 Interface attached successfully # virsh dumpxml test <domain type='kvm' id='31'> <name>test</name> <interface type='network'> <mac address='52:54:00:c8:f1:42'/> <source network='default'/> <target dev='vnet1'/> <model type='e1000'/> <alias name='net1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> </interface> # virsh detach-interface test network --persistent error: Failed to detach interface error: invalid argument: no nic of mac 52:54:00:C8:F1:42 # virsh detach-interface test network Interface detached successfully
(In reply to comment #0) > Description of problem: > Run virsh detach-disk/interface/device with --persistent option,it does not > work well > > Version-Release number of selected component (if applicable): > libvirt-0.9.4-21.el6.x86_64 > qemu-kvm-0.12.1.2-2.207.el6 > kernel-2.6.32-214.el6 > > How reproducible: > always > > Steps to Reproduce: > 1.Start a kvm guest > #virsh start test > > 2.Attach disk to the guest. > # virsh attach-disk test /var/lib/libvirt/images/foo.img vdb > Disk attached successfully > > 3.Check the xml file of the guest. > # virsh dumpxml test > <domain type='kvm' id='31'> > <name>test</name> > > <disk type='block' device='disk'> > <driver name='qemu' type='raw'/> > <source dev='/var/lib/libvirt/images/foo.img'/> > <target dev='vdb' bus='virtio'/> > <alias name='virtio-disk1'/> > <address type='pci' domain='0x0000' bus='0x00' slot='0x07' > function='0x0'/> > </disk> > > > 4.Detach disk with --persistent option > # virsh detach-disk test vdb --persistent > error: Failed to detach disk > error: invalid argument: no target device vdb This is expected, as the disk wasn't attached persistently (to the persistent domain config, e.g. /etc/libvirt/qemu/domain.xml). > > If I run detach-disk without --persistent option it can be detached > successfully. > # virsh detach-disk test vdb > Disk detached successfully > > > If I run attach-disk with --persistent option,then use detach-disk with > --persistent option,it will detach successfully. > # virsh attach-disk test /var/lib/libvirt/images/foo.img vdb --persistent > Disk attached successfully > > # virsh detach-disk test vdb --persistent > Disk detached successfully > > Actual results: > As steps 4 describes. > > Expected results: > Disk detached successfully with --persistent option. > If libvirt doesn't allow user to use detach-disk/interface/device with > '--persistent' option when users haven't used attach-disk/interface/device > with '--persistent',It is better to be documented. The error tells you all the truth, "no target device vdb", means can't find the disk you are detaching in the persistent domain conf. Close this as NOTABUG.
> The error tells you all the truth, "no target device vdb", means can't find > the disk you are detaching in the persistent domain conf. > > > Close this as NOTABUG. I think it is better to be documented that if user want to use detach-disk/interface/device with '--persistent' option,they should first use attach-disk/interface/device with '--persistent' option.
Hi Osier, If you look virsh man page for {attach|detach}-{disk|interface|device} command again, you will find there are some contents are missing: 1. missing --persistent option: detach-disk, {attach|detach}-device, detach-interface Notes, virsh man page should synchronize these with virsh help document, and should give more details. 2. without any place to introduce relationship between attach-* command with --persistent option and detach-* command with --persistent option: Notes, it will be better if libvirt can explain this in document. Thanks, Alex
(In reply to comment #3) > > The error tells you all the truth, "no target device vdb", means can't find > > the disk you are detaching in the persistent domain conf. > > > > > > Close this as NOTABUG. > > > I think it is better to be documented that if user want to use > detach-disk/interface/device with '--persistent' option,they should first use > attach-disk/interface/device with '--persistent' option. There is no dependancy here, you can detach a device persistently successfully if the device is in the persistent domain conf, without an persistent attaching previously. Also if the device is not in the config, the error tells you all.
(In reply to comment #4) > Hi Osier, > If you look virsh man page for {attach|detach}-{disk|interface|device} command > again, you will find there are some contents are missing: > > 1. missing --persistent option: > detach-disk, {attach|detach}-device, detach-interface > > Notes, virsh man page should synchronize these with virsh help document, and > should give more details. That's a separate problem. File another bug please. > > 2. without any place to introduce relationship between attach-* command with > --persistent option and detach-* command with --persistent option: > > Notes, it will be better if libvirt can explain this in document. > See comment 5, attaching without "--persistent" and detaching with "--persistent" following is just same with you detach a device which is not in the domain persist config. Documents like "detach with '--persistent' requires attaching with '--persistent'" is just wrong. <snip> 4.Detach disk with --persistent option # virsh detach-disk test vdb --persistent error: Failed to detach disk error: invalid argument: no target device vdb </snip> See the "vdb" in the command, and the error "no target vdb", clearly it's sensiable enough.