You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/07/07 07:18:15 UTC

[cloudstack] branch master updated: server: Limit API from trying to start a VM that is already running (#3979)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new 7a41e27   server: Limit API from trying to start a VM that is already running (#3979)
7a41e27 is described below

commit 7a41e2752625a67e5d9a85b017792aabc8218ee0
Author: Chief <20...@users.noreply.github.com>
AuthorDate: Tue Jul 7 10:18:02 2020 +0300

     server: Limit API from trying to start a VM that is already running (#3979)
    
    Fixes #2736
---
 server/src/main/java/com/cloud/vm/UserVmManagerImpl.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
index 4ef4d1e..ce9a41a8 100644
--- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
@@ -4632,6 +4632,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId);
         }
 
+        if (vm.getState()== State.Running) {
+            throw new InvalidParameterValueException("The virtual machine "+ vm.getUuid()+ " ("+ vm.getDisplayName()+ ") is already running");
+        }
+
         _accountMgr.checkAccess(callerAccount, null, true, vm);
 
         Account owner = _accountDao.findById(vm.getAccountId());