[PATCH tck 4/6] Force destroy guests if graceful shutdown fails

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

 



Change shutdown_vm_gracefully method so that it invokes
'destroy' if 'shutdown' has not completed after 30 seconds.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 lib/Sys/Virt/TCK/NetworkHelpers.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/Sys/Virt/TCK/NetworkHelpers.pm b/lib/Sys/Virt/TCK/NetworkHelpers.pm
index 8bd3802..5d19736 100644
--- a/lib/Sys/Virt/TCK/NetworkHelpers.pm
+++ b/lib/Sys/Virt/TCK/NetworkHelpers.pm
@@ -118,13 +118,15 @@ sub build_domain{
 
     return ($guest, $install);
 }
-sub shutdown_vm_gracefully{
+sub shutdown_vm_gracefully {
     my $dom = shift;
 
+    my $target = time() + 30;
     $dom->shutdown;
-    while($dom->is_active()) {
+    while ($dom->is_active()) {
 	sleep(1);
 	diag ".. waiting for virtual machine to shutdown.. ";
+	$dom->destroy() if time() > $target;
     }
     sleep(1);
     diag ".. shutdown complete.. ";
-- 
1.8.5.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]