From 016fe3ecb8efe5c5b441cd531d6e32159c571ef3 Mon Sep 17 00:00:00 2001 From: Marcus Sorensen Date: Tue, 6 Aug 2013 15:41:21 -0600 Subject: [PATCH] Summary: Quiet erroneous stopVM failures on kvm Detail: Cloudstack tries to stop VMs all the time, for all sorts of reasons, but usually just to get into a known state. Libvirt throws an exception of 'Domain not found' when attempting to stop a VM that doesn't exist. This causes problems for troubleshooting real issues. Domain not found should equate to success if trying to stop. BUG-ID: CLOUDSTACK-4011 Bugfix-for: 4.2 Signed-off-by: Marcus Sorensen 1375825281 -0600 --- .../hypervisor/kvm/resource/LibvirtComputingResource.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index 2ae21addec8..63557439e27 100755 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -4365,6 +4365,10 @@ ServerResource { } } } catch (LibvirtException e) { + if (e.getMessage().contains("Domain not found")) { + s_logger.debug("VM " + vmName + " doesn't exist, no need to stop it"); + return null; + } s_logger.debug("Failed to stop VM :" + vmName + " :", e); return e.getMessage(); } catch (InterruptedException ie) {