cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/6] git commit: updated refs/heads/master to d8c038e
Date Fri, 25 Nov 2016 07:41:19 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 16c2761ce -> d8c038e5b


CLOUDSTACK-9451

Honor the forced parameter to stop virtual machine api call.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/53fd4a79
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/53fd4a79
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/53fd4a79

Branch: refs/heads/master
Commit: 53fd4a7997034478f422f6b996644ca9a0ea7919
Parents: 9eb8b2e
Author: Nathan Johnson <njohnson@ena.com>
Authored: Thu Aug 11 07:52:05 2016 -0500
Committer: Nathan Johnson <njohnson@ena.com>
Committed: Fri Sep 9 13:00:17 2016 -0500

----------------------------------------------------------------------
 engine/api/src/com/cloud/vm/VirtualMachineManager.java  |  2 ++
 .../engine/cloud/entity/api/VirtualMachineEntity.java   |  6 ++++++
 .../src/com/cloud/vm/VirtualMachineManagerImpl.java     | 12 ++++++++++++
 .../engine/cloud/entity/api/VMEntityManager.java        |  2 ++
 .../engine/cloud/entity/api/VMEntityManagerImpl.java    |  6 ++++++
 .../cloud/entity/api/VirtualMachineEntityImpl.java      |  5 +++++
 server/src/com/cloud/vm/UserVmManagerImpl.java          |  7 ++++++-
 7 files changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53fd4a79/engine/api/src/com/cloud/vm/VirtualMachineManager.java
----------------------------------------------------------------------
diff --git a/engine/api/src/com/cloud/vm/VirtualMachineManager.java b/engine/api/src/com/cloud/vm/VirtualMachineManager.java
index 8b22656..a389e13 100644
--- a/engine/api/src/com/cloud/vm/VirtualMachineManager.java
+++ b/engine/api/src/com/cloud/vm/VirtualMachineManager.java
@@ -90,6 +90,8 @@ public interface VirtualMachineManager extends Manager {
 
     void stop(String vmUuid) throws ResourceUnavailableException;
 
+    void stopForced(String vmUuid) throws ResourceUnavailableException;
+
     void expunge(String vmUuid) throws ResourceUnavailableException;
 
     void registerGuru(VirtualMachine.Type type, VirtualMachineGuru guru);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53fd4a79/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java
b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java
index 37501f0..1c3af62 100644
--- a/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java
+++ b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java
@@ -115,6 +115,12 @@ public interface VirtualMachineEntity extends CloudStackEntity {
     boolean stop(String caller) throws ResourceUnavailableException, CloudException;
 
     /**
+     * Stop the virtual machine, by force if necessary
+     *
+     */
+    boolean stopForced(String caller) throws ResourceUnavailableException, CloudException;
+
+    /**
      * Cleans up after any botched starts.  CloudStack Orchestration Platform
      * will attempt a best effort to actually shutdown any resource but
      * even if it cannot, it releases the resource from its database.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53fd4a79/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 2136f8e..18c2beb 100644
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -1239,6 +1239,18 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
         } catch (final ConcurrentOperationException e) {
             throw new CloudRuntimeException("Unable to stop vm because of a concurrent operation",
e);
         }
+
+    }
+
+    @Override
+    public void stopForced(String vmUuid) throws ResourceUnavailableException {
+        try {
+            advanceStop(vmUuid, true);
+        } catch (final OperationTimedoutException e) {
+            throw new AgentUnavailableException("Unable to stop vm because the operation
to stop timed out", e.getAgentId(), e);
+        } catch (final ConcurrentOperationException e) {
+            throw new CloudRuntimeException("Unable to stop vm because of a concurrent operation",
e);
+        }
     }
 
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53fd4a79/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java
b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java
index 3145314..0c357ca 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java
@@ -44,5 +44,7 @@ public interface VMEntityManager {
 
     boolean stopvirtualmachine(VMEntityVO vmEntityVO, String caller) throws ResourceUnavailableException;
 
+    boolean stopvirtualmachineforced(VMEntityVO vmEntityVO, String caller) throws ResourceUnavailableException;
+
     boolean destroyVirtualMachine(VMEntityVO vmEntityVO, String caller) throws AgentUnavailableException,
OperationTimedoutException, ConcurrentOperationException;
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53fd4a79/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
index 829ed10..a944b93 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
@@ -255,6 +255,12 @@ public class VMEntityManagerImpl implements VMEntityManager {
     }
 
     @Override
+    public boolean stopvirtualmachineforced(VMEntityVO vmEntityVO, String caller) throws
ResourceUnavailableException {
+        _itMgr.stopForced(vmEntityVO.getUuid());
+        return true;
+    }
+
+    @Override
     public boolean destroyVirtualMachine(VMEntityVO vmEntityVO, String caller) throws AgentUnavailableException,
OperationTimedoutException, ConcurrentOperationException {
 
         VMInstanceVO vm = _vmDao.findByUuid(vmEntityVO.getUuid());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53fd4a79/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java
b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java
index 706748f..2f4de36 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java
@@ -218,6 +218,11 @@ public class VirtualMachineEntityImpl implements VirtualMachineEntity
{
     }
 
     @Override
+    public boolean stopForced(String caller) throws ResourceUnavailableException {
+        return manager.stopvirtualmachineforced(this.vmEntityVO, caller);
+    }
+
+    @Override
     public void cleanup() {
         // TODO Auto-generated method stub
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53fd4a79/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index cc007d9..e205f2c 100644
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -3866,7 +3866,12 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
         boolean status = false;
         try {
             VirtualMachineEntity vmEntity = _orchSrvc.getVirtualMachine(vm.getUuid());
-            status = vmEntity.stop(Long.toString(userId));
+
+            if(forced) {
+                status = vmEntity.stopForced(Long.toString(userId));
+            } else {
+                status = vmEntity.stop(Long.toString(userId));
+            }
             if (status) {
                return _vmDao.findById(vmId);
             } else {


Mime
View raw message