Subject: Re: Destroy VM failed. From: Eric Blake <eblake@xxxxxxxxxx> To: david_zhu <david_zhu@xxxxxxxxx> Cc: libvirt-users@xxxxxxxxxx Date: 2012年5月8日 2:05:40 On 05/06/2012 09:12 PM, david_zhu wrote:Hi, When I destroy a VM, sometimes virsh will report failed. So I tried the following shell script: -bash-4.1# for ((i=0; i<1000; i++)); do virsh start david_mac; virsh destroy david_mac; if [ $? != 0 ] ; then echo $i; break; fi; done Domain david_mac started Domain david_mac destroyed ...... Domain david_mac started error: Failed to destroy domain david_mac error: Requested operation is not valid: domain is not runningBear in mind that there is an inherent race: a guest could itself request a shutdown prior to the point that you issue the destroy command, in which case the destroy will fail because the guest is already shutdown. Since the end goal is the same (the guest is shut off either way), it is a good idea to write your scripts to be robust to this particular race. That said, if your guest isn't specifically requesting a shutdown, it seems odd that you are encountering a race, so there may be something else at play here. Does the log of the guest give any particular hints? The guest log seems good, just repeating like this: 2012-05-07 02:39:10.779+0000: starting up LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -S -M pc-0.14 -enable-kvm -m 512 -smp 1,sockets=1,cores=1,threads=1 -name david_mac -uuid 81867c03-abd4-4131-91f6-2fe57795df7c -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=//var/lib/libvirt/qemu/david_mac.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -rtc base=utc -boot order=dc,menu=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device lsi,id=scsi0,bus=pci.0,addr=0x5 -drive file=/home/default_libvirt_pool/fc12qcow2.img,if=none,id=drive-scsi0-0-0,boot=on,format=qcow2 -device scsi-disk,bus=scsi0.0,scsi-id=0,drive=drive-scsi0-0-0,id=scsi0-0-0 -drive file=/home/vmm/isoImage/fc12.iso,if=none,media=cdrom,id=drive-ide0-0-0,readonly=on,format=raw -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -netdev tap,fd=26,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:00:00:05,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -vnc 0.0.0.0:0 -k en-us -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 Domain id=92 is tainted: high-privileges char device redirected to /dev/pts/4 2012-05-07 02:39:12.798+0000: shutting down but the libvirtd.log always prints: 2012-05-07 02:39:09.535+0000: 4118: error : qemuMonitorIO:560 : internal error End of file from monitor 2012-05-07 02:39:10.779+0000: 4121: warning : qemuDomainObjTaint:1134 : Domain id=92 name='david_mac' uuid=81867c03-abd4-4131-91f6-2fe57795df7c is tainted: high-privileges |
_______________________________________________ libvirt-users mailing list libvirt-users@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvirt-users