[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-2195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13642376#comment-13642376
 ] 

Marcus Sorensen edited comment on CLOUDSTACK-2195 at 4/25/13 11:46 PM:
-----------------------------------------------------------------------


I tried a few things, including throwing a CloudRuntimeException in several 
places where I thought it made sense, such as an empty 
AgentUnavailableException catch block, but it doesn't seem to do anything at 
all, I don't see it in the logs, even though I do see the debug code that I 
placed next to it.  So I give up for now :-)

diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java 
b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 7bf04ec..0373690 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -685,7 +685,8 @@ public class UserVmManagerImpl extends ManagerBase 
implements UserVmManager, Use
         if (status) {
             return status;
         } else {
-            return status;
+            throw new CloudRuntimeException(
+                    "Unable to stop the virtual machine" + vm );
         }
     }

diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java 
b/server/src/com/cloud/vm/VirtualMachineManagerImpl.
index 2c2986f..e320ff1 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -1083,7 +1083,11 @@ public class VirtualMachineManagerImpl extends 
ManagerBase implements VirtualMac
             vmGuru.finalizeStop(profile, answer);

         } catch (AgentUnavailableException e) {
+            s_logger.error("Unable to stop vm, agent unavailable: " + 
e.toString());
+            throw new CloudRuntimeException("Unable to stop vm, agent 
unavailable");
         } catch (OperationTimedoutException e) {
+            s_logger.error("Unable to stop vm, operation timed out: " + 
e.toString());
+            throw new CloudRuntimeException("Unable to stop vm, operation 
timed out");
         } finally {
             if (!stopped) {
                 if (!forced) {
                
      was (Author: mlsorensen):
    I've tried to throw a CloudRuntimeException in several places just to test, 
(including the above mentioned code), but it does absolutely nothing. I don't 
see it in the logs or anywhere.
                  
> stopVirtualMachine reports success when agent can't be reached
> --------------------------------------------------------------
>
>                 Key: CLOUDSTACK-2195
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-2195
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Management Server
>    Affects Versions: 4.1.0
>         Environment: management server talking to a KVM host
>            Reporter: Marcus Sorensen
>            Priority: Critical
>             Fix For: 4.1.0
>
>
> 1. deploy, start a VM
> 2. stop KVM agent where VM is running
> 3. attempt to stopVirtualMachine
> Notice that the job response indicates success. The state, however, remains 
> 'running'

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to