Re: Destroy VM failed.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 running

Bear 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?

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users

[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux