You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2014/11/11 13:03:40 UTC

[01/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Repository: cloudstack
Updated Branches:
  refs/heads/statscollector-graphite 683124b13 -> e06a814d7 (forced update)


should not duplicate vm instance id, during the volume migration

Conflicts:
	engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java


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

Branch: refs/heads/statscollector-graphite
Commit: 885bba926cf1c21c8222a8a014445c0207878c96
Parents: ffdb38c
Author: Edison Su <su...@gmail.com>
Authored: Thu Oct 30 21:27:51 2014 -0700
Committer: Edison Su <su...@gmail.com>
Committed: Thu Nov 6 15:36:58 2014 -0800

----------------------------------------------------------------------
 engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java        | 3 +++
 .../org/apache/cloudstack/storage/volume/VolumeServiceImpl.java   | 1 +
 2 files changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/885bba92/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java
index fb93610..4ad196c 100755
--- a/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java
+++ b/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java
@@ -594,8 +594,11 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
             VolumeVO srcVol = findById(srcVolId);
             VolumeVO destVol = findById(destVolId);
             String uuid = srcVol.getUuid();
+            Long instanceId = srcVol.getInstanceId();
             srcVol.setUuid(null);
+            srcVol.setInstanceId(null);
             destVol.setUuid(uuid);
+            destVol.setInstanceId(instanceId);
             update(srcVolId, srcVol);
             update(destVolId, destVol);
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/885bba92/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index 1297da9..7e3239f 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -830,6 +830,7 @@ public class VolumeServiceImpl implements VolumeService {
         }
 
         VolumeVO newVol = new VolumeVO(volume);
+        newVol.setInstanceId(null);
         newVol.setPoolId(pool.getId());
         newVol.setFolder(folder);
         newVol.setPodId(pool.getPodId());


[13/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Revert "BUG-ID: CS-27191: CPVM continues to be in Stopped state after a failure"

This reverts commit d065bcf9b45d9bec8e9a481cf6092967d5107a9e.


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

Branch: refs/heads/statscollector-graphite
Commit: 392eaf3e56e667f210e6e0599442f22669a9c07d
Parents: d065bcf
Author: Min Chen <mi...@citrix.com>
Authored: Fri Nov 7 16:32:42 2014 -0800
Committer: Min Chen <mi...@citrix.com>
Committed: Fri Nov 7 16:33:45 2014 -0800

----------------------------------------------------------------------
 .../framework/jobs/dao/AsyncJobDao.java         |  2 --
 .../framework/jobs/dao/AsyncJobDaoImpl.java     | 20 --------------------
 .../jobs/impl/AsyncJobManagerImpl.java          | 14 ++------------
 3 files changed, 2 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/392eaf3e/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
index 169cae9..170da50 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
@@ -39,6 +39,4 @@ public interface AsyncJobDao extends GenericDao<AsyncJobVO, Long> {
     void resetJobProcess(long msid, int jobResultCode, String jobResultMessage);
 
     List<AsyncJobVO> getExpiredCompletedJobs(Date cutTime, int limit);
-
-    List<AsyncJobVO> getResetJobs(long msid);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/392eaf3e/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
index 0d024eb..612573f 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
@@ -186,24 +186,4 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long> implements
             s_logger.warn("Unable to reset job status for management server " + msid, e);
         }
     }
-
-    @Override
-    public List<AsyncJobVO> getResetJobs(long msid) {
-        SearchCriteria<AsyncJobVO> sc = pendingAsyncJobSearch.create();
-        sc.setParameters("status", JobInfo.Status.IN_PROGRESS);
-
-        // construct query: (job_executing_msid=msid OR (job_executing_msid IS NULL AND job_init_msid=msid))
-        SearchCriteria<AsyncJobVO> msQuery = createSearchCriteria();
-        msQuery.addOr("executingMsid", SearchCriteria.Op.EQ, msid);
-        SearchCriteria<AsyncJobVO> initMsQuery = createSearchCriteria();
-        initMsQuery.addAnd("executingMsid", SearchCriteria.Op.NULL);
-        initMsQuery.addAnd("initMsid", SearchCriteria.Op.EQ, msid);
-        msQuery.addOr("initMsId", SearchCriteria.Op.SC, initMsQuery);
-
-        sc.addAnd("executingMsid", SearchCriteria.Op.SC, msQuery);
-
-        Filter filter = new Filter(AsyncJobVO.class, "created", true, null, null);
-        return listIncludingRemovedBy(sc, filter);
-
-    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/392eaf3e/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
index 91516d5..548182a 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
@@ -232,8 +232,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                 s_logger.debug("job-" + jobId + " no longer exists, we just log completion info here. " + jobStatus + ", resultCode: " + resultCode + ", result: " +
                     resultObject);
             }
-            // still purge item from queue to avoid any blocking
-            _queueMgr.purgeAsyncJobQueueItemId(jobId);
+
             return;
         }
 
@@ -241,8 +240,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("job-" + jobId + " is already completed.");
             }
-            // still purge item from queue to avoid any blocking
-            _queueMgr.purgeAsyncJobQueueItemId(jobId);
+
             return;
         }
 
@@ -549,8 +547,6 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     // guard final clause as well
                     try {
                         if (job.getSyncSource() != null) {
-                            // here check queue item one more time to double make sure that queue item is removed in case of any uncaught exception
-                            _queueMgr.purgeItem(job.getSyncSource().getId());
                             checkQueue(job.getSyncSource().getQueueId());
                         }
 
@@ -980,12 +976,6 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     _queueMgr.cleanupActiveQueueItems(msid, true);
                     // reset job status for all jobs running on this ms node
                     _jobDao.resetJobProcess(msid, ApiErrorCode.INTERNAL_ERROR.getHttpCode(), "job cancelled because of management server restart or shutdown");
-                    // purge those queue items for those cancelled jobs above, which may not be picked up by any MS node yet
-                    List<AsyncJobVO> cancelJobs = _jobDao.getResetJobs(msid);
-                    for (AsyncJobVO job : cancelJobs){
-                        _queueMgr.purgeAsyncJobQueueItemId(job.getId());
-                    }
-
                 }
             });
         } catch (Throwable e) {


[09/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7859: Host tags are not getting removed in cloud.host_tags table when a Host is deleted from CS.


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

Branch: refs/heads/statscollector-graphite
Commit: 1c9775b0dfb03707279318408037845fa7a81873
Parents: 17e8d9e
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Fri Nov 7 16:55:50 2014 +0530
Committer: Sanjay Tripathi <sa...@citrix.com>
Committed: Fri Nov 7 17:34:16 2014 +0530

----------------------------------------------------------------------
 engine/schema/src/com/cloud/host/dao/HostTagsDao.java     |  2 ++
 engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java | 10 ++++++++++
 server/src/com/cloud/resource/ResourceManagerImpl.java    |  7 +++++--
 3 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1c9775b0/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/dao/HostTagsDao.java b/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
index 8901716..c811de9 100644
--- a/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
+++ b/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
@@ -29,4 +29,6 @@ public interface HostTagsDao extends GenericDao<HostTagVO, Long> {
 
     List<String> getDistinctImplicitHostTags(List<Long> hostIds, String[] implicitHostTags);
 
+    void deleteTags(long hostId);
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1c9775b0/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java b/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
index 7e8615a..e275e04 100644
--- a/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
+++ b/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
@@ -72,6 +72,16 @@ public class HostTagsDaoImpl extends GenericDaoBase<HostTagVO, Long> implements
     }
 
     @Override
+    public void deleteTags(long hostId) {
+        TransactionLegacy txn = TransactionLegacy.currentTxn();
+        txn.start();
+        SearchCriteria<HostTagVO> sc = HostSearch.create();
+        sc.setParameters("hostId", hostId);
+        expunge(sc);
+        txn.commit();
+    }
+
+    @Override
     public void persist(long hostId, List<String> hostTags) {
         TransactionLegacy txn = TransactionLegacy.currentTxn();
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1c9775b0/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index fcc4ddb..77f6041 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -847,8 +847,11 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
         // delete host details
         _hostDetailsDao.deleteDetails(hostId);
 
-                // if host is GPU enabled, delete GPU entries
-                _hostGpuGroupsDao.deleteGpuEntries(hostId);
+        // if host is GPU enabled, delete GPU entries
+        _hostGpuGroupsDao.deleteGpuEntries(hostId);
+
+        // delete host tags
+        _hostTagsDao.deleteTags(hostId);
 
         host.setGuid(null);
         Long clusterId = host.getClusterId();


[18/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7869: Add simulator support for findHostsForMigration API


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

Branch: refs/heads/statscollector-graphite
Commit: 8378485e56d973639dfc06013d64db6a80056a3b
Parents: 49115e0
Author: Koushik Das <ko...@apache.org>
Authored: Sat Nov 8 13:46:24 2014 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Sat Nov 8 13:46:54 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/server/ManagementServerImpl.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8378485e/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 697d1c4..deb2424 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1123,7 +1123,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         }
 
         if (!vm.getHypervisorType().equals(HypervisorType.XenServer) && !vm.getHypervisorType().equals(HypervisorType.VMware) && !vm.getHypervisorType().equals(HypervisorType.KVM)
-                && !vm.getHypervisorType().equals(HypervisorType.Ovm) && !vm.getHypervisorType().equals(HypervisorType.Hyperv) && !vm.getHypervisorType().equals(HypervisorType.LXC)) {
+                && !vm.getHypervisorType().equals(HypervisorType.Ovm) && !vm.getHypervisorType().equals(HypervisorType.Hyperv) && !vm.getHypervisorType().equals(HypervisorType.LXC)
+                && !vm.getHypervisorType().equals(HypervisorType.Simulator)) {
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug(vm + " is not XenServer/VMware/KVM/OVM/Hyperv, cannot migrate this VM.");
             }


[35/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7792: Usage Events to be captured based on Volume State Machine


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

Branch: refs/heads/statscollector-graphite
Commit: 781648fb1003c8c32875e9ff7a6c4ef4694539f7
Parents: cd48720
Author: Damodar <da...@citrix.com>
Authored: Mon Nov 10 15:12:03 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Mon Nov 10 15:19:02 2014 +0530

----------------------------------------------------------------------
 api/src/com/cloud/storage/Volume.java           | 72 +++++++++++---------
 api/src/com/cloud/vm/VirtualMachine.java        |  2 +-
 .../storage/ObjectInDataStoreStateMachine.java  |  3 +
 .../orchestration/VolumeOrchestrator.java       |  2 -
 .../schema/src/com/cloud/storage/VolumeVO.java  |  2 +-
 .../cloudstack/storage/volume/VolumeObject.java |  8 ++-
 .../storage/volume/VolumeServiceImpl.java       |  6 +-
 .../com/cloud/storage/StorageManagerImpl.java   |  2 +-
 .../com/cloud/storage/VolumeApiServiceImpl.java |  7 --
 .../storage/listener/VolumeStateListener.java   | 37 +++++++++-
 10 files changed, 90 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/781648fb/api/src/com/cloud/storage/Volume.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/storage/Volume.java b/api/src/com/cloud/storage/Volume.java
index 91ad955..89d08f7 100755
--- a/api/src/com/cloud/storage/Volume.java
+++ b/api/src/com/cloud/storage/Volume.java
@@ -16,6 +16,7 @@
 // under the License.
 package com.cloud.storage;
 
+import java.util.Arrays;
 import java.util.Date;
 
 import org.apache.cloudstack.acl.ControlledEntity;
@@ -64,38 +65,42 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
 
         private final static StateMachine2<State, Event, Volume> s_fsm = new StateMachine2<State, Event, Volume>();
         static {
-            s_fsm.addTransition(Allocated, Event.CreateRequested, Creating);
-            s_fsm.addTransition(Allocated, Event.DestroyRequested, Destroy);
-            s_fsm.addTransition(Creating, Event.OperationRetry, Creating);
-            s_fsm.addTransition(Creating, Event.OperationFailed, Allocated);
-            s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready);
-            s_fsm.addTransition(Creating, Event.CreateRequested, Creating);
-            s_fsm.addTransition(Ready, Event.ResizeRequested, Resizing);
-            s_fsm.addTransition(Resizing, Event.OperationSucceeded, Ready);
-            s_fsm.addTransition(Resizing, Event.OperationFailed, Ready);
-            s_fsm.addTransition(Allocated, Event.UploadRequested, UploadOp);
-            s_fsm.addTransition(Uploaded, Event.CopyRequested, Copying);
-            s_fsm.addTransition(Copying, Event.OperationSucceeded, Ready);
-            s_fsm.addTransition(Copying, Event.OperationFailed, Uploaded);
-            s_fsm.addTransition(UploadOp, Event.DestroyRequested, Destroy);
-            s_fsm.addTransition(Ready, Event.DestroyRequested, Destroy);
-            s_fsm.addTransition(Destroy, Event.ExpungingRequested, Expunging);
-            s_fsm.addTransition(Expunging, Event.ExpungingRequested, Expunging);
-            s_fsm.addTransition(Expunging, Event.OperationSucceeded, Expunged);
-            s_fsm.addTransition(Expunging, Event.OperationFailed, Destroy);
-            s_fsm.addTransition(Ready, Event.SnapshotRequested, Snapshotting);
-            s_fsm.addTransition(Snapshotting, Event.OperationSucceeded, Ready);
-            s_fsm.addTransition(Snapshotting, Event.OperationFailed, Ready);
-            s_fsm.addTransition(Ready, Event.MigrationRequested, Migrating);
-            s_fsm.addTransition(Migrating, Event.OperationSucceeded, Ready);
-            s_fsm.addTransition(Migrating, Event.OperationFailed, Ready);
-            s_fsm.addTransition(Destroy, Event.OperationSucceeded, Destroy);
-            s_fsm.addTransition(UploadOp, Event.OperationSucceeded, Uploaded);
-            s_fsm.addTransition(UploadOp, Event.OperationFailed, Allocated);
-            s_fsm.addTransition(Uploaded, Event.DestroyRequested, Destroy);
-            s_fsm.addTransition(Expunged, Event.ExpungingRequested, Expunged);
-            s_fsm.addTransition(Expunged, Event.OperationSucceeded, Expunged);
-            s_fsm.addTransition(Expunged, Event.OperationFailed, Expunged);
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Allocated, Event.CreateRequested, Creating, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Allocated, Event.DestroyRequested, Destroy, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Creating, Event.OperationRetry, Creating, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Creating, Event.OperationFailed, Allocated, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Creating, Event.OperationSucceeded, Ready, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Creating, Event.DestroyRequested, Destroy, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Creating, Event.CreateRequested, Creating, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Ready, Event.ResizeRequested, Resizing, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Resizing, Event.OperationSucceeded, Ready, Arrays.asList(new StateMachine2.Transition.Impact[]{StateMachine2.Transition.Impact.USAGE})));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Resizing, Event.OperationFailed, Ready, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Allocated, Event.UploadRequested, UploadOp, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Uploaded, Event.CopyRequested, Copying, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Copying, Event.OperationSucceeded, Ready, Arrays.asList(new StateMachine2.Transition.Impact[]{StateMachine2.Transition.Impact.USAGE})));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Copying, Event.OperationFailed, Uploaded, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(UploadOp, Event.DestroyRequested, Destroy, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Ready, Event.DestroyRequested, Destroy, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Destroy, Event.ExpungingRequested, Expunging, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Expunging, Event.ExpungingRequested, Expunging, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Expunging, Event.OperationSucceeded, Expunged,null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Expunging, Event.OperationFailed, Destroy, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Ready, Event.SnapshotRequested, Snapshotting, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Snapshotting, Event.OperationSucceeded, Ready, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Snapshotting, Event.OperationFailed, Ready,null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Allocated, Event.MigrationCopyRequested, Creating, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Creating, Event.MigrationCopyFailed, Allocated, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Creating, Event.MigrationCopySucceeded, Ready, Arrays.asList(new StateMachine2.Transition.Impact[]{StateMachine2.Transition.Impact.USAGE})));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Ready, Event.MigrationRequested, Migrating, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Migrating, Event.OperationSucceeded, Ready, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Migrating, Event.OperationFailed, Ready, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Destroy, Event.OperationSucceeded, Destroy, Arrays.asList(new StateMachine2.Transition.Impact[]{StateMachine2.Transition.Impact.USAGE})));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(UploadOp, Event.OperationSucceeded, Uploaded, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(UploadOp, Event.OperationFailed, Allocated, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Uploaded, Event.DestroyRequested, Destroy, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Expunged, Event.ExpungingRequested, Expunged, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Expunged, Event.OperationSucceeded, Expunged, null));
+            s_fsm.addTransition(new StateMachine2.Transition<State, Event>(Expunged, Event.OperationFailed, Expunged,null));
         }
     }
 
@@ -109,6 +114,9 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
         OperationRetry,
         UploadRequested,
         MigrationRequested,
+        MigrationCopyRequested,
+        MigrationCopySucceeded,
+        MigrationCopyFailed,
         SnapshotRequested,
         DestroyRequested,
         ExpungingRequested,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/781648fb/api/src/com/cloud/vm/VirtualMachine.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/com/cloud/vm/VirtualMachine.java
index 99152d6..2a6039f 100755
--- a/api/src/com/cloud/vm/VirtualMachine.java
+++ b/api/src/com/cloud/vm/VirtualMachine.java
@@ -98,7 +98,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
             s_fsm.addTransition(new Transition<State, Event>(State.Starting, VirtualMachine.Event.AgentReportRunning, State.Running, Arrays.asList(new Impact[]{Impact.USAGE})));
             s_fsm.addTransition(new Transition<State, Event>(State.Starting, VirtualMachine.Event.AgentReportStopped, State.Stopped, null));
             s_fsm.addTransition(new Transition<State, Event>(State.Starting, VirtualMachine.Event.AgentReportShutdowned, State.Stopped, null));
-            s_fsm.addTransition(new Transition<State, Event>(State.Destroyed, VirtualMachine.Event.RecoveryRequested, State.Stopped, null));
+            s_fsm.addTransition(new Transition<State, Event>(State.Destroyed, VirtualMachine.Event.RecoveryRequested, State.Stopped, Arrays.asList(new Impact[]{Impact.USAGE})));
             s_fsm.addTransition(new Transition<State, Event>(State.Destroyed, VirtualMachine.Event.ExpungeOperation, State.Expunging, null));
             s_fsm.addTransition(new Transition<State, Event>(State.Running, VirtualMachine.Event.MigrationRequested, State.Migrating, null));
             s_fsm.addTransition(new Transition<State, Event>(State.Running, VirtualMachine.Event.AgentReportRunning, State.Running, null));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/781648fb/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java
index b21616a..204cab0 100644
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java
@@ -51,6 +51,9 @@ public interface ObjectInDataStoreStateMachine extends StateObject<ObjectInDataS
         OperationFailed,
         CopyingRequested,
         MigrationRequested,
+        MigrationCopyRequested,
+        MigrationCopySucceeded,
+        MigrationCopyFailed,
         ResizeRequested,
         ExpungeRequested
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/781648fb/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index 826e2ee..f474fe3 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -1382,8 +1382,6 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
             }
             // FIXME - All this is boiler plate code and should be done as part of state transition. This shouldn't be part of orchestrator.
             // publish usage event for the volume
-            UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_DELETE, volume.getAccountId(), volume.getDataCenterId(), volume.getId(), volume.getName(),
-                    Volume.class.getName(), volume.getUuid(), volume.isDisplayVolume());
             _resourceLimitMgr.decrementResourceCount(volume.getAccountId(), ResourceType.volume, volume.isDisplay());
             //FIXME - why recalculate and not decrement
             _resourceLimitMgr.recalculateResourceCount(volume.getAccountId(), volume.getDomainId(), ResourceType.primary_storage.getOrdinal());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/781648fb/engine/schema/src/com/cloud/storage/VolumeVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/VolumeVO.java b/engine/schema/src/com/cloud/storage/VolumeVO.java
index e328253..e2f717d 100755
--- a/engine/schema/src/com/cloud/storage/VolumeVO.java
+++ b/engine/schema/src/com/cloud/storage/VolumeVO.java
@@ -247,7 +247,7 @@ public class VolumeVO implements Volume {
             that.get_iScsiName(),
             that.getVolumeType());
         recreatable = that.isRecreatable();
-        state = that.getState();
+        state = State.Allocated; //This should be in Allocated state before going into Ready state
         size = that.getSize();
         minIops = that.getMinIops();
         maxIops = that.getMaxIops();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/781648fb/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
index f2b4c95..6a42435 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
@@ -178,7 +178,7 @@ public class VolumeObject implements VolumeInfo {
     }
 
     @Override
-    public boolean stateTransit(Volume.Event event) {
+    public boolean  stateTransit(Volume.Event event) {
         boolean result = false;
         try {
             volumeVO = volumeDao.findById(volumeVO.getId());
@@ -308,6 +308,8 @@ public class VolumeObject implements VolumeInfo {
                     volEvent = Volume.Event.CopyRequested;
                 } else if (event == ObjectInDataStoreStateMachine.Event.MigrationRequested) {
                     volEvent = Volume.Event.MigrationRequested;
+                } else if (event == ObjectInDataStoreStateMachine.Event.MigrationCopyRequested) {
+                    volEvent = Event.MigrationCopyRequested;
                 }
             }
 
@@ -317,8 +319,12 @@ public class VolumeObject implements VolumeInfo {
                 volEvent = Volume.Event.ExpungingRequested;
             } else if (event == ObjectInDataStoreStateMachine.Event.OperationSuccessed) {
                 volEvent = Volume.Event.OperationSucceeded;
+            } else if (event == ObjectInDataStoreStateMachine.Event.MigrationCopySucceeded) {
+              volEvent = Event.MigrationCopySucceeded;
             } else if (event == ObjectInDataStoreStateMachine.Event.OperationFailed) {
                 volEvent = Volume.Event.OperationFailed;
+            } else if (event == ObjectInDataStoreStateMachine.Event.MigrationCopyFailed) {
+              volEvent = Event.MigrationCopyFailed;
             } else if (event == ObjectInDataStoreStateMachine.Event.ResizeRequested) {
                 volEvent = Volume.Event.ResizeRequested;
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/781648fb/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index 9c45cb8..174874a 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -984,7 +984,7 @@ public class VolumeServiceImpl implements VolumeService {
 
             VolumeVO destVol = duplicateVolumeOnAnotherStorage(srcVolume, (StoragePool)destStore);
             VolumeInfo destVolume = volFactory.getVolume(destVol.getId(), destStore);
-            destVolume.processEvent(Event.MigrationRequested);
+            destVolume.processEvent(Event.MigrationCopyRequested);
             srcVolume.processEvent(Event.MigrationRequested);
 
             CopyVolumeContext<VolumeApiResult> context = new CopyVolumeContext<VolumeApiResult>(null, future, srcVolume, destVolume, destStore);
@@ -1008,7 +1008,7 @@ public class VolumeServiceImpl implements VolumeService {
         try {
             if (result.isFailed()) {
                 res.setResult(result.getResult());
-                destVolume.processEvent(Event.OperationFailed);
+                destVolume.processEvent(Event.MigrationCopyFailed);
                 srcVolume.processEvent(Event.OperationFailed);
                 destroyVolume(destVolume.getId());
                 destVolume = volFactory.getVolume(destVolume.getId());
@@ -1018,7 +1018,7 @@ public class VolumeServiceImpl implements VolumeService {
                 return null;
             }
             srcVolume.processEvent(Event.OperationSuccessed);
-            destVolume.processEvent(Event.OperationSuccessed, result.getAnswer());
+            destVolume.processEvent(Event.MigrationCopySucceeded, result.getAnswer());
             _volumeDao.updateUuid(srcVolume.getId(), destVolume.getId());
             try {
                 destroyVolume(srcVolume.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/781648fb/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index 153c25a..297f1ce 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -499,7 +499,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
         LocalStorageSearch.and("type", LocalStorageSearch.entity().getPoolType(), SearchCriteria.Op.IN);
         LocalStorageSearch.done();
 
-        Volume.State.getStateMachine().registerListener(new VolumeStateListener(_configDao));
+        Volume.State.getStateMachine().registerListener(new VolumeStateListener(_configDao, _vmInstanceDao));
 
         return true;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/781648fb/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index 088f054..17902c2 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -1043,9 +1043,6 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
             }
 
             _volsDao.update(volume.getId(), volume);
-            // Log usage event for volumes belonging user VM's only
-            UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_RESIZE, volume.getAccountId(), volume.getDataCenterId(), volume.getId(), volume.getName(),
-                    volume.getDiskOfferingId(), volume.getTemplateId(), volume.getSize(), Volume.class.getName(), volume.getUuid());
 
             /* Update resource count for the account on primary storage resource */
             if (!shrinkOk) {
@@ -1111,10 +1108,6 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
                     } else {
                         _resourceLimitMgr.recalculateResourceCount(volume.getAccountId(), volume.getDomainId(), ResourceType.secondary_storage.getOrdinal());
                     }
-
-                    // Log usage event for volumes belonging user VM's only
-                    UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_DELETE, volume.getAccountId(), volume.getDataCenterId(), volume.getId(), volume.getName(),
-                            Volume.class.getName(), volume.getUuid(), volume.isDisplayVolume());
                 }
             }
             // Mark volume as removed if volume has not been created on primary or secondary

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/781648fb/server/src/com/cloud/storage/listener/VolumeStateListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/listener/VolumeStateListener.java b/server/src/com/cloud/storage/listener/VolumeStateListener.java
index 0ba2969..9fd1423 100644
--- a/server/src/com/cloud/storage/listener/VolumeStateListener.java
+++ b/server/src/com/cloud/storage/listener/VolumeStateListener.java
@@ -22,7 +22,12 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
+import com.cloud.event.EventTypes;
+import com.cloud.event.UsageEventUtils;
 import com.cloud.utils.fsm.StateMachine2;
+import com.cloud.vm.VMInstanceVO;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.dao.VMInstanceDao;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
 
@@ -43,11 +48,13 @@ public class VolumeStateListener implements StateListener<State, Event, Volume>
 
     protected static EventBus s_eventBus = null;
     protected ConfigurationDao _configDao;
+    protected VMInstanceDao _vmInstanceDao;
 
     private static final Logger s_logger = Logger.getLogger(VolumeStateListener.class);
 
-    public VolumeStateListener(ConfigurationDao configDao) {
+    public VolumeStateListener(ConfigurationDao configDao, VMInstanceDao vmInstanceDao) {
         this._configDao = configDao;
+        this._vmInstanceDao = vmInstanceDao;
     }
 
     @Override
@@ -57,8 +64,32 @@ public class VolumeStateListener implements StateListener<State, Event, Volume>
     }
 
     @Override
-    public boolean postStateTransitionEvent(StateMachine2.Transition<State, Event> transition, Volume vo, boolean status, Object opaque) {
-      pubishOnEventBus(transition.getEvent().name(), "postStateTransitionEvent", vo, transition.getCurrentState(), transition.getToState());
+    public boolean postStateTransitionEvent(StateMachine2.Transition<State, Event> transition, Volume vol, boolean status, Object opaque) {
+      pubishOnEventBus(transition.getEvent().name(), "postStateTransitionEvent", vol, transition.getCurrentState(), transition.getToState());
+      if(transition.isImpacted(StateMachine2.Transition.Impact.USAGE)) {
+        Long instanceId = vol.getInstanceId();
+        VMInstanceVO vmInstanceVO = null;
+        if(instanceId != null) {
+          vmInstanceVO = _vmInstanceDao.findById(instanceId);
+        }
+        if(instanceId == null || vmInstanceVO.getType() == VirtualMachine.Type.User) {
+          if (transition.getToState() == State.Ready) {
+            if (transition.getCurrentState() == State.Resizing) {
+              // Log usage event for volumes belonging user VM's only
+              UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_RESIZE, vol.getAccountId(), vol.getDataCenterId(), vol.getId(), vol.getName(),
+                      vol.getDiskOfferingId(), vol.getTemplateId(), vol.getSize(), Volume.class.getName(), vol.getUuid());
+            } else {
+              UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_CREATE, vol.getAccountId(), vol.getDataCenterId(), vol.getId(), vol.getName(), vol.getDiskOfferingId(), null, vol.getSize(),
+                      Volume.class.getName(), vol.getUuid(), vol.isDisplayVolume());
+            }
+          } else if (transition.getToState() == State.Destroy) {
+            UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_DELETE, vol.getAccountId(), vol.getDataCenterId(), vol.getId(), vol.getName(),
+                    Volume.class.getName(), vol.getUuid(), vol.isDisplayVolume());
+          } else if (transition.getToState() == State.Uploaded) {
+            //Currently we are not capturing Usage for Secondary Storage so Usage for this operation will be captured when it is moved to primary storage
+          }
+        }
+      }
       return true;
     }
 


[37/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7872: network getting shutdown inspite of running VM's in the network


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

Branch: refs/heads/statscollector-graphite
Commit: 709bf074de9f8f22e6a71362551c4867be884e4b
Parents: 990da08
Author: Jayapal <ja...@apache.org>
Authored: Fri Nov 7 09:37:32 2014 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Mon Nov 10 16:06:58 2014 +0530

----------------------------------------------------------------------
 .../com/cloud/network/dao/NetworkDaoImpl.java   |  2 --
 engine/schema/src/com/cloud/vm/dao/NicDao.java  |  2 ++
 .../schema/src/com/cloud/vm/dao/NicDaoImpl.java | 22 ++++++++++++++++++++
 .../src/com/cloud/network/NetworkModelImpl.java |  7 +++++++
 4 files changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/709bf074/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java b/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
index 0c556c8..4a07455 100644
--- a/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
@@ -244,7 +244,6 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
         GarbageCollectedSearch = createSearchBuilder(Long.class);
         GarbageCollectedSearch.selectFields(GarbageCollectedSearch.entity().getId());
         SearchBuilder<NetworkOpVO> join7 = _ntwkOpDao.createSearchBuilder();
-        join7.and("activenics", join7.entity().getActiveNicsCount(), Op.EQ);
         join7.and("gc", join7.entity().isGarbageCollected(), Op.EQ);
         join7.and("check", join7.entity().isCheckForGc(), Op.EQ);
         GarbageCollectedSearch.join("ntwkOpGC", join7, GarbageCollectedSearch.entity().getId(), join7.entity().getId(), JoinBuilder.JoinType.INNER);
@@ -438,7 +437,6 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     public List<Long> findNetworksToGarbageCollect() {
         SearchCriteria<Long> sc = GarbageCollectedSearch.create();
         sc.setJoinParameters("ntwkOffGC", "isPersistent", false);
-        sc.setJoinParameters("ntwkOpGC", "activenics", 0);
         sc.setJoinParameters("ntwkOpGC", "gc", true);
         sc.setJoinParameters("ntwkOpGC", "check", true);
         return customSearch(sc, null);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/709bf074/engine/schema/src/com/cloud/vm/dao/NicDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/NicDao.java b/engine/schema/src/com/cloud/vm/dao/NicDao.java
index a7ad016..9f153f8 100644
--- a/engine/schema/src/com/cloud/vm/dao/NicDao.java
+++ b/engine/schema/src/com/cloud/vm/dao/NicDao.java
@@ -74,4 +74,6 @@ public interface NicDao extends GenericDao<NicVO, Long> {
     List<NicVO> listByNetworkIdTypeAndGatewayAndBroadcastUri(long networkId, VirtualMachine.Type vmType, String gateway, URI broadcastUri);
 
     int countNicsForStartingVms(long networkId);
+
+    int countNicsForRunningVms(long networkId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/709bf074/engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java
index 2a9a602..ca44b63 100644
--- a/engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java
@@ -46,6 +46,7 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
     private SearchBuilder<NicVO> NonReleasedSearch;
     private GenericSearchBuilder<NicVO, Integer> CountBy;
     private GenericSearchBuilder<NicVO, Integer> CountByForStartingVms;
+    private GenericSearchBuilder<NicVO, Integer> CountByForRunningVms;
 
     @Inject
     VMInstanceDao _vmDao;
@@ -95,6 +96,17 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
         join1.and("state", join1.entity().getState(), Op.EQ);
         CountByForStartingVms.join("vm", join1, CountByForStartingVms.entity().getInstanceId(), join1.entity().getId(), JoinBuilder.JoinType.INNER);
         CountByForStartingVms.done();
+
+        CountByForRunningVms = createSearchBuilder(Integer.class);
+        CountByForRunningVms.select(null, Func.COUNT, CountByForRunningVms.entity().getId());
+        CountByForRunningVms.and("networkId", CountByForRunningVms.entity().getNetworkId(), Op.EQ);
+        CountByForRunningVms.and("removed", CountByForRunningVms.entity().getRemoved(), Op.NULL);
+        SearchBuilder<VMInstanceVO> join2 = _vmDao.createSearchBuilder();
+        join2.and("state", join2.entity().getState(), Op.EQ);
+        join2.and("type", join2.entity().getType(), Op.EQ);
+        CountByForRunningVms.join("vm", join2, CountByForRunningVms.entity().getInstanceId(), join2.entity().getId(), JoinBuilder.JoinType.INNER);
+        CountByForRunningVms.done();
+
     }
 
     @Override
@@ -291,4 +303,14 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
         List<Integer> results = customSearch(sc, null);
         return results.get(0);
     }
+
+    @Override
+    public int countNicsForRunningVms(long networkId) {
+        SearchCriteria<Integer> sc = CountByForRunningVms.create();
+        sc.setParameters("networkId", networkId);
+        sc.setJoinParameters("vm", "state", VirtualMachine.State.Running);
+        sc.setJoinParameters("vm", "type", VirtualMachine.Type.User);
+        List<Integer> results = customSearch(sc, null);
+        return results.get(0);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/709bf074/server/src/com/cloud/network/NetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java
index 1dc81bd..2edf970 100755
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -2232,6 +2232,13 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
             return false;
         }
 
+        // Due to VMSync issue, there can be cases where nic count is zero, but there can be VM's running in the network
+        // so add extra guard to check if network GC is actially required.
+        if (_nicDao.countNicsForRunningVms(networkId) > 0) {
+            s_logger.debug("Network id=" + networkId + " is not ready for GC as it has vms that are Running at the moment");
+            return false;
+        }
+
         return true;
     }
 


[42/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7823: test_snapshots.py - remove test case dependency on each other

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


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

Branch: refs/heads/statscollector-graphite
Commit: d4d8326a313b4dfecbeac04cfc51cbbf0a020563
Parents: a3d08ae
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Fri Oct 31 11:52:44 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Nov 10 17:14:08 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_snapshots.py | 46 ++++++++++-------------
 1 file changed, 20 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d4d8326a/test/integration/component/test_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_snapshots.py b/test/integration/component/test_snapshots.py
index 0811eb1..62f2f06 100644
--- a/test/integration/component/test_snapshots.py
+++ b/test/integration/component/test_snapshots.py
@@ -186,37 +186,17 @@ class TestSnapshots(cloudstackTestCase):
         cls.services["zoneid"] = cls.zone.id
         cls.services["diskoffering"] = cls.disk_offering.id
 
-        # Create VMs, NAT Rules etc
-        cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
-
-        cls.services["account"] = cls.account.name
-
         cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
                                             cls.services["service_offering"]
                                             )
-        cls.virtual_machine = cls.virtual_machine_with_disk = \
-                    VirtualMachine.create(
-                                cls.api_client,
-                                cls.services["server_with_disk"],
-                                templateid=cls.template.id,
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                serviceofferingid=cls.service_offering.id,
-                                mode=cls.services["mode"]
-                                )
 
         # Get Hypervisor Type
         cls.hypervisor = (get_hypervisor_type(cls.api_client)).lower()
 
         cls._cleanup = [
                         cls.service_offering,
-                        cls.disk_offering,
-                        cls.account,
+                        cls.disk_offering
                         ]
         return
 
@@ -233,7 +213,25 @@ class TestSnapshots(cloudstackTestCase):
         self.apiclient = self.testClient.getApiClient()
         self.hypervisor = str(self.testClient.getHypervisorInfo()).lower()
         self.dbclient = self.testClient.getDbConnection()
-        self.cleanup = []
+
+        # Create VMs, NAT Rules etc
+        self.account = Account.create(
+                            self.apiclient,
+                            self.services["account"],
+                            domainid=self.domain.id
+                            )
+
+        self.virtual_machine = self.virtual_machine_with_disk = \
+                    VirtualMachine.create(
+                                self.api_client,
+                                self.services["server_with_disk"],
+                                templateid=self.template.id,
+                                accountid=self.account.name,
+                                domainid=self.account.domainid,
+                                serviceofferingid=self.service_offering.id,
+                                mode=self.services["mode"]
+                                )
+        self.cleanup = [self.account, ]
         return
 
     def tearDown(self):
@@ -853,8 +851,6 @@ class TestSnapshots(cloudstackTestCase):
                                     serviceofferingid=self.service_offering.id,
                                     mode=self.services["mode"]
                                     )
-        self.cleanup.append(new_virtual_machine)
-
         try:
             #Login to VM & mount directory
             ssh = new_virtual_machine.get_ssh_client()
@@ -942,8 +938,6 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
                             domainid=cls.domain.id
                             )
 
-        cls.services["account"] = cls.account.name
-
         cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
                                             cls.services["service_offering"]


[48/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Adding support for backend snapshots to Xenserver625StorageProcessor


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

Branch: refs/heads/statscollector-graphite
Commit: 18091e96429fee85f3677037e5f51768b5ba80b6
Parents: 94ee16a
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Sat Nov 8 17:13:51 2014 -0700
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Mon Nov 10 22:41:00 2014 -0700

----------------------------------------------------------------------
 .../snapshot/StorageSystemSnapshotStrategy.java |   6 +-
 .../resource/Xenserver625StorageProcessor.java  | 113 +++++++++++++++++++
 2 files changed, 117 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/18091e96/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
index 2367825..c4946ab 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
@@ -219,9 +219,11 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase {
 
             // if the VM is not associated with a host
             if (hostId == null) {
-                sourceDetails = getSourceDetails(volumeInfo);
-
                 hostId = vmInstanceVO.getLastHostId();
+
+                if (hostId == null) {
+                    sourceDetails = getSourceDetails(volumeInfo);
+                }
             }
         }
         // volume to snapshot is not associated with a VM (could be a data disk in the detached state)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/18091e96/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
index 7e2a097..3529400 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
@@ -45,6 +45,7 @@ import com.cloud.agent.api.to.NfsTO;
 import com.cloud.agent.api.to.S3TO;
 import com.cloud.agent.api.to.SwiftTO;
 import com.cloud.exception.InternalErrorException;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.storage.Storage;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.xensource.xenapi.Connection;
@@ -867,6 +868,11 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor {
         Connection conn = hypervisorResource.getConnection();
         DataTO srcData = cmd.getSrcTO();
         DataTO destData = cmd.getDestTO();
+
+        if (srcData.getDataStore() instanceof PrimaryDataStoreTO && destData.getDataStore() instanceof NfsTO) {
+            return createTemplateFromSnapshot2(cmd);
+        }
+
         int wait = cmd.getWait();
         SnapshotObjectTO srcObj = (SnapshotObjectTO)srcData;
         TemplateObjectTO destObj = (TemplateObjectTO)destData;
@@ -964,4 +970,111 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor {
         }
     }
 
+    public Answer createTemplateFromSnapshot2(CopyCommand cmd) {
+        Connection conn = hypervisorResource.getConnection();
+
+        SnapshotObjectTO snapshotObjTO = (SnapshotObjectTO)cmd.getSrcTO();
+        TemplateObjectTO templateObjTO = (TemplateObjectTO)cmd.getDestTO();
+
+        if (!(snapshotObjTO.getDataStore() instanceof PrimaryDataStoreTO) || !(templateObjTO.getDataStore() instanceof NfsTO)) {
+            return null;
+        }
+
+        NfsTO destStore = null;
+        URI destUri = null;
+
+        try {
+            destStore = (NfsTO)templateObjTO.getDataStore();
+
+            destUri = new URI(destStore.getUrl());
+        } catch (Exception ex) {
+            s_logger.debug("Invalid URI", ex);
+
+            return new CopyCmdAnswer("Invalid URI: " + ex.toString());
+        }
+
+        SR srcSr = null;
+        SR destSr = null;
+
+        String destDir = templateObjTO.getPath();
+        VDI destVdi = null;
+
+        boolean result = false;
+
+        try {
+            Map<String, String> srcDetails = cmd.getOptions();
+
+            String iScsiName = srcDetails.get(DiskTO.IQN);
+            String storageHost = srcDetails.get(DiskTO.STORAGE_HOST);
+            String chapInitiatorUsername = srcDetails.get(DiskTO.CHAP_INITIATOR_USERNAME);
+            String chapInitiatorSecret = srcDetails.get(DiskTO.CHAP_INITIATOR_SECRET);
+
+            srcSr = hypervisorResource.getIscsiSR(conn, iScsiName, storageHost, iScsiName, chapInitiatorUsername, chapInitiatorSecret, true);
+
+            String destNfsPath = destUri.getHost() + ":" + destUri.getPath();
+            String localDir = "/var/cloud_mount/" + UUID.nameUUIDFromBytes(destNfsPath.getBytes());
+
+            mountNfs(conn, destUri.getHost() + ":" + destUri.getPath(), localDir);
+            makeDirectory(conn, localDir + "/" + destDir);
+
+            destSr = createFileSR(conn, localDir + "/" + destDir);
+
+            // there should only be one VDI in this SR
+            VDI srcVdi = srcSr.getVDIs(conn).iterator().next();
+
+            destVdi = srcVdi.copy(conn, destSr);
+
+            String nameLabel = "cloud-" + UUID.randomUUID().toString();
+
+            destVdi.setNameLabel(conn, nameLabel);
+
+            // scan makes XenServer pick up VDI physicalSize
+            destSr.scan(conn);
+
+            String templateUuid = destVdi.getUuid(conn);
+            String templateFilename = templateUuid + ".vhd";
+            long virtualSize = destVdi.getVirtualSize(conn);
+            long physicalSize = destVdi.getPhysicalUtilisation(conn);
+
+            // create the template.properties file
+            String templatePath = destNfsPath + "/" + destDir;
+
+            templatePath = templatePath.replaceAll("//", "/");
+
+            TemplateObjectTO newTemplate = new TemplateObjectTO();
+
+            newTemplate.setPath(destDir + "/" + templateFilename);
+            newTemplate.setFormat(Storage.ImageFormat.VHD);
+            newTemplate.setHypervisorType(HypervisorType.XenServer);
+            newTemplate.setSize(virtualSize);
+            newTemplate.setPhysicalSize(physicalSize);
+            newTemplate.setName(templateUuid);
+
+            result = true;
+
+            return new CopyCmdAnswer(newTemplate);
+        } catch (Exception ex) {
+            s_logger.error("Failed to create a template from a snapshot", ex);
+
+            return new CopyCmdAnswer("Failed to create a template from a snapshot: " + ex.toString());
+        } finally {
+            if (!result) {
+                if (destVdi != null) {
+                    try {
+                        destVdi.destroy(conn);
+                    } catch (Exception e) {
+                        s_logger.debug("Cleaned up leftover VDI on destination storage due to failure: ", e);
+                    }
+                }
+            }
+
+            if (srcSr != null) {
+                hypervisorResource.removeSR(conn, srcSr);
+            }
+
+            if (destSr != null) {
+                hypervisorResource.removeSR(conn, destSr);
+            }
+        }
+    }
 }


[33/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Merge branch '4.5'


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

Branch: refs/heads/statscollector-graphite
Commit: 55b6e3431bf3abe03389cf5714af8b0f3c7c4c43
Parents: 44b6773 de3eb88
Author: Rajani Karuturi <ra...@gmail.com>
Authored: Mon Nov 10 15:06:22 2014 +0530
Committer: Rajani Karuturi <ra...@gmail.com>
Committed: Mon Nov 10 15:06:22 2014 +0530

----------------------------------------------------------------------
 .../cloud/upgrade/DatabaseUpgradeChecker.java   | 30 +++++++++++---------
 1 file changed, 17 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/55b6e343/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
----------------------------------------------------------------------


[49/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CID-1251369: not null check changed to null check


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

Branch: refs/heads/statscollector-graphite
Commit: d2f28ea3ae063d44d8ec219a544fd0f70d344747
Parents: 18091e9
Author: Daan Hoogland <da...@onecht.net>
Authored: Tue Nov 11 09:32:09 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Tue Nov 11 09:32:09 2014 +0100

----------------------------------------------------------------------
 server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d2f28ea3/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
index 10449e3..bcb2242 100755
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -314,7 +314,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
         _accountMgr.checkAccess(CallContext.current().getCallingAccount(), null, true, volume);
 
         SnapshotInfo snapshot = snapshotFactory.getSnapshot(snapshotId, DataStoreRole.Primary);
-        if(snapshot != null)
+        if(snapshot == null)
         {
             s_logger.debug("Failed to create snapshot");
             throw new CloudRuntimeException("Failed to create snapshot");


[11/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Allow infrastructure to handle delete of volume from DB

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

Branch: refs/heads/statscollector-graphite
Commit: 27d6bff84504bdac9e973bdd37cc466dc4b8d7d6
Parents: 1c9775b
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Fri Nov 7 07:52:47 2014 -0700
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Fri Nov 7 07:52:47 2014 -0700

----------------------------------------------------------------------
 .../datastore/driver/ElastistorPrimaryDataStoreDriver.java        | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/27d6bff8/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
index 20c9289..5e6a32c 100755
--- a/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
@@ -231,9 +231,6 @@ public class ElastistorPrimaryDataStoreDriver extends CloudStackPrimaryDataStore
             }
 
             if (result) {
-
-                _volumeDao.deleteVolumesByInstance(volumeInfo.getId());
-
                 long usedBytes = storagePool.getUsedBytes();
                 long capacityIops = storagePool.getCapacityIops();
 


[08/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7859: Host tags are not getting removed in cloud.host_tags table when a Host is deleted from CS.


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

Branch: refs/heads/statscollector-graphite
Commit: 330bd2748e6936be2b27dec37c9c53711e74e6dc
Parents: 7c5bc4a
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Fri Nov 7 16:55:50 2014 +0530
Committer: Sanjay Tripathi <sa...@citrix.com>
Committed: Fri Nov 7 17:32:25 2014 +0530

----------------------------------------------------------------------
 engine/schema/src/com/cloud/host/dao/HostTagsDao.java     |  2 ++
 engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java | 10 ++++++++++
 server/src/com/cloud/resource/ResourceManagerImpl.java    |  7 +++++--
 3 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/330bd274/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/dao/HostTagsDao.java b/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
index 8901716..c811de9 100644
--- a/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
+++ b/engine/schema/src/com/cloud/host/dao/HostTagsDao.java
@@ -29,4 +29,6 @@ public interface HostTagsDao extends GenericDao<HostTagVO, Long> {
 
     List<String> getDistinctImplicitHostTags(List<Long> hostIds, String[] implicitHostTags);
 
+    void deleteTags(long hostId);
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/330bd274/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java b/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
index 7e8615a..e275e04 100644
--- a/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
+++ b/engine/schema/src/com/cloud/host/dao/HostTagsDaoImpl.java
@@ -72,6 +72,16 @@ public class HostTagsDaoImpl extends GenericDaoBase<HostTagVO, Long> implements
     }
 
     @Override
+    public void deleteTags(long hostId) {
+        TransactionLegacy txn = TransactionLegacy.currentTxn();
+        txn.start();
+        SearchCriteria<HostTagVO> sc = HostSearch.create();
+        sc.setParameters("hostId", hostId);
+        expunge(sc);
+        txn.commit();
+    }
+
+    @Override
     public void persist(long hostId, List<String> hostTags) {
         TransactionLegacy txn = TransactionLegacy.currentTxn();
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/330bd274/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index 5887783..5cc2d36 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -847,8 +847,11 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
         // delete host details
         _hostDetailsDao.deleteDetails(hostId);
 
-                // if host is GPU enabled, delete GPU entries
-                _hostGpuGroupsDao.deleteGpuEntries(hostId);
+        // if host is GPU enabled, delete GPU entries
+        _hostGpuGroupsDao.deleteGpuEntries(hostId);
+
+        // delete host tags
+        _hostTagsDao.deleteTags(hostId);
 
         host.setGuid(null);
         Long clusterId = host.getClusterId();


[28/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7763 Reservations for VMware VMs remain after dynamic scaling


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

Branch: refs/heads/statscollector-graphite
Commit: ea99ff1c8622eadf8024ee9922d5f2b2b18d4f80
Parents: cf27ecd
Author: Bharat Kumar <bh...@citrix.com>
Authored: Wed Oct 22 11:29:22 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Mon Nov 10 14:30:42 2014 +0530

----------------------------------------------------------------------
 .../src/com/cloud/hypervisor/vmware/resource/VmwareResource.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea99ff1c/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index e3bfbe5..7406ca0 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -1281,7 +1281,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
             VmwareHypervisorHost hyperHost = getHyperHost(context);
             VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(cmd.getVmName());
             VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
-            int ramMb = (int)(vmSpec.getMinRam() / (1024 * 1024));
+            int ramMb = getReservedMemoryMb(vmSpec);
             long hotaddIncrementSizeInMb;
             long hotaddMemoryLimitInMb;
             long requestedMaxMemoryInMb = vmSpec.getMaxRam() / (1024 * 1024);


[05/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Check to see if the Map<String, String> of capabilities passed back from the storage driver is null.

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

Branch: refs/heads/statscollector-graphite
Commit: 9338abb6f369dfa792b70335d216b5774c44dd1d
Parents: ebb96f5
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Thu Nov 6 19:49:44 2014 -0700
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Thu Nov 6 19:49:44 2014 -0700

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiResponseHelper.java        | 10 ++++++----
 server/src/com/cloud/template/TemplateManagerImpl.java | 10 ++++++----
 2 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9338abb6/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 8172987..f4be820 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -517,11 +517,13 @@ public class ApiResponseHelper implements ResponseGenerator {
 
         Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();
 
-        String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
-        Boolean supportsStorageSystemSnapshots = new Boolean(value);
+        if (mapCapabilities != null) {
+            String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
+            Boolean supportsStorageSystemSnapshots = new Boolean(value);
 
-        if (supportsStorageSystemSnapshots) {
-            return DataStoreRole.Primary;
+            if (supportsStorageSystemSnapshots) {
+                return DataStoreRole.Primary;
+            }
         }
 
         return DataStoreRole.Image;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9338abb6/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index da3940c..0da602c 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1485,11 +1485,13 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
 
         Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();
 
-        String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
-        Boolean supportsStorageSystemSnapshots = new Boolean(value);
+        if (mapCapabilities != null) {
+            String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
+            Boolean supportsStorageSystemSnapshots = new Boolean(value);
 
-        if (supportsStorageSystemSnapshots) {
-            return DataStoreRole.Primary;
+            if (supportsStorageSystemSnapshots) {
+                return DataStoreRole.Primary;
+            }
         }
 
         return DataStoreRole.Image;


[14/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7864: CPVM continues to be in Stopped state after a failure to start because of a management server restart.


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

Branch: refs/heads/statscollector-graphite
Commit: a275bd7ca4191f19defcfe106229a1bdc33c6d99
Parents: 392eaf3
Author: Min Chen <mi...@citrix.com>
Authored: Fri Nov 7 11:47:16 2014 -0800
Committer: Min Chen <mi...@citrix.com>
Committed: Fri Nov 7 16:36:05 2014 -0800

----------------------------------------------------------------------
 .../framework/jobs/dao/AsyncJobDao.java         |  2 ++
 .../framework/jobs/dao/AsyncJobDaoImpl.java     | 20 ++++++++++++++++++++
 .../jobs/impl/AsyncJobManagerImpl.java          | 14 ++++++++++++--
 3 files changed, 34 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a275bd7c/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
index 170da50..169cae9 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
@@ -39,4 +39,6 @@ public interface AsyncJobDao extends GenericDao<AsyncJobVO, Long> {
     void resetJobProcess(long msid, int jobResultCode, String jobResultMessage);
 
     List<AsyncJobVO> getExpiredCompletedJobs(Date cutTime, int limit);
+
+    List<AsyncJobVO> getResetJobs(long msid);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a275bd7c/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
index 612573f..0d024eb 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
@@ -186,4 +186,24 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long> implements
             s_logger.warn("Unable to reset job status for management server " + msid, e);
         }
     }
+
+    @Override
+    public List<AsyncJobVO> getResetJobs(long msid) {
+        SearchCriteria<AsyncJobVO> sc = pendingAsyncJobSearch.create();
+        sc.setParameters("status", JobInfo.Status.IN_PROGRESS);
+
+        // construct query: (job_executing_msid=msid OR (job_executing_msid IS NULL AND job_init_msid=msid))
+        SearchCriteria<AsyncJobVO> msQuery = createSearchCriteria();
+        msQuery.addOr("executingMsid", SearchCriteria.Op.EQ, msid);
+        SearchCriteria<AsyncJobVO> initMsQuery = createSearchCriteria();
+        initMsQuery.addAnd("executingMsid", SearchCriteria.Op.NULL);
+        initMsQuery.addAnd("initMsid", SearchCriteria.Op.EQ, msid);
+        msQuery.addOr("initMsId", SearchCriteria.Op.SC, initMsQuery);
+
+        sc.addAnd("executingMsid", SearchCriteria.Op.SC, msQuery);
+
+        Filter filter = new Filter(AsyncJobVO.class, "created", true, null, null);
+        return listIncludingRemovedBy(sc, filter);
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a275bd7c/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
index 548182a..91516d5 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
@@ -232,7 +232,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                 s_logger.debug("job-" + jobId + " no longer exists, we just log completion info here. " + jobStatus + ", resultCode: " + resultCode + ", result: " +
                     resultObject);
             }
-
+            // still purge item from queue to avoid any blocking
+            _queueMgr.purgeAsyncJobQueueItemId(jobId);
             return;
         }
 
@@ -240,7 +241,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("job-" + jobId + " is already completed.");
             }
-
+            // still purge item from queue to avoid any blocking
+            _queueMgr.purgeAsyncJobQueueItemId(jobId);
             return;
         }
 
@@ -547,6 +549,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     // guard final clause as well
                     try {
                         if (job.getSyncSource() != null) {
+                            // here check queue item one more time to double make sure that queue item is removed in case of any uncaught exception
+                            _queueMgr.purgeItem(job.getSyncSource().getId());
                             checkQueue(job.getSyncSource().getQueueId());
                         }
 
@@ -976,6 +980,12 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     _queueMgr.cleanupActiveQueueItems(msid, true);
                     // reset job status for all jobs running on this ms node
                     _jobDao.resetJobProcess(msid, ApiErrorCode.INTERNAL_ERROR.getHttpCode(), "job cancelled because of management server restart or shutdown");
+                    // purge those queue items for those cancelled jobs above, which may not be picked up by any MS node yet
+                    List<AsyncJobVO> cancelJobs = _jobDao.getResetJobs(msid);
+                    for (AsyncJobVO job : cancelJobs){
+                        _queueMgr.purgeAsyncJobQueueItemId(job.getId());
+                    }
+
                 }
             });
         } catch (Throwable e) {


[24/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Logrotate is called from crontab. Debian crontab does not include everything in it's path. Therefore reference to these bins need to be absoluut.

Signed-off-by: Daan Hoogland <da...@onecht.net>


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

Branch: refs/heads/statscollector-graphite
Commit: 1cc733bfd52e4106bce151ac1c7253b2e4873764
Parents: 54ec268
Author: Joris van Lieshout <jv...@schubergphilis.com>
Authored: Sat Nov 8 17:21:43 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Sun Nov 9 13:18:08 2014 +0100

----------------------------------------------------------------------
 systemvm/patches/debian/config/etc/logrotate.d/cloud      | 2 +-
 systemvm/patches/debian/config/etc/logrotate.d/conntrackd | 2 +-
 systemvm/patches/debian/config/etc/logrotate.d/rsyslog    | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1cc733bf/systemvm/patches/debian/config/etc/logrotate.d/cloud
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/cloud b/systemvm/patches/debian/config/etc/logrotate.d/cloud
index 37440ac..617b09b 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/cloud
+++ b/systemvm/patches/debian/config/etc/logrotate.d/cloud
@@ -22,6 +22,6 @@
         compress
         delaycompress
         postrotate
-                pkill socat > /dev/null
+                /usr/bin/pkill socat > /dev/null
         endscript
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1cc733bf/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/conntrackd b/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
index d09d752..8139191 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
+++ b/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
@@ -7,7 +7,7 @@
 
     postrotate
         if [ -e /var/run/conntrackd.sock ]; then
-            invoke-rc.d conntrackd restart > /dev/null
+            /usr/sbin/invoke-rc.d conntrackd restart > /dev/null
         fi
     endscript
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1cc733bf/systemvm/patches/debian/config/etc/logrotate.d/rsyslog
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/rsyslog b/systemvm/patches/debian/config/etc/logrotate.d/rsyslog
index d2a04ca..faa8776 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/rsyslog
+++ b/systemvm/patches/debian/config/etc/logrotate.d/rsyslog
@@ -7,7 +7,7 @@
 	delaycompress
 	compress
 	postrotate
-		invoke-rc.d rsyslog rotate > /dev/null
+		/usr/sbin/invoke-rc.d rsyslog rotate > /dev/null
 	endscript
 }
 
@@ -32,6 +32,6 @@
 	delaycompress
 	sharedscripts
 	postrotate
-		invoke-rc.d rsyslog rotate > /dev/null
+		/usr/sbin/invoke-rc.d rsyslog rotate > /dev/null
 	endscript
 }


[47/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Fixed the wrong if else statement


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

Branch: refs/heads/statscollector-graphite
Commit: 94ee16a719a19fae57e2be5ab6398ce979ed55e9
Parents: b662142
Author: Santhosh Edukulla <sa...@gmail.com>
Authored: Mon Nov 10 22:33:19 2014 +0530
Committer: Santhosh Edukulla <sa...@gmail.com>
Committed: Mon Nov 10 22:33:19 2014 +0530

----------------------------------------------------------------------
 .../com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java | 5 -----
 1 file changed, 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/94ee16a7/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
index 8c9ea69..cad2b58 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
@@ -1199,12 +1199,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
             if (disk.getFormat() == PhysicalDiskFormat.TAR) {
                 newDisk = destPool.createPhysicalDisk(name, PhysicalDiskFormat.DIR, Storage.ProvisioningType.THIN, disk.getVirtualSize());
             } else {
-                /* If the source device is on a RBD storage pool force the new disk to the same format (RAW) */
-                if (srcPool.getType() != StoragePoolType.RBD) {
                     newDisk = destPool.createPhysicalDisk(name, Storage.ProvisioningType.THIN, disk.getVirtualSize());
-                } else {
-                    newDisk = destPool.createPhysicalDisk(name, Storage.ProvisioningType.THIN, disk.getVirtualSize());
-                }
             }
         } else {
             newDisk = new KVMPhysicalDisk(destPool.getSourceDir() + "/" + name, name, destPool);


[38/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7866: Passing type value to list_hosts method so as to avoid listing SSVM and CPVM

Correcting hostid attribute

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


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

Branch: refs/heads/statscollector-graphite
Commit: b00f144c204bfa4ffa3db73c9d1fc9e86d79015c
Parents: 709bf07
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Mon Nov 10 11:58:18 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Nov 10 16:28:02 2014 +0530

----------------------------------------------------------------------
 .../maint/test_host_high_availability.py        | 22 ++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b00f144c/test/integration/component/maint/test_host_high_availability.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_host_high_availability.py b/test/integration/component/maint/test_host_high_availability.py
index ecc23f7..0d76f81 100644
--- a/test/integration/component/maint/test_host_high_availability.py
+++ b/test/integration/component/maint/test_host_high_availability.py
@@ -19,11 +19,20 @@
 """
 #Import Local Modules
 from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackAPI import (migrateVirtualMachine,
+                                  prepareHostForMaintenance,
+                                  cancelHostMaintenance)
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (Account,
+                             VirtualMachine,
+                             ServiceOffering)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_template,
+                               list_hosts,
+                               list_virtual_machines,
+                               list_service_offering)
 import time
 
 
@@ -490,6 +499,7 @@ class TestHostHighAvailability(cloudstackTestCase):
         #Find out Non-Suitable host for VM migration
         list_hosts_response = list_hosts(
             self.apiclient,
+            type="Routing"
         )
         self.assertEqual(
             isinstance(list_hosts_response, list),
@@ -505,7 +515,7 @@ class TestHostHighAvailability(cloudstackTestCase):
 
         notSuitableHost = None
         for host in list_hosts_response:
-            if not host.suitableformigration and host.hostid != vm.hostid:
+            if not host.suitableformigration and host.id != vm.hostid:
                 notSuitableHost = host
                 break
 


[20/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7421
Unnecessary exception in MS logs while removing default NIC from VM. Following changes are made:
1. Changed the exception from CloudRuntimeException to InvalidParameterValueExecption.
2. Moved out validation logic to UserVMManagerImpl from VirtualMachineManagerImpl.
3. Handling InvalidParameterValueException from async API calls so that they are not logged as ERROR in MS logs.


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

Branch: refs/heads/statscollector-graphite
Commit: e25de54b4c9cf8f55070b8aaca6494049f1fab0b
Parents: e6907ed
Author: Koushik Das <ko...@apache.org>
Authored: Tue Nov 4 17:34:07 2014 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Sat Nov 8 13:50:15 2014 +0530

----------------------------------------------------------------------
 .../com/cloud/vm/VirtualMachineManagerImpl.java | 12 ---------
 .../com/cloud/api/ApiAsyncJobDispatcher.java    |  4 ++-
 server/src/com/cloud/vm/UserVmManagerImpl.java  | 26 +++++++++++++-------
 3 files changed, 20 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e25de54b/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 4b1597a..d49364f 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -2978,18 +2978,6 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vmProfile.getVirtualMachine().getHypervisorType());
         VirtualMachineTO vmTO = hvGuru.implement(vmProfile);
 
-        // don't delete default NIC on a user VM
-        if (nic.isDefaultNic() && vm.getType() == VirtualMachine.Type.User) {
-            s_logger.warn("Failed to remove nic from " + vm + " in " + network + ", nic is default.");
-            throw new CloudRuntimeException("Failed to remove nic from " + vm + " in " + network + ", nic is default.");
-        }
-
-        // if specified nic is associated with PF/LB/Static NAT
-        if (rulesMgr.listAssociatedRulesForGuestNic(nic).size() > 0) {
-            throw new CloudRuntimeException("Failed to remove nic from " + vm + " in " + network +
-                    ", nic has associated Port forwarding or Load balancer or Static NAT rules.");
-        }
-
         NicProfile nicProfile =
                 new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), _networkModel.getNetworkRate(network.getId(), vm.getId()),
                         _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getVirtualMachine().getHypervisorType(), network));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e25de54b/server/src/com/cloud/api/ApiAsyncJobDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiAsyncJobDispatcher.java b/server/src/com/cloud/api/ApiAsyncJobDispatcher.java
index 71adf2a..0b7d681 100644
--- a/server/src/com/cloud/api/ApiAsyncJobDispatcher.java
+++ b/server/src/com/cloud/api/ApiAsyncJobDispatcher.java
@@ -37,6 +37,7 @@ import org.apache.cloudstack.framework.jobs.AsyncJobDispatcher;
 import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 import org.apache.cloudstack.jobs.JobInfo;
 
+import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.user.Account;
 import com.cloud.user.User;
 import com.cloud.utils.component.AdapterBase;
@@ -77,7 +78,6 @@ public class ApiAsyncJobDispatcher extends AdapterBase implements AsyncJobDispat
             String acctIdStr = params.get("ctxAccountId");
             String contextDetails = params.get("ctxDetails");
 
-
             Long userId = null;
             Account accountObject = null;
 
@@ -109,6 +109,8 @@ public class ApiAsyncJobDispatcher extends AdapterBase implements AsyncJobDispat
 
                 // serialize this to the async job table
                 _asyncJobMgr.completeAsyncJob(job.getId(), JobInfo.Status.SUCCEEDED, 0, ApiSerializerHelper.toSerializedString(cmdObj.getResponseObject()));
+            } catch (InvalidParameterValueException ipve) {
+                throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
             } finally {
                 CallContext.unregister();
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e25de54b/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 01a692d..1a024a3 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -37,7 +37,6 @@ import javax.naming.ConfigurationException;
 
 import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Logger;
-
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 import org.apache.cloudstack.affinity.AffinityGroupService;
@@ -1090,15 +1089,16 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
         UserVmVO vmInstance = _vmDao.findById(vmId);
         if (vmInstance == null) {
-            throw new InvalidParameterValueException("unable to find a virtual machine with id " + vmId);
+            throw new InvalidParameterValueException("Unable to find a virtual machine with id " + vmId);
         }
         NicVO nic = _nicDao.findById(nicId);
         if (nic == null) {
-            throw new InvalidParameterValueException("unable to find a nic with id " + nicId);
+            throw new InvalidParameterValueException("Unable to find a nic with id " + nicId);
         }
+
         NetworkVO network = _networkDao.findById(nic.getNetworkId());
         if (network == null) {
-            throw new InvalidParameterValueException("unable to find a network with id " + nic.getNetworkId());
+            throw new InvalidParameterValueException("Unable to find a network with id " + nic.getNetworkId());
         }
 
         // Perform permission check on VM
@@ -1107,19 +1107,28 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         // Verify that zone is not Basic
         DataCenterVO dc = _dcDao.findById(vmInstance.getDataCenterId());
         if (dc.getNetworkType() == DataCenter.NetworkType.Basic) {
-            throw new CloudRuntimeException("Zone " + vmInstance.getDataCenterId() + ", has a NetworkType of Basic. Can't remove a NIC from a VM on a Basic Network");
+            throw new InvalidParameterValueException("Zone " + vmInstance.getDataCenterId() + ", has a NetworkType of Basic. Can't remove a NIC from a VM on a Basic Network");
         }
 
-        //check to see if nic is attached to VM
+        // check to see if nic is attached to VM
         if (nic.getInstanceId() != vmId) {
-            throw new InvalidParameterValueException(nic + " is not a nic on  " + vmInstance);
+            throw new InvalidParameterValueException(nic + " is not a nic on " + vmInstance);
         }
 
         // Perform account permission check on network
         _accountMgr.checkAccess(caller, AccessType.UseEntry, false, network);
 
-        boolean nicremoved = false;
+        // don't delete default NIC on a user VM
+        if (nic.isDefaultNic() && vmInstance.getType() == VirtualMachine.Type.User) {
+            throw new InvalidParameterValueException("Unable to remove nic from " + vmInstance + " in " + network + ", nic is default.");
+        }
+
+        // if specified nic is associated with PF/LB/Static NAT
+        if (_rulesMgr.listAssociatedRulesForGuestNic(nic).size() > 0) {
+            throw new InvalidParameterValueException("Unable to remove nic from " + vmInstance + " in " + network + ", nic has associated Port forwarding or Load balancer or Static NAT rules.");
+        }
 
+        boolean nicremoved = false;
         try {
             nicremoved = _itMgr.removeNicFromVm(vmInstance, nic);
         } catch (ResourceUnavailableException e) {
@@ -1135,7 +1144,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
         s_logger.debug("Successful removal of " + network + " from " + vmInstance);
         return _vmDao.findById(vmInstance.getId());
-
     }
 
     @Override


[34/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7830: Usage Job fails with "Data too long for column 'user_name'"


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

Branch: refs/heads/statscollector-graphite
Commit: cd48720878960cffb2088cdd5e9293763bde3e7b
Parents: 55b6e34
Author: Damodar <da...@citrix.com>
Authored: Mon Nov 10 14:40:36 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Mon Nov 10 15:17:32 2014 +0530

----------------------------------------------------------------------
 setup/db/db/schema-441to450.sql | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cd487208/setup/db/db/schema-441to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-441to450.sql b/setup/db/db/schema-441to450.sql
index d9bc8e0..5f1ddc1 100644
--- a/setup/db/db/schema-441to450.sql
+++ b/setup/db/db/schema-441to450.sql
@@ -764,3 +764,5 @@ DELETE t1 FROM guest_os_hypervisor t1, guest_os_hypervisor t2 WHERE (t1.hypervis
 
 -- Set as removed built-in CentOS 5.3 template (if any) for XenServer, since CentOS 5.6 template already exists
 UPDATE `cloud`.`vm_template` SET removed=NOW() WHERE unique_name="centos53-x86_64" AND hypervisor_type="XenServer";
+
+ALTER TABLE `cloud_usage`.`usage_vpn_user` CHANGE `user_name` `user_name` VARCHAR(255);


[30/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7843: sync Job Failures always reported as success on Event Bus


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

Branch: refs/heads/statscollector-graphite
Commit: ca66062cd54305afaaa64d707a88fc11764e292d
Parents: 131c2f2
Author: Damodar <da...@citrix.com>
Authored: Wed Nov 5 17:19:46 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Mon Nov 10 14:33:28 2014 +0530

----------------------------------------------------------------------
 .../cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ca66062c/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
index 91516d5..d5f7f9d 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
@@ -253,7 +253,6 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Publish async job-" + jobId + " complete on message bus");
         }
-        publishOnEventBus(job, "complete"); // publish before the instance type and ID are wiped out
 
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Wake up jobs related to job-" + jobId);
@@ -291,6 +290,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
             }
         });
 
+        publishOnEventBus(job, "complete"); // publish before the instance type and ID are wiped out
+
         //
         // disable wakeup scheduling now, since all API jobs are currently using block-waiting for sub-jobs
         //


[27/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7760 Data disk size is not considering for primary storage resource limit check


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

Branch: refs/heads/statscollector-graphite
Commit: 991d783e0332d07cba18d046dfc7220a063f670f
Parents: ea99ff1
Author: Bharat Kumar <bh...@citrix.com>
Authored: Fri Oct 17 11:24:40 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Mon Nov 10 14:30:42 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/991d783e/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 8096841..65ae3da 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -2685,6 +2685,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
                     throw new InvalidParameterValueException("VM Creation failed. Volume size: " + diskSize + "GB is out of allowed range. Max: " + customDiskOfferingMaxSize
                             + " Min:" + customDiskOfferingMinSize);
                 }
+                size=size+diskSize*(1024*1024*1024);
             }
             size += _diskOfferingDao.findById(diskOfferingId).getDiskSize();
         }


[23/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Logrotate is called from crontab. Debian crontab does not include everything in it's path. Therefore reference to these bins need to be absoluut.

Signed-off-by: Daan Hoogland <da...@onecht.net>


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

Branch: refs/heads/statscollector-graphite
Commit: 1e1cc11d9ad617df1e53cbc7da658e9987d6cc21
Parents: 8378485
Author: Joris van Lieshout <jv...@schubergphilis.com>
Authored: Sat Nov 8 17:21:43 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Sun Nov 9 13:13:56 2014 +0100

----------------------------------------------------------------------
 systemvm/patches/debian/config/etc/logrotate.d/cloud      | 2 +-
 systemvm/patches/debian/config/etc/logrotate.d/conntrackd | 2 +-
 systemvm/patches/debian/config/etc/logrotate.d/rsyslog    | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1e1cc11d/systemvm/patches/debian/config/etc/logrotate.d/cloud
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/cloud b/systemvm/patches/debian/config/etc/logrotate.d/cloud
index 37440ac..617b09b 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/cloud
+++ b/systemvm/patches/debian/config/etc/logrotate.d/cloud
@@ -22,6 +22,6 @@
         compress
         delaycompress
         postrotate
-                pkill socat > /dev/null
+                /usr/bin/pkill socat > /dev/null
         endscript
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1e1cc11d/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/conntrackd b/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
index d09d752..8139191 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
+++ b/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
@@ -7,7 +7,7 @@
 
     postrotate
         if [ -e /var/run/conntrackd.sock ]; then
-            invoke-rc.d conntrackd restart > /dev/null
+            /usr/sbin/invoke-rc.d conntrackd restart > /dev/null
         fi
     endscript
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1e1cc11d/systemvm/patches/debian/config/etc/logrotate.d/rsyslog
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/rsyslog b/systemvm/patches/debian/config/etc/logrotate.d/rsyslog
index d2a04ca..faa8776 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/rsyslog
+++ b/systemvm/patches/debian/config/etc/logrotate.d/rsyslog
@@ -7,7 +7,7 @@
 	delaycompress
 	compress
 	postrotate
-		invoke-rc.d rsyslog rotate > /dev/null
+		/usr/sbin/invoke-rc.d rsyslog rotate > /dev/null
 	endscript
 }
 
@@ -32,6 +32,6 @@
 	delaycompress
 	sharedscripts
 	postrotate
-		invoke-rc.d rsyslog rotate > /dev/null
+		/usr/sbin/invoke-rc.d rsyslog rotate > /dev/null
 	endscript
 }


[32/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Merge branch '4.5'


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

Branch: refs/heads/statscollector-graphite
Commit: 44b6773f4075574a655907dbaa857b260a2f853f
Parents: ca66062 1cc733b
Author: Rajani Karuturi <ra...@gmail.com>
Authored: Mon Nov 10 15:05:38 2014 +0530
Committer: Rajani Karuturi <ra...@gmail.com>
Committed: Mon Nov 10 15:05:38 2014 +0530

----------------------------------------------------------------------

----------------------------------------------------------------------



[15/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7864: CPVM continues to be in Stopped state after a failure to start because of a management server restart.


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

Branch: refs/heads/statscollector-graphite
Commit: 3a2f6ffd4993a1fbd132bdd43c9e697a22b86d32
Parents: 27d6bff
Author: Min Chen <mi...@citrix.com>
Authored: Fri Nov 7 11:47:16 2014 -0800
Committer: Min Chen <mi...@citrix.com>
Committed: Fri Nov 7 16:37:05 2014 -0800

----------------------------------------------------------------------
 .../framework/jobs/dao/AsyncJobDao.java         |  2 ++
 .../framework/jobs/dao/AsyncJobDaoImpl.java     | 20 ++++++++++++++++++++
 .../jobs/impl/AsyncJobManagerImpl.java          | 14 ++++++++++++--
 3 files changed, 34 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a2f6ffd/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
index 170da50..169cae9 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
@@ -39,4 +39,6 @@ public interface AsyncJobDao extends GenericDao<AsyncJobVO, Long> {
     void resetJobProcess(long msid, int jobResultCode, String jobResultMessage);
 
     List<AsyncJobVO> getExpiredCompletedJobs(Date cutTime, int limit);
+
+    List<AsyncJobVO> getResetJobs(long msid);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a2f6ffd/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
index 612573f..0d024eb 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
@@ -186,4 +186,24 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long> implements
             s_logger.warn("Unable to reset job status for management server " + msid, e);
         }
     }
+
+    @Override
+    public List<AsyncJobVO> getResetJobs(long msid) {
+        SearchCriteria<AsyncJobVO> sc = pendingAsyncJobSearch.create();
+        sc.setParameters("status", JobInfo.Status.IN_PROGRESS);
+
+        // construct query: (job_executing_msid=msid OR (job_executing_msid IS NULL AND job_init_msid=msid))
+        SearchCriteria<AsyncJobVO> msQuery = createSearchCriteria();
+        msQuery.addOr("executingMsid", SearchCriteria.Op.EQ, msid);
+        SearchCriteria<AsyncJobVO> initMsQuery = createSearchCriteria();
+        initMsQuery.addAnd("executingMsid", SearchCriteria.Op.NULL);
+        initMsQuery.addAnd("initMsid", SearchCriteria.Op.EQ, msid);
+        msQuery.addOr("initMsId", SearchCriteria.Op.SC, initMsQuery);
+
+        sc.addAnd("executingMsid", SearchCriteria.Op.SC, msQuery);
+
+        Filter filter = new Filter(AsyncJobVO.class, "created", true, null, null);
+        return listIncludingRemovedBy(sc, filter);
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a2f6ffd/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
index 548182a..91516d5 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
@@ -232,7 +232,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                 s_logger.debug("job-" + jobId + " no longer exists, we just log completion info here. " + jobStatus + ", resultCode: " + resultCode + ", result: " +
                     resultObject);
             }
-
+            // still purge item from queue to avoid any blocking
+            _queueMgr.purgeAsyncJobQueueItemId(jobId);
             return;
         }
 
@@ -240,7 +241,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("job-" + jobId + " is already completed.");
             }
-
+            // still purge item from queue to avoid any blocking
+            _queueMgr.purgeAsyncJobQueueItemId(jobId);
             return;
         }
 
@@ -547,6 +549,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     // guard final clause as well
                     try {
                         if (job.getSyncSource() != null) {
+                            // here check queue item one more time to double make sure that queue item is removed in case of any uncaught exception
+                            _queueMgr.purgeItem(job.getSyncSource().getId());
                             checkQueue(job.getSyncSource().getQueueId());
                         }
 
@@ -976,6 +980,12 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     _queueMgr.cleanupActiveQueueItems(msid, true);
                     // reset job status for all jobs running on this ms node
                     _jobDao.resetJobProcess(msid, ApiErrorCode.INTERNAL_ERROR.getHttpCode(), "job cancelled because of management server restart or shutdown");
+                    // purge those queue items for those cancelled jobs above, which may not be picked up by any MS node yet
+                    List<AsyncJobVO> cancelJobs = _jobDao.getResetJobs(msid);
+                    for (AsyncJobVO job : cancelJobs){
+                        _queueMgr.purgeAsyncJobQueueItemId(job.getId());
+                    }
+
                 }
             });
         } catch (Throwable e) {


[46/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7873 Fixed the user vm details length issue for higher key lengths


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

Branch: refs/heads/statscollector-graphite
Commit: b6621428a94866be043df30d8e94e918bfcbf4bb
Parents: 97fa4a0
Author: Santhosh Edukulla <sa...@gmail.com>
Authored: Mon Nov 10 20:05:32 2014 +0530
Committer: Santhosh Edukulla <sa...@gmail.com>
Committed: Mon Nov 10 20:51:46 2014 +0530

----------------------------------------------------------------------
 engine/schema/src/com/cloud/vm/UserVmDetailVO.java | 2 +-
 setup/db/create-schema.sql                         | 2 +-
 setup/db/db/schema-441to450.sql                    | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6621428/engine/schema/src/com/cloud/vm/UserVmDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/UserVmDetailVO.java b/engine/schema/src/com/cloud/vm/UserVmDetailVO.java
index d1a6e63..2b169a3 100644
--- a/engine/schema/src/com/cloud/vm/UserVmDetailVO.java
+++ b/engine/schema/src/com/cloud/vm/UserVmDetailVO.java
@@ -39,7 +39,7 @@ public class UserVmDetailVO implements ResourceDetail {
     @Column(name = "name")
     private String name;
 
-    @Column(name = "value", length = 1024)
+    @Column(name = "value", length = 5120)
     private String value;
 
     @Column(name = "display")

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6621428/setup/db/create-schema.sql
----------------------------------------------------------------------
diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql
index f95b02f..b4786c0 100755
--- a/setup/db/create-schema.sql
+++ b/setup/db/create-schema.sql
@@ -1140,7 +1140,7 @@ CREATE TABLE `cloud`.`user_vm_details` (
   `id` bigint unsigned NOT NULL auto_increment,
   `vm_id` bigint unsigned NOT NULL COMMENT 'vm id',
   `name` varchar(255) NOT NULL,
-  `value` varchar(1024) NOT NULL,
+  `value` varchar(5120) NOT NULL,
   PRIMARY KEY (`id`),
   CONSTRAINT `fk_user_vm_details__vm_id` FOREIGN KEY `fk_user_vm_details__vm_id`(`vm_id`) REFERENCES `vm_instance`(`id`) ON DELETE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6621428/setup/db/db/schema-441to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-441to450.sql b/setup/db/db/schema-441to450.sql
index 5f1ddc1..0ee6c7f 100644
--- a/setup/db/db/schema-441to450.sql
+++ b/setup/db/db/schema-441to450.sql
@@ -766,3 +766,7 @@ DELETE t1 FROM guest_os_hypervisor t1, guest_os_hypervisor t2 WHERE (t1.hypervis
 UPDATE `cloud`.`vm_template` SET removed=NOW() WHERE unique_name="centos53-x86_64" AND hypervisor_type="XenServer";
 
 ALTER TABLE `cloud_usage`.`usage_vpn_user` CHANGE `user_name` `user_name` VARCHAR(255);
+
+--Increase key value size generated from RSA-8192 to be stored.
+ALTER TABLE `cloud`.`user_vm_details` MODIFY `value` VARCHAR(5120);
+


[17/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7868: Failed storage.PrimaryStorageDownloadCommand leaves corrupt VDIs in primary storage.


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

Branch: refs/heads/statscollector-graphite
Commit: e6907ed8df61d2453f65f7cc0299fb550b5c336c
Parents: 3a2f6ff
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Sat Nov 8 13:34:31 2014 +0530
Committer: Sanjay Tripathi <sa...@citrix.com>
Committed: Sat Nov 8 13:46:45 2014 +0530

----------------------------------------------------------------------
 .../xenserver/resource/CitrixResourceBase.java          | 10 ++++++++++
 scripts/vm/hypervisor/xenserver/vmopspremium            | 12 +++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e6907ed8/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index e3c3943..9b282d8 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -2747,6 +2747,16 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
                 try {
                     vdi.destroy(conn);
                 } catch (Exception e) {
+                    String msg = "Failed to destroy VDI : " + nameLabel + "due to " + e.toString() + "\n Force deleting VDI using system 'rm' command";
+                    s_logger.warn(msg);
+                    try {
+                        String srUUID = vdi.getSR(conn).getUuid(conn);
+                        String vdiUUID = vdi.getUuid(conn);
+                        String vdifile = "/var/run/sr-mount/" + srUUID + "/" + vdiUUID + ".vhd";
+                        String results = callHostPluginAsync(conn, "vmopspremium", "remove_corrupt_vdi", 10, "vdifile", vdifile);
+                    } catch (Exception e2) {
+                        s_logger.warn(e2);
+                    }
                 }
             }
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e6907ed8/scripts/vm/hypervisor/xenserver/vmopspremium
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmopspremium b/scripts/vm/hypervisor/xenserver/vmopspremium
index 5b9c34f..3b0b4ac 100755
--- a/scripts/vm/hypervisor/xenserver/vmopspremium
+++ b/scripts/vm/hypervisor/xenserver/vmopspremium
@@ -101,6 +101,16 @@ def copy_vhd_from_secondarystorage(session, args):
     return txt
 
 @echo
+def remove_corrupt_vdi(session, args):
+    vdifile = args['vdifile']
+    try:
+        cmd = ['rm', '-f', vdifile]
+        txt = util.pread2(cmd)
+    except:
+        txt = '10#failed'
+    return txt
+
+@echo
 def setup_heartbeat_sr(session, args):
     host = args['host']
     sr = args['sr']
@@ -146,4 +156,4 @@ def asmonitor(session, args):
         return 'fail'
 
 if __name__ == "__main__":
-    XenAPIPlugin.dispatch({"forceShutdownVM":forceShutdownVM, "upgrade_snapshot":upgrade_snapshot, "create_privatetemplate_from_snapshot":create_privatetemplate_from_snapshot, "copy_vhd_to_secondarystorage":copy_vhd_to_secondarystorage, "copy_vhd_from_secondarystorage":copy_vhd_from_secondarystorage, "setup_heartbeat_sr":setup_heartbeat_sr, "setup_heartbeat_file":setup_heartbeat_file, "heartbeat": heartbeat, "asmonitor": asmonitor})
+    XenAPIPlugin.dispatch({"forceShutdownVM":forceShutdownVM, "upgrade_snapshot":upgrade_snapshot, "create_privatetemplate_from_snapshot":create_privatetemplate_from_snapshot, "copy_vhd_to_secondarystorage":copy_vhd_to_secondarystorage, "copy_vhd_from_secondarystorage":copy_vhd_from_secondarystorage, "setup_heartbeat_sr":setup_heartbeat_sr, "setup_heartbeat_file":setup_heartbeat_file, "heartbeat": heartbeat, "asmonitor": asmonitor, "remove_corrupt_vdi": remove_corrupt_vdi})


[22/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7869: Add simulator support for findHostsForMigration API


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

Branch: refs/heads/statscollector-graphite
Commit: 54ec268b7e1523bb2bb8cae216e173b34895d651
Parents: 4d08bb8
Author: Koushik Das <ko...@apache.org>
Authored: Sat Nov 8 13:46:24 2014 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Sat Nov 8 13:50:43 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/server/ManagementServerImpl.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ec268b/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 697d1c4..deb2424 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1123,7 +1123,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         }
 
         if (!vm.getHypervisorType().equals(HypervisorType.XenServer) && !vm.getHypervisorType().equals(HypervisorType.VMware) && !vm.getHypervisorType().equals(HypervisorType.KVM)
-                && !vm.getHypervisorType().equals(HypervisorType.Ovm) && !vm.getHypervisorType().equals(HypervisorType.Hyperv) && !vm.getHypervisorType().equals(HypervisorType.LXC)) {
+                && !vm.getHypervisorType().equals(HypervisorType.Ovm) && !vm.getHypervisorType().equals(HypervisorType.Hyperv) && !vm.getHypervisorType().equals(HypervisorType.LXC)
+                && !vm.getHypervisorType().equals(HypervisorType.Simulator)) {
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug(vm + " is not XenServer/VMware/KVM/OVM/Hyperv, cannot migrate this VM.");
             }


[12/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
BUG-ID: CS-27191: CPVM continues to be in Stopped state after a failure
    to start because of a management server restart. Reviewed-by:
Anthony


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

Branch: refs/heads/statscollector-graphite
Commit: d065bcf9b45d9bec8e9a481cf6092967d5107a9e
Parents: b1915f3
Author: Min Chen <mi...@citrix.com>
Authored: Fri Nov 7 11:47:16 2014 -0800
Committer: Min Chen <mi...@citrix.com>
Committed: Fri Nov 7 15:37:00 2014 -0800

----------------------------------------------------------------------
 .../framework/jobs/dao/AsyncJobDao.java         |  2 ++
 .../framework/jobs/dao/AsyncJobDaoImpl.java     | 20 ++++++++++++++++++++
 .../jobs/impl/AsyncJobManagerImpl.java          | 14 ++++++++++++--
 3 files changed, 34 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d065bcf9/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
index 170da50..169cae9 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
@@ -39,4 +39,6 @@ public interface AsyncJobDao extends GenericDao<AsyncJobVO, Long> {
     void resetJobProcess(long msid, int jobResultCode, String jobResultMessage);
 
     List<AsyncJobVO> getExpiredCompletedJobs(Date cutTime, int limit);
+
+    List<AsyncJobVO> getResetJobs(long msid);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d065bcf9/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
index 612573f..0d024eb 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
@@ -186,4 +186,24 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long> implements
             s_logger.warn("Unable to reset job status for management server " + msid, e);
         }
     }
+
+    @Override
+    public List<AsyncJobVO> getResetJobs(long msid) {
+        SearchCriteria<AsyncJobVO> sc = pendingAsyncJobSearch.create();
+        sc.setParameters("status", JobInfo.Status.IN_PROGRESS);
+
+        // construct query: (job_executing_msid=msid OR (job_executing_msid IS NULL AND job_init_msid=msid))
+        SearchCriteria<AsyncJobVO> msQuery = createSearchCriteria();
+        msQuery.addOr("executingMsid", SearchCriteria.Op.EQ, msid);
+        SearchCriteria<AsyncJobVO> initMsQuery = createSearchCriteria();
+        initMsQuery.addAnd("executingMsid", SearchCriteria.Op.NULL);
+        initMsQuery.addAnd("initMsid", SearchCriteria.Op.EQ, msid);
+        msQuery.addOr("initMsId", SearchCriteria.Op.SC, initMsQuery);
+
+        sc.addAnd("executingMsid", SearchCriteria.Op.SC, msQuery);
+
+        Filter filter = new Filter(AsyncJobVO.class, "created", true, null, null);
+        return listIncludingRemovedBy(sc, filter);
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d065bcf9/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
index 548182a..91516d5 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
@@ -232,7 +232,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                 s_logger.debug("job-" + jobId + " no longer exists, we just log completion info here. " + jobStatus + ", resultCode: " + resultCode + ", result: " +
                     resultObject);
             }
-
+            // still purge item from queue to avoid any blocking
+            _queueMgr.purgeAsyncJobQueueItemId(jobId);
             return;
         }
 
@@ -240,7 +241,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("job-" + jobId + " is already completed.");
             }
-
+            // still purge item from queue to avoid any blocking
+            _queueMgr.purgeAsyncJobQueueItemId(jobId);
             return;
         }
 
@@ -547,6 +549,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     // guard final clause as well
                     try {
                         if (job.getSyncSource() != null) {
+                            // here check queue item one more time to double make sure that queue item is removed in case of any uncaught exception
+                            _queueMgr.purgeItem(job.getSyncSource().getId());
                             checkQueue(job.getSyncSource().getQueueId());
                         }
 
@@ -976,6 +980,12 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     _queueMgr.cleanupActiveQueueItems(msid, true);
                     // reset job status for all jobs running on this ms node
                     _jobDao.resetJobProcess(msid, ApiErrorCode.INTERNAL_ERROR.getHttpCode(), "job cancelled because of management server restart or shutdown");
+                    // purge those queue items for those cancelled jobs above, which may not be picked up by any MS node yet
+                    List<AsyncJobVO> cancelJobs = _jobDao.getResetJobs(msid);
+                    for (AsyncJobVO job : cancelJobs){
+                        _queueMgr.purgeAsyncJobQueueItemId(job.getId());
+                    }
+
                 }
             });
         } catch (Throwable e) {


[06/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Allow infrastructure to handle delete of volume from DB


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

Branch: refs/heads/statscollector-graphite
Commit: 7c5bc4ae7eedeb3a7f3bf96362107c39064ca103
Parents: 9338abb
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Thu Nov 6 21:34:05 2014 -0700
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Thu Nov 6 22:54:20 2014 -0700

----------------------------------------------------------------------
 .../storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java  | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c5bc4ae/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
index f66b5a1..008693c 100644
--- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
@@ -465,8 +465,6 @@ public class SolidFirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
 
                 _volumeDetailsDao.removeDetails(volumeId);
 
-                _volumeDao.deleteVolumesByInstance(volumeId);
-
                 StoragePoolVO storagePool = _storagePoolDao.findById(storagePoolId);
 
                 // getUsedBytes(StoragePool) will not include the volume to delete because it has already been deleted by this point


[41/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7856: test_vpc_network_pf_rules.py - Check if httpd service is running or not, if not, start it

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


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

Branch: refs/heads/statscollector-graphite
Commit: a3d08aebb70bff102cb898d8c979f14cecc275cd
Parents: fa8f0a4
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Thu Nov 6 18:23:08 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Nov 10 17:10:11 2014 +0530

----------------------------------------------------------------------
 .../component/test_vpc_network_pfrules.py       | 51 ++++++++++++++------
 1 file changed, 36 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3d08aeb/test/integration/component/test_vpc_network_pfrules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_pfrules.py b/test/integration/component/test_vpc_network_pfrules.py
index c3a8161..e49642b 100644
--- a/test/integration/component/test_vpc_network_pfrules.py
+++ b/test/integration/component/test_vpc_network_pfrules.py
@@ -18,7 +18,7 @@
 """ Component tests for VPC network functionality - Port Forwarding Rules.
 """
 from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
 from marvin.lib.base import (stopRouter,
                                          startRouter,
                                          Account,
@@ -327,20 +327,31 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
                 else:
                     self.debug("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
 
-    def check_wget_from_vm(self, vm, public_ip, testnegative=False):
+    def check_wget_from_vm(self, vm, public_ip, network=None, testnegative=False, isVmAccessible=True):
         import urllib
         self.debug("Checking if we can wget from a VM=%s http server on public_ip=%s"  % (vm.name, public_ip.ipaddress.ipaddress))
         try:
+                if not isVmAccessible:
+                    self.create_natrule(vm, public_ip, network)
+                # Start httpd service on VM first
+                sshClient = vm.get_ssh_client()
+                sshClient.execute("service httpd start")
+                time.sleep(5)
+                ssh_response = str(sshClient.execute("service httpd status")).lower()
+                self.debug("httpd service status is: %s" % ssh_response)
+                if not "running" in ssh_response:
+                    raise Exception("Failed to start httpd service")
+
                 urllib.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress, filename="test.html")
                 if not testnegative:
                     self.debug("Successesfull to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
                 else:
                     self.fail("Successesfull to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
-        except:
+        except Exception as e:
                 if not testnegative:
-                    self.fail("Failed to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
+                    self.fail("Failed to wget from VM=%s http server on public_ip=%s: %s" % (vm.name, public_ip.ipaddress.ipaddress, e))
                 else:
-                    self.debug("Failed to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
+                    self.debug("Failed to wget from VM=%s http server on public_ip=%s: %s" % (vm.name, public_ip.ipaddress.ipaddress, e))
 
     def create_natrule(self, vm, public_ip, network, services=None):
         self.debug("Creating NAT rule in network for vm with public IP")
@@ -687,7 +698,8 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         nat_rule.delete(self.apiclient)
         self.start_vpcrouter(router)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
-        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
+        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
+                isVmAccessible=False, network=network_1)
         return
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
@@ -717,7 +729,8 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         http_rule.delete(self.apiclient)
         nat_rule.delete(self.apiclient)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
-        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
+        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
+                isVmAccessible=False, network=network_1)
         return
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
@@ -781,10 +794,14 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=True)
         self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=True)
         self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=True)
-        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
-        self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True)
-        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True)
-        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True)
+        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
+                isVmAccessible=False, network=network_1)
+        self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True,
+                isVmAccessible=False, network=network_1)
+        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True,
+                isVmAccessible=False, network=network_2)
+        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True,
+                isVmAccessible=False, network=network_2)
         return
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
@@ -843,8 +860,12 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=True)
         self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=True)
         self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=True)
-        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
-        self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True)
-        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True)
-        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True)
+        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
+                isVmAccessible=False, network=network_1)
+        self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True,
+                isVmAccessible=False, network=network_1)
+        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True,
+                isVmAccessible=False, network=network_2)
+        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True,
+                isVmAccessible=False, network=network_2)
         return


[29/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7851:MS does not start after the VM it is running on is rebooted


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

Branch: refs/heads/statscollector-graphite
Commit: 131c2f2014f69685b200b5304be88d9b1da3a2c9
Parents: 991d783
Author: Damodar <da...@citrix.com>
Authored: Thu Nov 6 12:04:30 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Mon Nov 10 14:31:43 2014 +0530

----------------------------------------------------------------------
 packaging/centos63/cloud-management.rc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/131c2f20/packaging/centos63/cloud-management.rc
----------------------------------------------------------------------
diff --git a/packaging/centos63/cloud-management.rc b/packaging/centos63/cloud-management.rc
index eaabd30..6d28748 100755
--- a/packaging/centos63/cloud-management.rc
+++ b/packaging/centos63/cloud-management.rc
@@ -87,7 +87,8 @@ handle_pid_file() {
 }
 
 start() {
-    source $(dirname $0)/tomcat.sh
+    readpath=$(readlink -f $0)
+    source `dirname $readpath`/tomcat.sh
 }
 
 # See how we were called.


[03/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
system vm image build process, needs to build an old version of qemu image, otherwise, it won't work on RHEL 6


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

Branch: refs/heads/statscollector-graphite
Commit: f506f7c427caf2796e9ef09f8fd394f557ba1ff2
Parents: 812b012
Author: Edison Su <su...@gmail.com>
Authored: Thu Nov 6 15:40:37 2014 -0800
Committer: Edison Su <su...@gmail.com>
Committed: Thu Nov 6 15:40:37 2014 -0800

----------------------------------------------------------------------
 tools/appliance/build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f506f7c4/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 29d92ca..51abb38 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -90,7 +90,7 @@ set -e
 
 # Export for KVM
 vboxmanage internalcommands converttoraw -format vdi "$hdd_path" raw.img
-qemu-img convert -f raw -c -O qcow2 raw.img $appliance-$branch-kvm.qcow2
+qemu-img convert -o compat=0.10 -f raw -c -O qcow2 raw.img $appliance-$branch-kvm.qcow2
 rm raw.img
 bzip2 $appliance-$branch-kvm.qcow2
 echo "$appliance exported for KVM: dist/$appliance-$branch-kvm.qcow2.bz2"


[39/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7863: Fix the script 'test_vpc_vms_deployment.py' - Test Cases failing on Simulator as Testcases try to ssh to the VMs

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


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

Branch: refs/heads/statscollector-graphite
Commit: aed6e95e5d17b2348d1f45f6319445360d3c6361
Parents: b00f144
Author: Chandan Purushothama <Ch...@citrix.com>
Authored: Fri Nov 7 15:32:45 2014 -0800
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Nov 10 16:32:39 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_vpc_vms_deployment.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aed6e95e/test/integration/component/test_vpc_vms_deployment.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_vms_deployment.py b/test/integration/component/test_vpc_vms_deployment.py
index e61b2f8..f8aa556 100644
--- a/test/integration/component/test_vpc_vms_deployment.py
+++ b/test/integration/component/test_vpc_vms_deployment.py
@@ -1798,7 +1798,7 @@ class TestVMDeployVPC(cloudstackTestCase):
                              )
         return
 
-    @attr(tags=["advanced", "intervlan"], required_hardware="false")
+    @attr(tags=["advanced", "intervlan"], required_hardware="true")
     def test_07_delete_network_with_rules(self):
         """ Test delete network that has PF/staticNat/LB rules/Network Acl
         """
@@ -2352,7 +2352,7 @@ class TestVMDeployVPC(cloudstackTestCase):
                          )
         return
 
-    @attr(tags=["advanced", "intervlan"], required_hardware="false")
+    @attr(tags=["advanced", "intervlan"], required_hardware="true")
     def test_08_ip_reallocation_CS5986(self):
         """
         @Desc: Test to verify dnsmasq dhcp conflict issue due to /ect/hosts not getting udpated


[21/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7867: Delete network resulting in exception
Publish event was getting called from within a DB transaction which is not allowed.


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

Branch: refs/heads/statscollector-graphite
Commit: 4d08bb89355a68e8a0e9a2f6654889d008c29ebd
Parents: e25de54
Author: Koushik Das <ko...@apache.org>
Authored: Sat Nov 8 13:17:50 2014 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Sat Nov 8 13:50:31 2014 +0530

----------------------------------------------------------------------
 .../engine/orchestration/NetworkOrchestrator.java           | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4d08bb89/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index ab5a21c..553bca1 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -2278,10 +2278,6 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                                 NetworkAccountVO networkAccount = _networkAccountDao.getAccountNetworkMapByNetworkId(networkFinal.getId());
                                 if (networkAccount != null)
                                     _networkAccountDao.remove(networkAccount.getId());
-
-                                // remove its related ACL permission
-                                Pair<Class<?>, Long> networkMsg = new Pair<Class<?>, Long>(Network.class, networkFinal.getId());
-                                _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, networkMsg);
                             }
 
                             NetworkOffering ntwkOff = _entityMgr.findById(NetworkOffering.class, networkFinal.getNetworkOfferingId());
@@ -2292,6 +2288,11 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                         }
                     }
                 });
+                if (_networksDao.findById(network.getId()) == null) {
+                    // remove its related ACL permission
+                    Pair<Class<?>, Long> networkMsg = new Pair<Class<?>, Long>(Network.class, networkFinal.getId());
+                    _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, networkMsg);
+                }
                 return true;
             } catch (CloudRuntimeException e) {
                 s_logger.error("Failed to delete network", e);


[26/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7721. Runtime exception while trying to release lock on template_spool_ref.
When a template a copied from a secondary to primary, we were trying to release a lock
twice, once in the create/copy base image function and in the create/copy base image
complete callback routine. This caused the exception as reported in the bug. Fixed by
updating the code make sure we release the lock in copy base image function only as
this is the place we took acquired the lock.


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

Branch: refs/heads/statscollector-graphite
Commit: cf27ecd91d22ba87930d7b50f1411afa38914351
Parents: a8b89be
Author: Devdeep Singh <de...@gmail.com>
Authored: Mon Nov 10 10:36:01 2014 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Mon Nov 10 13:22:39 2014 +0530

----------------------------------------------------------------------
 .../org/apache/cloudstack/storage/volume/VolumeServiceImpl.java    | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf27ecd9/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index 21e65f9..9c45cb8 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -559,14 +559,12 @@ public class VolumeServiceImpl implements VolumeService {
         DataObject templateOnPrimaryStoreObj = context.destObj;
         if (!result.isSuccess()) {
             templateOnPrimaryStoreObj.processEvent(Event.OperationFailed);
-            _tmpltPoolDao.releaseFromLockTable(context.getTemplatePoolId());
             res.setResult(result.getResult());
             future.complete(res);
             return null;
         }
 
         templateOnPrimaryStoreObj.processEvent(Event.OperationSuccessed, result.getAnswer());
-        _tmpltPoolDao.releaseFromLockTable(context.getTemplatePoolId());
         createVolumeFromBaseImageAsync(context.volume, templateOnPrimaryStoreObj, context.dataStore, future);
         return null;
     }


[44/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7818: Fixing test_escalations_instances.py, Removing dependency of test cases on each other

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


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

Branch: refs/heads/statscollector-graphite
Commit: 46802557e81c4fb114367b05fd55ea87b16aeeb5
Parents: d4d8326
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Thu Oct 30 18:05:41 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Nov 10 17:22:12 2014 +0530

----------------------------------------------------------------------
 .../component/test_escalations_instances.py     | 4434 +++++++++---------
 1 file changed, 2273 insertions(+), 2161 deletions(-)
----------------------------------------------------------------------



[07/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Allow infrastructure to handle delete of volume from DB

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

Branch: refs/heads/statscollector-graphite
Commit: 17e8d9e2be87c56a659cd6a21fb321d8b6f36301
Parents: f506f7c
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Thu Nov 6 22:58:35 2014 -0700
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Thu Nov 6 22:58:35 2014 -0700

----------------------------------------------------------------------
 .../storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java  | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/17e8d9e2/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
index d61258b..dcbabe6 100644
--- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java
@@ -413,8 +413,6 @@ public class SolidFirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
 
                 _volumeDetailsDao.removeDetails(volumeId);
 
-                _volumeDao.deleteVolumesByInstance(volumeId);
-
                 StoragePoolVO storagePool = _storagePoolDao.findById(storagePoolId);
 
                 // getUsedBytes(StoragePool) will not include the volume to delete because it has already been deleted by this point


[19/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7867: Delete network resulting in exception
Publish event was getting called from within a DB transaction which is not allowed.


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

Branch: refs/heads/statscollector-graphite
Commit: 49115e03331f89f9032a6689fb6e6b5661fb783d
Parents: 6a6d4d8
Author: Koushik Das <ko...@apache.org>
Authored: Sat Nov 8 13:17:50 2014 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Sat Nov 8 13:46:54 2014 +0530

----------------------------------------------------------------------
 .../engine/orchestration/NetworkOrchestrator.java           | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/49115e03/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index 8b47289..f077db9 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -2278,10 +2278,6 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                                 NetworkAccountVO networkAccount = _networkAccountDao.getAccountNetworkMapByNetworkId(networkFinal.getId());
                                 if (networkAccount != null)
                                     _networkAccountDao.remove(networkAccount.getId());
-
-                                // remove its related ACL permission
-                                Pair<Class<?>, Long> networkMsg = new Pair<Class<?>, Long>(Network.class, networkFinal.getId());
-                                _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, networkMsg);
                             }
 
                             NetworkOffering ntwkOff = _entityMgr.findById(NetworkOffering.class, networkFinal.getNetworkOfferingId());
@@ -2292,6 +2288,11 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                         }
                     }
                 });
+                if (_networksDao.findById(network.getId()) == null) {
+                    // remove its related ACL permission
+                    Pair<Class<?>, Long> networkMsg = new Pair<Class<?>, Long>(Network.class, networkFinal.getId());
+                    _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, networkMsg);
+                }
                 return true;
             } catch (CloudRuntimeException e) {
                 s_logger.error("Failed to delete network", e);


[45/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7871: allow VM and template details update using update APIs

Allows updating details (key/value) pair which updatse entries
invm_template_details and user_vm_details tables using updateVM and updateTemplate
APIs. This allows sys admins to update nics, controllers etc without DB hacking.

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


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

Branch: refs/heads/statscollector-graphite
Commit: 97fa4a023e2346b3b9f56bf213ed4125c371ca6d
Parents: 4680255
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Nov 10 17:51:25 2014 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Nov 10 17:51:57 2014 +0530

----------------------------------------------------------------------
 .../cloudstack/api/BaseUpdateTemplateOrIsoCmd.java | 17 ++++++++++++++++-
 .../api/command/user/vm/UpdateVMCmd.java           | 16 ++++++++++++++++
 .../com/cloud/template/TemplateManagerImpl.java    |  8 +++++++-
 server/src/com/cloud/vm/UserVmManagerImpl.java     |  6 ++++++
 4 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/97fa4a02/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
index 2350f6b..2754b25 100644
--- a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
@@ -22,6 +22,9 @@ import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
 import org.apache.cloudstack.api.response.GuestOSResponse;
 import org.apache.cloudstack.api.response.TemplateResponse;
 
+import java.util.Collection;
+import java.util.Map;
+
 public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
     public static final Logger s_logger = Logger.getLogger(UpdateIsoCmd.class.getName());
 
@@ -64,6 +67,9 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
     @Parameter(name = ApiConstants.ROUTING, type = CommandType.BOOLEAN, description = "true if the template type is routing i.e., if template is used to deploy router")
     protected Boolean isRoutingType;
 
+    @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details in key/value pairs.")
+    protected Map details;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -107,4 +113,13 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
     public Boolean isRoutingType() {
         return isRoutingType;
     }
-}
+
+    public Map getDetails() {
+        if (this.details == null || this.details.isEmpty()) {
+            return null;
+        }
+
+        Collection paramsCollection = this.details.values();
+        return (Map) (paramsCollection.toArray())[0];
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/97fa4a02/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
index d185b91..6954832 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
@@ -38,6 +38,9 @@ import com.cloud.user.Account;
 import com.cloud.uservm.UserVm;
 import com.cloud.vm.VirtualMachine;
 
+import java.util.Collection;
+import java.util.Map;
+
 @APICommand(name = "updateVirtualMachine", description="Updates properties of a virtual machine. The VM has to be stopped and restarted for the " +
         "new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. " +
         "Therefore, stop the VM manually before issuing this call.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
@@ -90,6 +93,9 @@ public class UpdateVMCmd extends BaseCustomIdCmd {
     @Parameter(name = ApiConstants.INSTANCE_NAME, type = CommandType.STRING, description = "instance name of the user vm", since = "4.4", authorized = {RoleType.Admin})
     private String instanceName;
 
+    @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details in key/value pairs.")
+    protected Map details;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -129,6 +135,16 @@ public class UpdateVMCmd extends BaseCustomIdCmd {
     public String getInstanceName() {
         return instanceName;
     }
+
+    public Map getDetails() {
+        if (this.details == null || this.details.isEmpty()) {
+            return null;
+        }
+
+        Collection paramsCollection = this.details.values();
+        return (Map) (paramsCollection.toArray())[0];
+    }
+
 /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/97fa4a02/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index 0da602c..aac040b 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1778,6 +1778,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
         Boolean isRoutingTemplate = cmd.isRoutingType();
         Boolean bootable = cmd.isBootable();
         Integer sortKey = cmd.getSortKey();
+        Map details = cmd.getDetails();
         Account account = CallContext.current().getCallingAccount();
 
         // verify that template exists
@@ -1800,7 +1801,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
 
         boolean updateNeeded =
                 !(name == null && displayText == null && format == null && guestOSId == null && passwordEnabled == null && bootable == null && sortKey == null &&
-                        isDynamicallyScalable == null && isRoutingTemplate == null);
+                        isDynamicallyScalable == null && isRoutingTemplate == null && details == null);
         if (!updateNeeded) {
             return template;
         }
@@ -1860,6 +1861,11 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
             }
         }
 
+        if (details != null && !details.isEmpty()) {
+            template.setDetails(details);
+            _tmpltDao.saveDetails(template);
+        }
+
         _tmpltDao.update(id, template);
 
         return _tmpltDao.findById(id);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/97fa4a02/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 65ae3da..0cab57c 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1902,6 +1902,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         String userData = cmd.getUserData();
         Boolean isDynamicallyScalable = cmd.isDynamicallyScalable();
         String hostName = cmd.getHostName();
+        Map details = cmd.getDetails();
         Account caller = CallContext.current().getCallingAccount();
 
         // Input validation and permission checks
@@ -1941,6 +1942,11 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
         }
 
+        if (details != null && !details.isEmpty()) {
+            vmInstance.setDetails(details);
+            _vmDao.saveDetails(vmInstance);
+        }
+
         return updateVirtualMachine(id, displayName, group, ha, isDisplayVm, osTypeId, userData, isDynamicallyScalable,
                 cmd.getHttpMethod(), cmd.getCustomId(), hostName, cmd.getInstanceName());
     }


[50/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7583: Send VmStats to Graphite host when configured

This allows external processing of VmStats information without using
the usage server of CloudStack

Statistics are being send to Graphite using UDP and not TCP.

UDP is used to prevent the management server waiting for TCP timeouts
when the Graphite server is unavailable


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

Branch: refs/heads/statscollector-graphite
Commit: e06a814d71d102ffb06b41400d013782210a1174
Parents: d2f28ea
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Fri Sep 19 16:58:00 2014 +0200
Committer: Wido den Hollander <wi...@widodh.nl>
Committed: Tue Nov 11 10:47:48 2014 +0100

----------------------------------------------------------------------
 server/src/com/cloud/configuration/Config.java  |   5 +-
 server/src/com/cloud/server/StatsCollector.java | 102 +++++++++++++++
 setup/db/db/schema-441to450.sql                 |   1 -
 setup/db/db/schema-450to460.sql                 |   2 +
 .../utils/graphite/GraphiteClient.java          | 125 +++++++++++++++++++
 .../utils/graphite/GraphiteException.java       |  31 +++++
 6 files changed, 264 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e06a814d/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 5ac0e90..435b0d8 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -2056,7 +2056,10 @@ public enum Config {
     PublishAlertEvent("Advanced", ManagementServer.class, Boolean.class, "publish.alert.events", "true", "enable or disable publishing of alert events on the event bus", null),
     PublishResourceStateEvent("Advanced", ManagementServer.class, Boolean.class, "publish.resource.state.events", "true", "enable or disable publishing of alert events on the event bus", null),
     PublishUsageEvent("Advanced", ManagementServer.class, Boolean.class, "publish.usage.events", "true", "enable or disable publishing of usage events on the event bus", null),
-    PublishAsynJobEvent("Advanced", ManagementServer.class, Boolean.class, "publish.async.job.events", "true", "enable or disable publishing of usage events on the event bus", null);
+    PublishAsynJobEvent("Advanced", ManagementServer.class, Boolean.class, "publish.async.job.events", "true", "enable or disable publishing of usage events on the event bus", null),
+
+    // StatsCollector
+    StatsOutPutGraphiteHost("Advanced", ManagementServer.class, String.class, "stats.output.uri", "", "URI to additionally send StatsCollector statistics to", null);
 
     private final String _category;
     private final Class<?> _componentClass;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e06a814d/server/src/com/cloud/server/StatsCollector.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java
index 9f4c14e..40f78dd 100755
--- a/server/src/com/cloud/server/StatsCollector.java
+++ b/server/src/com/cloud/server/StatsCollector.java
@@ -29,6 +29,9 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
+import java.net.URI;
+import java.net.URISyntaxException;
+
 import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
@@ -43,6 +46,8 @@ import org.apache.cloudstack.managed.context.ManagedContextRunnable;
 import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+import org.apache.cloudstack.graphite.GraphiteClient;
+import org.apache.cloudstack.graphite.GraphiteException;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
@@ -120,6 +125,20 @@ import com.cloud.vm.dao.VMInstanceDao;
 @Component
 public class StatsCollector extends ManagerBase implements ComponentMethodInterceptable {
 
+    public static enum externalStatsProtocol {
+        NONE("none"), GRAPHITE("graphite");
+        String _type;
+
+        externalStatsProtocol(String type) {
+            _type = type;
+        }
+
+        @Override
+        public String toString() {
+            return _type;
+        }
+    }
+
     public static final Logger s_logger = Logger.getLogger(StatsCollector.class.getName());
 
     private static StatsCollector s_instance = null;
@@ -194,6 +213,12 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
     int vmDiskStatsInterval = 0;
     List<Long> hostIds = null;
 
+    String externalStatsPrefix = "";
+    String externalStatsHost = null;
+    int externalStatsPort = -1;
+    boolean externalStatsEnabled = false;
+    externalStatsProtocol externalStatsType = externalStatsProtocol.NONE;
+
     private ScheduledExecutorService _diskStatsUpdateExecutor;
     private int _usageAggregationRange = 1440;
     private String _usageTimeZone = "GMT";
@@ -233,6 +258,36 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
         autoScaleStatsInterval = NumbersUtil.parseLong(configs.get("autoscale.stats.interval"), 60000L);
         vmDiskStatsInterval = NumbersUtil.parseInt(configs.get("vm.disk.stats.interval"), 0);
 
+        /* URI to send statistics to. Currently only Graphite is supported */
+        String externalStatsUri = configs.get("stats.output.uri");
+        if (externalStatsUri != null) {
+            try {
+                URI uri = new URI(externalStatsUri);
+                String scheme = uri.getScheme();
+
+                try {
+                    externalStatsType = externalStatsProtocol.valueOf(scheme.toUpperCase());
+                } catch (IllegalArgumentException e) {
+                    s_logger.info(scheme + " is not a valid protocol for external statistics. No statistics will be send.");
+                }
+
+                externalStatsHost = uri.getHost();
+                externalStatsPort = uri.getPort();
+                externalStatsPrefix = uri.getPath().substring(1);
+
+                /* Append a dot (.) to the prefix if it is set */
+                if (externalStatsPrefix != null && !externalStatsPrefix.equals("")) {
+                    externalStatsPrefix += ".";
+                } else {
+                    externalStatsPrefix = "";
+                }
+
+                externalStatsEnabled = true;
+            } catch (URISyntaxException e) {
+                s_logger.debug("Failed to parse external statistics URI: " + e.getMessage());
+            }
+        }
+
         if (hostStatsInterval > 0) {
             _executor.scheduleWithFixedDelay(new HostCollector(), 15000L, hostStatsInterval, TimeUnit.MILLISECONDS);
         }
@@ -372,6 +427,9 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
                 sc.addAnd("type", SearchCriteria.Op.NEQ, Host.Type.SecondaryStorageVM.toString());
                 List<HostVO> hosts = _hostDao.search(sc, null);
 
+                /* HashMap for metrics to be send to Graphite */
+                HashMap metrics = new HashMap<String, Integer>();
+
                 for (HostVO host : hosts) {
                     List<UserVmVO> vms = _userVmDao.listRunningByHostId(host.getId());
                     List<Long> vmIds = new ArrayList<Long>();
@@ -407,6 +465,50 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
 
                                     _VmStats.put(vmId, statsInMemory);
                                 }
+
+                                /**
+                                 * Add statistics to HashMap only when they should be send to a external stats collector
+                                 * Performance wise it seems best to only append to the HashMap when needed
+                                */
+                                if (externalStatsEnabled) {
+                                    VMInstanceVO vmVO = _vmInstance.findById(vmId);
+                                    String vmName = vmVO.getUuid();
+
+                                    metrics.put(externalStatsPrefix + "cloudstack.stats.instances." + vmName + ".cpu.num", statsForCurrentIteration.getNumCPUs());
+                                    metrics.put(externalStatsPrefix + "cloudstack.stats.instances." + vmName + ".cpu.utilization", statsForCurrentIteration.getCPUUtilization());
+                                    metrics.put(externalStatsPrefix + "cloudstack.stats.instances." + vmName + ".network.read_kbs", statsForCurrentIteration.getNetworkReadKBs());
+                                    metrics.put(externalStatsPrefix + "cloudstack.stats.instances." + vmName + ".network.write_kbs", statsForCurrentIteration.getNetworkWriteKBs());
+                                    metrics.put(externalStatsPrefix + "cloudstack.stats.instances." + vmName + ".disk.write_kbs", statsForCurrentIteration.getDiskWriteKBs());
+                                    metrics.put(externalStatsPrefix + "cloudstack.stats.instances." + vmName + ".disk.read_kbs", statsForCurrentIteration.getDiskReadKBs());
+                                    metrics.put(externalStatsPrefix + "cloudstack.stats.instances." + vmName + ".disk.write_iops", statsForCurrentIteration.getDiskWriteIOs());
+                                    metrics.put(externalStatsPrefix + "cloudstack.stats.instances." + vmName + ".disk.read_iops", statsForCurrentIteration.getDiskReadIOs());
+                                }
+
+                            }
+
+                            /**
+                             * Send the metrics to a external stats collector
+                             * We send it on a per-host basis to prevent that we flood the host
+                             * Currently only Graphite is supported
+                             */
+                            if (!metrics.isEmpty()) {
+                                if (externalStatsType != null && externalStatsType == externalStatsProtocol.GRAPHITE) {
+
+                                    if (externalStatsPort == -1) {
+                                        externalStatsPort = 2003;
+                                    }
+
+                                    s_logger.debug("Sending VmStats of host " + host.getId() + " to Graphite host " + externalStatsHost + ":" + externalStatsPort);
+
+                                    try {
+                                        GraphiteClient g = new GraphiteClient(externalStatsHost, externalStatsPort);
+                                        g.sendMetrics(metrics);
+                                    } catch (GraphiteException e) {
+                                        s_logger.debug("Failed sending VmStats to Graphite host " + externalStatsHost + ":" + externalStatsPort + ": " + e.getMessage());
+                                    }
+
+                                    metrics.clear();
+                                }
                             }
                         }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e06a814d/setup/db/db/schema-441to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-441to450.sql b/setup/db/db/schema-441to450.sql
index 0ee6c7f..93d867b 100644
--- a/setup/db/db/schema-441to450.sql
+++ b/setup/db/db/schema-441to450.sql
@@ -769,4 +769,3 @@ ALTER TABLE `cloud_usage`.`usage_vpn_user` CHANGE `user_name` `user_name` VARCHA
 
 --Increase key value size generated from RSA-8192 to be stored.
 ALTER TABLE `cloud`.`user_vm_details` MODIFY `value` VARCHAR(5120);
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e06a814d/setup/db/db/schema-450to460.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-450to460.sql b/setup/db/db/schema-450to460.sql
index 8da5486..8480c85 100644
--- a/setup/db/db/schema-450to460.sql
+++ b/setup/db/db/schema-450to460.sql
@@ -18,3 +18,5 @@
 --
 -- Schema upgrade from 4.5.0 to 4.6.0
 --
+
+INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'management-server', "stats.output.uri", "", "URI to additionally send StatsCollector statistics to", "", NULL, NULL, 0);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e06a814d/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java
----------------------------------------------------------------------
diff --git a/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java b/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java
new file mode 100644
index 0000000..5dca8cb
--- /dev/null
+++ b/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java
@@ -0,0 +1,125 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package org.apache.cloudstack.graphite;
+
+import java.io.IOException;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
+
+public class GraphiteClient {
+
+    private String graphiteHost;
+    private int graphitePort;
+
+    /**
+     * Create a new Graphite client
+     *
+     * @param graphiteHost Hostname of the Graphite host
+     * @param graphitePort UDP port of the Graphite host
+     */
+    public GraphiteClient(String graphiteHost, int graphitePort) {
+        this.graphiteHost = graphiteHost;
+        this.graphitePort = graphitePort;
+    }
+
+    /**
+     * Create a new Graphite client
+     *
+     * @param graphiteHost Hostname of the Graphite host. Will default to port 2003
+     */
+    public GraphiteClient(String graphiteHost) {
+        this.graphiteHost = graphiteHost;
+        this.graphitePort = 2003;
+    }
+
+    /**
+     * Get the current system timestamp to pass to Graphite
+     *
+     * @return Seconds passed since epoch (01-01-1970)
+     */
+    protected long getCurrentSystemTime() {
+        return System.currentTimeMillis() / 1000;
+    }
+
+    /**
+     * Send a array of metrics to graphite.
+     *
+     * @param metrics the metrics as key-value-pairs
+     */
+    public void sendMetrics(Map<String, Integer> metrics) {
+        sendMetrics(metrics, this.getCurrentSystemTime());
+    }
+
+    /**
+     * Send a array of metrics with a given timestamp to graphite.
+     *
+     * @param metrics the metrics as key-value-pairs
+     * @param timeStamp the timestamp
+     */
+    public void sendMetrics(Map<String, Integer> metrics, long timeStamp) {
+        try {
+            DatagramSocket sock = new DatagramSocket();
+            InetAddress addr = InetAddress.getByName(this.graphiteHost);
+
+            for (Map.Entry<String, Integer> metric: metrics.entrySet()) {
+                byte[] message = new String(metric.getKey() + " " + metric.getValue() + " " + timeStamp + "\n").getBytes();
+                DatagramPacket packet = new DatagramPacket(message, message.length, addr, this.graphitePort);
+                sock.send(packet);
+            }
+
+            sock.close();
+        } catch (UnknownHostException e) {
+            throw new GraphiteException("Unknown host: " + graphiteHost);
+        } catch (IOException e) {
+            throw new GraphiteException("Error while writing to graphite: " + e.getMessage(), e);
+        }
+    }
+
+    /**
+     * Send a single metric with the current time as timestamp to graphite.
+     *
+     * @param key The metric key
+     * @param value the metric value
+     *
+     * @throws GraphiteException if sending data to graphite failed
+     */
+    public void sendMetric(String key, int value) {
+        sendMetric(key, value, this.getCurrentSystemTime());
+    }
+
+    /**
+     * Send a single metric with a given timestamp to graphite.
+     *
+     * @param key The metric key
+     * @param value The metric value
+     * @param timeStamp the timestamp to use
+     *
+     * @throws GraphiteException if sending data to graphite failed
+     */
+    public void sendMetric(final String key, final int value, long timeStamp) {
+        HashMap metrics = new HashMap<String, Integer>();
+        metrics.put(key, value);
+        sendMetrics(metrics, timeStamp);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e06a814d/utils/src/org/apache/cloudstack/utils/graphite/GraphiteException.java
----------------------------------------------------------------------
diff --git a/utils/src/org/apache/cloudstack/utils/graphite/GraphiteException.java b/utils/src/org/apache/cloudstack/utils/graphite/GraphiteException.java
new file mode 100644
index 0000000..b11532e
--- /dev/null
+++ b/utils/src/org/apache/cloudstack/utils/graphite/GraphiteException.java
@@ -0,0 +1,31 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package org.apache.cloudstack.graphite;
+
+public class GraphiteException extends RuntimeException {
+
+    public GraphiteException(String message) {
+        super(message);
+    }
+
+    public GraphiteException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}
\ No newline at end of file


[43/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46802557/test/integration/component/test_escalations_instances.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py
index 1aaa688..7e4cfe6 100644
--- a/test/integration/component/test_escalations_instances.py
+++ b/test/integration/component/test_escalations_instances.py
@@ -16,17 +16,28 @@
 # under the License.
 
 # Import Local Modules
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackException import *
-from marvin.cloudstackAPI import *
-from marvin.sshClient import SshClient
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.lib.utils import cleanup_resources, validateList
+from marvin.lib.base import (Account,
+                             ServiceOffering,
+                             NetworkOffering,
+                             Network,
+                             VirtualMachine,
+                             SecurityGroup,
+                             DiskOffering,
+                             Resources,
+                             Iso,
+                             Configurations,
+                             SSHKeyPair,
+                             Volume,
+                             VmSnapshot,
+                             Zone)
+from marvin.lib.common import (get_zone,
+                               get_template,
+                               get_domain)
 from marvin.codes import PASS
 from nose.plugins.attrib import attr
-from time import sleep
-# from ctypes.wintypes import BOOLEAN
+
 
 class TestListInstances(cloudstackTestCase):
 
@@ -40,19 +51,23 @@ class TestListInstances(cloudstackTestCase):
             cls.hypervisor = cls.testClient.getHypervisorInfo()
             # Get Domain, Zone, Template
             cls.domain = get_domain(cls.api_client)
-            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+            cls.zone = get_zone(
+                cls.api_client,
+                cls.testClient.getZoneForTests())
             cls.template = get_template(
-                                        cls.api_client,
-                                        cls.zone.id,
-                                        cls.services["ostype"]
-                                        )
+                cls.api_client,
+                cls.zone.id,
+                cls.services["ostype"]
+            )
             if cls.zone.localstorageenabled:
                 cls.storagetype = 'local'
-                cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
+                cls.services["service_offerings"][
+                    "tiny"]["storagetype"] = 'local'
                 cls.services["disk_offering"]["storagetype"] = 'local'
             else:
                 cls.storagetype = 'shared'
-                cls.services["service_offerings"]["tiny"]["storagetype"] = 'shared'
+                cls.services["service_offerings"][
+                    "tiny"]["storagetype"] = 'shared'
                 cls.services["disk_offering"]["storagetype"] = 'shared'
 
             cls.services['mode'] = cls.zone.networktype
@@ -62,32 +77,13 @@ class TestListInstances(cloudstackTestCase):
             cls.services["custom_volume"]["zoneid"] = cls.zone.id
             # Creating Disk offering, Service Offering and Account
             cls.disk_offering = DiskOffering.create(
-                                                    cls.api_client,
-                                                    cls.services["disk_offering"]
-                                                    )
+                cls.api_client,
+                cls.services["disk_offering"]
+            )
             cls.service_offering = ServiceOffering.create(
-                                                          cls.api_client,
-                                                          cls.services["service_offerings"]["tiny"]
-                                                          )
-            cls.account = Account.create(
-                                         cls.api_client,
-                                         cls.services["account"],
-                                         domainid=cls.domain.id
-                                         )
-            # Getting authentication for user in newly created Account
-            cls.user = cls.account.user[0]
-            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
-            # Updating resource Limits
-            for i in range(0, 12):
-                Resources.updateLimit(
-                                      cls.api_client,
-                                      account=cls.account.name,
-                                      domainid=cls.domain.id,
-                                      max=-1,
-                                      resourcetype=i
-                                      )
-
-            cls._cleanup.append(cls.account)
+                cls.api_client,
+                cls.services["service_offerings"]["tiny"]
+            )
             cls._cleanup.append(cls.service_offering)
             cls._cleanup.append(cls.disk_offering)
         except Exception as e:
@@ -98,7 +94,27 @@ class TestListInstances(cloudstackTestCase):
     def setUp(self):
 
         self.apiClient = self.testClient.getApiClient()
-        self.cleanup = []
+        self.account = Account.create(
+            self.apiClient,
+            self.services["account"],
+            domainid=self.domain.id
+        )
+        # Getting authentication for user in newly created Account
+        self.user = self.account.user[0]
+        self.userapiclient = self.testClient.getUserApiClient(
+            self.user.username,
+            self.domain.name)
+        # Updating resource Limits
+        for i in range(0, 12):
+            Resources.updateLimit(
+                self.api_client,
+                account=self.account.name,
+                domainid=self.domain.id,
+                max=-1,
+                resourcetype=i
+            )
+
+        self.cleanup = [self.account, ]
 
     def tearDown(self):
         # Clean up, terminate the created resources
@@ -115,14 +131,15 @@ class TestListInstances(cloudstackTestCase):
         return
 
     def __verify_values(self, expected_vals, actual_vals):
-        """  
+        """
         @Desc: Function to verify expected and actual values
         @Steps:
         Step1: Initializing return flag to True
-        Step1: Verifying length of expected and actual dictionaries is matching.
+        Step1: Verifying length of expected and actual dictionaries is matching
                If not matching returning false
         Step2: Listing all the keys from expected dictionary
-        Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+        Step3: Looping through each key from step2 and verifying expected and
+               actual dictionaries have same value
                If not making return flag to False
         Step4: returning the return flag after all the values are verified
         """
@@ -139,24 +156,26 @@ class TestListInstances(cloudstackTestCase):
                 return_flag = return_flag and True
             else:
                 return_flag = return_flag and False
-                self.debug("expected Value: %s, is not matching with actual value: %s" % (
-                                                                                          exp_val,
-                                                                                          act_val
-                                                                                          ))
+                self.debug(
+                    "expected Value: %s, is not matching with\
+                            actual value: %s" %
+                    (exp_val, act_val))
         return return_flag
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
     def test_01_list_instances_pagination(self):
-        """  
+        """
         @Desc: Test List Instances pagination
         @Steps:
         Step1: Listing all the Instances for a user
         Step2: Verifying listed Instances for account created at class level
-        Step3: If number of volumes is less than (page size + 1), then creating them
+        Step3: If number of volumes is less than
+                (page size + 1), then creating them
         Step4: Listing all the volumes again after creation of volumes
         Step5: Verifying the length of the volumes is (page size + 1)
         Step6: Listing all the volumes in page1
-        Step7: Verifying that the length of the volumes in page 1 is (page size)
+        Step7: Verifying that the length of the volumes in page 1 is
+               (page size)
         Step8: Listing all the volumes in page2
         Step9: Verifying that the length of the volumes in page 2 is 1
         Step10: Deleting the volume present in page 2
@@ -164,124 +183,128 @@ class TestListInstances(cloudstackTestCase):
         Step12: Verifying that there are no volumes present in page 2
         """
         # Listing all the instances for a user
-        list_instances_before = VirtualMachine.list(self.userapiclient, listall=self.services["listall"])
+        list_instances_before = VirtualMachine.list(
+            self.userapiclient,
+            listall=self.services["listall"])
 
         # Verifying listed instances for account created at class level
         self.assertIsNone(
-                          list_instances_before,
-                          "Virtual Machine already exists for newly created user"
-                          )
-        # If number of instances are less than (pagesize + 1), then creating them
+            list_instances_before,
+            "Virtual Machine already exists for newly created user"
+        )
+        # If number of instances are less than (pagesize + 1), then creating
+        # them
         for i in range(0, (self.services["pagesize"] + 1)):
             vm_created = VirtualMachine.create(
-                                               self.userapiclient,
-                                               self.services["virtual_machine"],
-                                               accountid=self.account.name,
-                                               domainid=self.account.domainid,
-                                               serviceofferingid=self.service_offering.id,
-                                               )
+                self.userapiclient,
+                self.services["virtual_machine"],
+                accountid=self.account.name,
+                domainid=self.account.domainid,
+                serviceofferingid=self.service_offering.id,
+            )
             self.assertIsNotNone(
-                                 vm_created,
-                                 "VM creation failed"
-                                 )
-            if(i < (self.services["pagesize"])):
-                self.cleanup.append(vm_created)
+                vm_created,
+                "VM creation failed"
+            )
 
             self.assertEqual(
-                             self.services["virtual_machine"]["displayname"],
-                             vm_created.displayname,
-                             "Newly created VM name and the test data VM name are not matching"
-                             )
+                self.services["virtual_machine"]["displayname"],
+                vm_created.displayname,
+                "Newly created VM name and the test data VM name\
+                        are not matching")
 
         # Listing all the instances again after creating VM's
-        list_instances_after = VirtualMachine.list(self.userapiclient, listall=self.services["listall"])
+        list_instances_after = VirtualMachine.list(
+            self.userapiclient,
+            listall=self.services["listall"])
         status = validateList(list_instances_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Listing of instances after creation failed"
-                          )
+            PASS,
+            status[0],
+            "Listing of instances after creation failed"
+        )
         # Verifying the length of the instances is (page size + 1)
         self.assertEqual(
-                         len(list_instances_after),
-                         (self.services["pagesize"] + 1),
-                         "Number of instances created is not matching as expected"
-                         )
+            len(list_instances_after),
+            (self.services["pagesize"] + 1),
+            "Number of instances created is not matching as expected"
+        )
 
         # Listing all the volumes in page1
         list_instances_page1 = VirtualMachine.list(
-                                                   self.userapiclient,
-                                                   listall=self.services["listall"],
-                                                   page=1,
-                                                   pagesize=self.services["pagesize"],
-                                                   domainid=self.account.domainid
-                                                   )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid
+        )
         status = validateList(list_instances_page1)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Listing of instances in page1 failed"
-                          )
+            PASS,
+            status[0],
+            "Listing of instances in page1 failed"
+        )
         # Verifying that the length of the instances in page 1 is (page size)
         self.assertEqual(
-                         self.services["pagesize"],
-                         len(list_instances_page1),
-                         "List VM response is not matching with the page size length for page 1"
-                         )
+            self.services["pagesize"],
+            len(list_instances_page1),
+            "List VM response is not matching with the page size\
+                    length for page 1")
 
         # Listing all the VM's in page2
         list_instances_page2 = VirtualMachine.list(
-                                                   self.userapiclient,
-                                                   listall=self.services["listall"],
-                                                   page=2,
-                                                   pagesize=self.services["pagesize"],
-                                                   domainid=self.account.domainid
-                                                   )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=2,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid
+        )
         status = validateList(list_instances_page2)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Listing of instances in page2 failed"
-                          )
+            PASS,
+            status[0],
+            "Listing of instances in page2 failed"
+        )
         # Verifying that the length of the VM's in page 2 is 1
         self.assertEqual(
-                         1,
-                         len(list_instances_page2),
-                         "List VM response is not matching with the page size length for page 2"
-                         )
+            1,
+            len(list_instances_page2),
+            "List VM response is not matching with the\
+                    page size length for page 2"
+        )
         instance_page2 = list_instances_page2[0]
 
         # Verifying that the VM on page 2 is not present in page1
         for i in range(0, len(list_instances_page1)):
             instance_page1 = list_instances_page1[i]
             self.assertNotEquals(
-                                 instance_page2.id,
-                                 instance_page1.id,
-                                 "VM listed in page 2 is also listed in page 1"
-                                 )
+                instance_page2.id,
+                instance_page1.id,
+                "VM listed in page 2 is also listed in page 1"
+            )
 
         # Deleting a single VM
-        VirtualMachine.delete(vm_created, self.userapiclient, expunge=True)
+        VirtualMachine.delete(vm_created, self.apiClient, expunge=True)
 
         # Listing the VM's in page 2
         list_instance_response = VirtualMachine.list(
-                                                     self.userapiclient,
-                                                     listall=self.services["listall"],
-                                                     page=2,
-                                                     pagesize=self.services["pagesize"],
-                                                     domainid=self.account.domainid
-                                                     )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=2,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid
+        )
         # verifying that VM does not exists on page 2
         self.assertEqual(
-                        list_instance_response,
-                        None,
-                        "VM was not deleted"
-                        )
+            list_instance_response,
+            None,
+            "VM was not deleted"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
     def test_02_list_Running_vm(self):
-        """  
+        """
         @Desc: Test List Running VM's
         @Steps:
         Step1: Listing all the Running VMs for a user
@@ -289,90 +312,90 @@ class TestListInstances(cloudstackTestCase):
         Step3: Deploying a VM
         Step4: Listing all the Running VMs for a user again
         Step5: Verifying that the size of the list is increased by 1
-        Step6: Verifying that the details of the Running VM listed are same as the VM deployed in Step3
+        Step6: Verifying that the details of the Running VM listed are
+               same as the VM deployed in Step3
         """
         # Listing all the Running VM's for a User
         list_running_vms_before = VirtualMachine.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"],
-                                                      page=1,
-                                                      pagesize=self.services["pagesize"],
-                                                      domainid=self.account.domainid,
-                                                      state="Running"
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            state="Running"
+        )
         self.assertIsNone(
-                          list_running_vms_before,
-                          "Virtual Machine already exists for newly created user"
-                          )
+            list_running_vms_before,
+            "Virtual Machine already exists for newly created user"
+        )
         # Deploying a VM
         vm_created = VirtualMachine.create(
-                                           self.userapiclient,
-                                           self.services["virtual_machine"],
-                                           accountid=self.account.name,
-                                           domainid=self.account.domainid,
-                                           serviceofferingid=self.service_offering.id,
-                                           )
+            self.userapiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+        )
         self.assertIsNotNone(
-                             vm_created,
-                             "VM creation failed"
-                             )
-        self.cleanup.append(vm_created)
+            vm_created,
+            "VM creation failed"
+        )
         # Listing all the Running VM's for a User
         list_running_vms_after = VirtualMachine.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"],
-                                                      page=1,
-                                                      pagesize=self.services["pagesize"],
-                                                      domainid=self.account.domainid,
-                                                      state="Running"
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            state="Running"
+        )
         status = validateList(list_running_vms_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Newly created VM is not in Running state"
-                          )
+            PASS,
+            status[0],
+            "Newly created VM is not in Running state"
+        )
         # Verifying list size is 1
         self.assertEquals(
-                          1,
-                          len(list_running_vms_after),
-                          "Running VM list count is not matching"
-                          )
+            1,
+            len(list_running_vms_after),
+            "Running VM list count is not matching"
+        )
         running_vm = list_running_vms_after[0]
 
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":vm_created.id,
-                         "name":vm_created.name,
-                         "displayname":vm_created.displayname,
-                         "state":"Running",
-                         "zoneid":vm_created.zoneid,
-                         "account":vm_created.account,
-                         "template":vm_created.templateid
-                         }
+            "id": vm_created.id,
+            "name": vm_created.name,
+            "displayname": vm_created.displayname,
+            "state": "Running",
+            "zoneid": vm_created.zoneid,
+            "account": vm_created.account,
+            "template": vm_created.templateid
+        }
         actual_dict = {
-                       "id":running_vm.id,
-                       "name":running_vm.name,
-                       "displayname":running_vm.displayname,
-                       "state":running_vm.state,
-                       "zoneid":running_vm.zoneid,
-                       "account":running_vm.account,
-                       "template":running_vm.templateid
-                       }
+            "id": running_vm.id,
+            "name": running_vm.name,
+            "displayname": running_vm.displayname,
+            "state": running_vm.state,
+            "zoneid": running_vm.zoneid,
+            "account": running_vm.account,
+            "template": running_vm.templateid
+        }
         running_vm_status = self.__verify_values(
-                                                  expected_dict,
-                                                  actual_dict
-                                                  )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         running_vm_status,
-                         "Listed Running VM details are not as expected"
-                         )
+            True,
+            running_vm_status,
+            "Listed Running VM details are not as expected"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
     def test_03_list_Stopped_vm(self):
-        """  
+        """
         @Desc: Test List Stopped VM's
         @Steps:
         Step1: Listing all the Stopped VMs for a user
@@ -381,86 +404,86 @@ class TestListInstances(cloudstackTestCase):
         Step4: Stopping the VM deployed in step3
         Step5: Listing all the Stopped VMs for a user again
         Step6: Verifying that the size of the list is increased by 1
-        Step7: Verifying that the details of the Stopped VM listed are same as the VM stopped in Step4
+        Step7: Verifying that the details of the Stopped VM listed are
+               same as the VM stopped in Step4
         """
         # Listing all the Stopped VM's for a User
         list_stopped_vms_before = VirtualMachine.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"],
-                                                      page=1,
-                                                      pagesize=self.services["pagesize"],
-                                                      domainid=self.account.domainid,
-                                                      state="Stopped"
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            state="Stopped"
+        )
         self.assertIsNone(
-                           list_stopped_vms_before,
-                           "Virtual Machine already exists for newly created user"
-                           )
+            list_stopped_vms_before,
+            "Virtual Machine already exists for newly created user"
+        )
         # Deploying a VM
         vm_created = VirtualMachine.create(
-                                           self.userapiclient,
-                                           self.services["virtual_machine"],
-                                           accountid=self.account.name,
-                                           domainid=self.account.domainid,
-                                           serviceofferingid=self.service_offering.id,
-                                           )
+            self.userapiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+        )
         self.assertIsNotNone(
-                             vm_created,
-                             "VM creation failed"
-                             )
-        self.cleanup.append(vm_created)
+            vm_created,
+            "VM creation failed"
+        )
         # Stopping the VM
         VirtualMachine.stop(vm_created, self.userapiclient)
         # Listing all the Stopped VM's for a User
         list_stopped_vms_after = VirtualMachine.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"],
-                                                      page=1,
-                                                      pagesize=self.services["pagesize"],
-                                                      domainid=self.account.domainid,
-                                                      state="Stopped"
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            state="Stopped"
+        )
         status = validateList(list_stopped_vms_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Stopped VM is not in Stopped state"
-                          )
+            PASS,
+            status[0],
+            "Stopped VM is not in Stopped state"
+        )
         # Verifying list size is 1
         self.assertEquals(
-                          1,
-                          len(list_stopped_vms_after),
-                          "Stopped VM list count is not matching"
-                          )
+            1,
+            len(list_stopped_vms_after),
+            "Stopped VM list count is not matching"
+        )
         stopped_vm = list_stopped_vms_after[0]
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":vm_created.id,
-                         "name":vm_created.name,
-                         "displayname":vm_created.displayname,
-                         "state":"Stopped",
-                         "zoneid":vm_created.zoneid,
-                         "account":vm_created.account,
-                         "template":vm_created.templateid
-                         }
+            "id": vm_created.id,
+            "name": vm_created.name,
+            "displayname": vm_created.displayname,
+            "state": "Stopped",
+            "zoneid": vm_created.zoneid,
+            "account": vm_created.account,
+            "template": vm_created.templateid
+        }
         actual_dict = {
-                       "id":stopped_vm.id,
-                       "name":stopped_vm.name,
-                       "displayname":stopped_vm.displayname,
-                       "state":stopped_vm.state,
-                       "zoneid":stopped_vm.zoneid,
-                       "account":stopped_vm.account,
-                       "template":stopped_vm.templateid
-                       }
+            "id": stopped_vm.id,
+            "name": stopped_vm.name,
+            "displayname": stopped_vm.displayname,
+            "state": stopped_vm.state,
+            "zoneid": stopped_vm.zoneid,
+            "account": stopped_vm.account,
+            "template": stopped_vm.templateid
+        }
         stopped_vm_status = self.__verify_values(
-                                                  expected_dict,
-                                                  actual_dict
-                                                  )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         stopped_vm_status,
-                         "Listed Stopped VM details are not as expected"
-                         )
+            True,
+            stopped_vm_status,
+            "Listed Stopped VM details are not as expected"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
@@ -476,99 +499,100 @@ class TestListInstances(cloudstackTestCase):
         Step6: Verifying that destroyed VM is not listed for User
         Step7: Listing all the destroyed VMs as admin
         Step8: Verifying that the size of the list is 1
-        Step9: Verifying that the details of the Destroyed VM listed are same as the VM destroyed in Step4
+        Step9: Verifying that the details of the Destroyed VM listed
+                are same as the VM destroyed in Step4
         """
         # Listing all the Destroyed VM's for a User
         list_destroyed_vms_before = VirtualMachine.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"],
-                                                      page=1,
-                                                      pagesize=self.services["pagesize"],
-                                                      domainid=self.account.domainid,
-                                                      state="Destroyed"
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            state="Destroyed"
+        )
         self.assertIsNone(
-                           list_destroyed_vms_before,
-                           "Virtual Machine in Destroyed state already exists for newly created user"
-                           )
+            list_destroyed_vms_before,
+            "Virtual Machine in Destroyed state already exists\
+                    for newly created user")
         # Deploying a VM
         vm_created = VirtualMachine.create(
-                                           self.userapiclient,
-                                           self.services["virtual_machine"],
-                                           accountid=self.account.name,
-                                           domainid=self.account.domainid,
-                                           serviceofferingid=self.service_offering.id,
-                                           )
+            self.userapiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+        )
         self.assertIsNotNone(
-                             vm_created,
-                             "VM creation failed"
-                             )
+            vm_created,
+            "VM creation failed"
+        )
         # Destroying the VM
         VirtualMachine.delete(vm_created, self.userapiclient, expunge=False)
         # Listing all the Destroyed VM's for a User
         list_destroyed_vms_after = VirtualMachine.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"],
-                                                      page=1,
-                                                      pagesize=self.services["pagesize"],
-                                                      domainid=self.account.domainid,
-                                                      state="Destroyed"
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            state="Destroyed"
+        )
         self.assertIsNone(
-                          list_destroyed_vms_after,
-                          "Destroyed VM is not in destroyed state"
-                          )
+            list_destroyed_vms_after,
+            "Destroyed VM is not in destroyed state"
+        )
         # Listing destroyed VMs as admin user
         list_destroyed_vms_admin = VirtualMachine.list(
-                                                       self.apiClient,
-                                                       listall=self.services["listall"],
-                                                       page=1,
-                                                       pagesize=self.services["pagesize"],
-                                                       domainid=self.account.domainid,
-                                                       state="Destroyed",
-                                                       id=vm_created.id
-                                                       )
+            self.apiClient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            state="Destroyed",
+            id=vm_created.id
+        )
         status = validateList(list_destroyed_vms_admin)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Destroyed VM is not in Destroyed state"
-                          )
+            PASS,
+            status[0],
+            "Destroyed VM is not in Destroyed state"
+        )
         # Verifying that the length of the destroyed VMs list should be 1
         self.assertEquals(
-                          1,
-                          len(list_destroyed_vms_admin),
-                          "Destroyed VM list count is not matching"
-                          )
+            1,
+            len(list_destroyed_vms_admin),
+            "Destroyed VM list count is not matching"
+        )
         destroyed_vm = list_destroyed_vms_admin[0]
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":vm_created.id,
-                         "name":vm_created.name,
-                         "displayname":vm_created.displayname,
-                         "state":"Destroyed",
-                         "zoneid":vm_created.zoneid,
-                         "account":vm_created.account,
-                         "template":vm_created.templateid
-                         }
+            "id": vm_created.id,
+            "name": vm_created.name,
+            "displayname": vm_created.displayname,
+            "state": "Destroyed",
+            "zoneid": vm_created.zoneid,
+            "account": vm_created.account,
+            "template": vm_created.templateid
+        }
         actual_dict = {
-                       "id":destroyed_vm.id,
-                       "name":destroyed_vm.name,
-                       "displayname":destroyed_vm.displayname,
-                       "state":destroyed_vm.state,
-                       "zoneid":destroyed_vm.zoneid,
-                       "account":destroyed_vm.account,
-                       "template":destroyed_vm.templateid
-                       }
+            "id": destroyed_vm.id,
+            "name": destroyed_vm.name,
+            "displayname": destroyed_vm.displayname,
+            "state": destroyed_vm.state,
+            "zoneid": destroyed_vm.zoneid,
+            "account": destroyed_vm.account,
+            "template": destroyed_vm.templateid
+        }
         destroyed_vm_status = self.__verify_values(
-                                                  expected_dict,
-                                                  actual_dict
-                                                  )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         destroyed_vm_status,
-                         "Listed Destroyed VM details are not as expected"
-                         )
+            True,
+            destroyed_vm_status,
+            "Listed Destroyed VM details are not as expected"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
@@ -582,95 +606,95 @@ class TestListInstances(cloudstackTestCase):
         Step4: Listing all the VMs for a user again
         Step5: Verifying that the size of the list is increased by 1
         Step6: List a VM by specifying the Id if the VM deployed in Step3
-        Step7: Verifying that the details of the Listed VM are same as the VM deployed in Step3
+        Step7: Verifying that the details of the Listed VM are same as
+               the VM deployed in Step3
         """
         # Listing all the VM's for a User
         list_vms_before = VirtualMachine.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              page=1,
-                                              pagesize=self.services["pagesize"],
-                                              domainid=self.account.domainid,
-                                              account=self.account.name
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            account=self.account.name
+        )
         self.assertIsNone(
-                           list_vms_before,
-                           "Virtual Machine already exists for newly created user"
-                           )
+            list_vms_before,
+            "Virtual Machine already exists for newly created user"
+        )
         # Deploying a VM
         vm_created = VirtualMachine.create(
-                                           self.userapiclient,
-                                           self.services["virtual_machine"],
-                                           accountid=self.account.name,
-                                           domainid=self.account.domainid,
-                                           serviceofferingid=self.service_offering.id,
-                                           )
+            self.userapiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+        )
         self.assertIsNotNone(
-                             vm_created,
-                             "VM creation failed"
-                             )
-        self.cleanup.append(vm_created)
+            vm_created,
+            "VM creation failed"
+        )
         # Listing all the VM's for a User
         list_vms_after = VirtualMachine.list(
-                                             self.userapiclient,
-                                             listall=self.services["listall"],
-                                             page=1,
-                                             pagesize=self.services["pagesize"],
-                                             domainid=self.account.domainid,
-                                             account=self.account.name
-                                             )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            account=self.account.name
+        )
         status = validateList(list_vms_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Listing of VM after creation failed"
-                          )
+            PASS,
+            status[0],
+            "Listing of VM after creation failed"
+        )
         self.assertEquals(
-                          1,
-                          len(list_vms_after),
-                          "VM list count is not matching"
-                          )
+            1,
+            len(list_vms_after),
+            "VM list count is not matching"
+        )
         # Listing a VM by Id
         list_vm_byid = VirtualMachine.list(
-                                           self.userapiclient,
-                                           listall=self.services["listall"],
-                                           id=vm_created.id
-                                           )
+            self.userapiclient,
+            listall=self.services["listall"],
+            id=vm_created.id
+        )
         status = validateList(list_vm_byid)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Listing of VM by Id failed"
-                          )
+            PASS,
+            status[0],
+            "Listing of VM by Id failed"
+        )
         listed_vm = list_vm_byid[0]
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":vm_created.id,
-                         "name":vm_created.name,
-                         "displayname":vm_created.displayname,
-                         "state":vm_created.state,
-                         "zoneid":vm_created.zoneid,
-                         "account":vm_created.account,
-                         "template":vm_created.templateid
-                         }
+            "id": vm_created.id,
+            "name": vm_created.name,
+            "displayname": vm_created.displayname,
+            "state": vm_created.state,
+            "zoneid": vm_created.zoneid,
+            "account": vm_created.account,
+            "template": vm_created.templateid
+        }
         actual_dict = {
-                       "id":listed_vm.id,
-                       "name":listed_vm.name,
-                       "displayname":listed_vm.displayname,
-                       "state":listed_vm.state,
-                       "zoneid":listed_vm.zoneid,
-                       "account":listed_vm.account,
-                       "template":listed_vm.templateid
-                       }
+            "id": listed_vm.id,
+            "name": listed_vm.name,
+            "displayname": listed_vm.displayname,
+            "state": listed_vm.state,
+            "zoneid": listed_vm.zoneid,
+            "account": listed_vm.account,
+            "template": listed_vm.templateid
+        }
         list_vm_status = self.__verify_values(
-                                              expected_dict,
-                                              actual_dict
-                                              )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         list_vm_status,
-                         "Listed VM by Id details are not as expected"
-                         )
+            True,
+            list_vm_status,
+            "Listed VM by Id details are not as expected"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
@@ -683,134 +707,136 @@ class TestListInstances(cloudstackTestCase):
         Step3: Deploying a 2 VM's
         Step4: Listing all the VMs for a user again
         Step5: Verifying that list size is increased by 2
-        Step6: Listing the VM by specifying complete name of VM-1 created in step3
+        Step6: Listing the VM by specifying complete name of
+               VM-1 created in step3
         Step7: Verifying that the size of the list is 1
-        Step8: Verifying that the details of the listed VM are same as the VM-1 created in step3
+        Step8: Verifying that the details of the listed VM are same as the
+               VM-1 created in step3
         Step9: Listing the VM by specifying the partial name of VM
         Step10: Verifying that the size of the list is 2
         """
         # Listing all the VM's for a User
         list_vms_before = VirtualMachine.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              page=1,
-                                              pagesize=self.services["pagesize"],
-                                              domainid=self.account.domainid,
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+        )
         self.assertIsNone(
-                           list_vms_before,
-                           "Virtual Machine already exists for newly created user"
-                           )
+            list_vms_before,
+            "Virtual Machine already exists for newly created user"
+        )
         vms = {}
         for i in range(0, 2):
             # Deploying a VM
             vm_created = VirtualMachine.create(
-                                               self.userapiclient,
-                                               self.services["virtual_machine"],
-                                               accountid=self.account.name,
-                                               domainid=self.account.domainid,
-                                               serviceofferingid=self.service_offering.id,
-                                               )
+                self.userapiclient,
+                self.services["virtual_machine"],
+                accountid=self.account.name,
+                domainid=self.account.domainid,
+                serviceofferingid=self.service_offering.id,
+            )
             self.assertIsNotNone(
-                                 vm_created,
-                                 "VM creation failed"
-                                 )
-            self.cleanup.append(vm_created)
+                vm_created,
+                "VM creation failed"
+            )
             vms.update({i: vm_created})
 
         # Listing all the VM's for a User
         list_vms_after = VirtualMachine.list(
-                                             self.userapiclient,
-                                             listall=self.services["listall"],
-                                             page=1,
-                                             pagesize=self.services["pagesize"],
-                                             domainid=self.account.domainid,
-                                             )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+        )
         status = validateList(list_vms_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "VM's creation failed"
-                          )
+            PASS,
+            status[0],
+            "VM's creation failed"
+        )
         self.assertEquals(
-                          2,
-                          len(list_vms_after),
-                          "VM's list count is not matching"
-                          )
+            2,
+            len(list_vms_after),
+            "VM's list count is not matching"
+        )
         # Listing the VM by complete name
         list_vm_byfullname = VirtualMachine.list(
-                                                 self.userapiclient,
-                                                 listall=self.services["listall"],
-                                                 page=1,
-                                                 pagesize=self.services["pagesize"],
-                                                 domainid=self.account.domainid,
-                                                 name=vms[0].name
-                                                 )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            name=vms[0].name
+        )
         status = validateList(list_vm_byfullname)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list VM by Name"
-                          )
+            PASS,
+            status[0],
+            "Failed to list VM by Name"
+        )
         # Verifying that the size of the list is 1
         self.assertEquals(
-                          1,
-                          len(list_vm_byfullname),
-                          "VM list by full name count is not matching"
-                          )
-        # Verifying that the details of the listed VM are same as the VM created above
+            1,
+            len(list_vm_byfullname),
+            "VM list by full name count is not matching"
+        )
+        # Verifying that the details of the listed VM are same
+        # as the VM created above
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":vms[0].id,
-                         "name":vms[0].name,
-                         "displayname":vms[0].displayname,
-                         "state":vms[0].state,
-                         "zoneid":vms[0].zoneid,
-                         "account":vms[0].account,
-                         "template":vms[0].templateid
-                         }
+            "id": vms[0].id,
+            "name": vms[0].name,
+            "displayname": vms[0].displayname,
+            "state": vms[0].state,
+            "zoneid": vms[0].zoneid,
+            "account": vms[0].account,
+            "template": vms[0].templateid
+        }
         actual_dict = {
-                       "id":list_vm_byfullname[0].id,
-                       "name":list_vm_byfullname[0].name,
-                       "displayname":list_vm_byfullname[0].displayname,
-                       "state":list_vm_byfullname[0].state,
-                       "zoneid":list_vm_byfullname[0].zoneid,
-                       "account":list_vm_byfullname[0].account,
-                       "template":list_vm_byfullname[0].templateid
-                       }
+            "id": list_vm_byfullname[0].id,
+            "name": list_vm_byfullname[0].name,
+            "displayname": list_vm_byfullname[0].displayname,
+            "state": list_vm_byfullname[0].state,
+            "zoneid": list_vm_byfullname[0].zoneid,
+            "account": list_vm_byfullname[0].account,
+            "template": list_vm_byfullname[0].templateid
+        }
         list_vm_status = self.__verify_values(
-                                              expected_dict,
-                                              actual_dict
-                                              )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         list_vm_status,
-                         "Listed VM details are not as expected"
-                         )
+            True,
+            list_vm_status,
+            "Listed VM details are not as expected"
+        )
         # Listing the VM by partial name
         list_vm_bypartialname = VirtualMachine.list(
-                                                 self.userapiclient,
-                                                 listall=self.services["listall"],
-                                                 domainid=self.account.domainid,
-                                                 name=vms[0].name[:1]
-                                                 )
+            self.userapiclient,
+            listall=self.services["listall"],
+            domainid=self.account.domainid,
+            name=vms[0].name[:1]
+        )
         status = validateList(list_vm_bypartialname)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list VM by Name"
-                          )
+            PASS,
+            status[0],
+            "Failed to list VM by Name"
+        )
         # Verifying that the size of the list is 2
         self.assertEquals(
-                          2,
-                          len(list_vm_bypartialname),
-                          "VM list by full name count is not matching"
-                          )
+            2,
+            len(list_vm_bypartialname),
+            "VM list by full name count is not matching"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
     def test_07_list_vm_by_name_state(self):
-        """  
+        """
         @Desc: Test List VM's by Name and State
         @Steps:
         Step1: Listing all the VMs for a user
@@ -818,143 +844,147 @@ class TestListInstances(cloudstackTestCase):
         Step3: Deploying a VM
         Step4: Listing all the VMs for a user again
         Step5: Verifying that list size is increased by 1
-        Step6: Listing the VM by specifying name of VM created in step3 and state as Running (matching name and state)
+        Step6: Listing the VM by specifying name of VM created in step3 and
+               state as Running (matching name and state)
         Step7: Verifying that the size of the list is 1
-        Step8: Verifying that the details of the listed VM are same as the VM created in step3
-        Step9: Listing the VM by specifying name of VM created in step3 and state as Stopped (non matching state)
+        Step8: Verifying that the details of the listed VM are same as
+               the VM created in step3
+        Step9: Listing the VM by specifying name of VM created in step3
+               and state as Stopped (non matching state)
         Step10: Verifying that the size of the list is 0
-        Step11: Listing the VM by specifying non matching name and state as Running (non matching name)
+        Step11: Listing the VM by specifying non matching name and
+                state as Running (non matching name)
         Step12: Verifying that the size of the list is 0
         """
         # Listing all the VM's for a User
         list_vms_before = VirtualMachine.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              page=1,
-                                              pagesize=self.services["pagesize"],
-                                              domainid=self.account.domainid,
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+        )
         self.assertIsNone(
-                           list_vms_before,
-                           "Virtual Machine already exists for newly created user"
-                           )
+            list_vms_before,
+            "Virtual Machine already exists for newly created user"
+        )
         # Deploying a VM
         vm_created = VirtualMachine.create(
-                                           self.userapiclient,
-                                           self.services["virtual_machine"],
-                                           accountid=self.account.name,
-                                           domainid=self.account.domainid,
-                                           serviceofferingid=self.service_offering.id,
-                                           )
+            self.userapiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+        )
         self.assertIsNotNone(
-                             vm_created,
-                             "VM creation failed"
-                             )
-        self.cleanup.append(vm_created)
+            vm_created,
+            "VM creation failed"
+        )
         # Listing all the VM's for a User
         list_vms_after = VirtualMachine.list(
-                                             self.userapiclient,
-                                             listall=self.services["listall"],
-                                             page=1,
-                                             pagesize=self.services["pagesize"],
-                                             domainid=self.account.domainid,
-                                             )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+        )
         status = validateList(list_vms_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "VM's creation failed"
-                          )
+            PASS,
+            status[0],
+            "VM's creation failed"
+        )
         self.assertEquals(
-                          1,
-                          len(list_vms_after),
-                          "VM's list count is not matching"
-                          )
+            1,
+            len(list_vms_after),
+            "VM's list count is not matching"
+        )
         # Listing the VM by matching Name and State
         list_running_vm = VirtualMachine.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              page=1,
-                                              pagesize=self.services["pagesize"],
-                                              domainid=self.account.domainid,
-                                              name=vm_created.name,
-                                              state="Running"
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            name=vm_created.name,
+            state="Running"
+        )
         status = validateList(list_running_vm)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "List VM by name and state failed"
-                          )
+            PASS,
+            status[0],
+            "List VM by name and state failed"
+        )
         # Verifying that the size of the list is 1
         self.assertEquals(
-                          1,
-                          len(list_running_vm),
-                          "Count of VM list by name and state is not matching"
-                          )
-        # Verifying that the details of the listed VM are same as the VM created above
+            1,
+            len(list_running_vm),
+            "Count of VM list by name and state is not matching"
+        )
+        # Verifying that the details of the listed VM are same
+        # as the VM created above
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":vm_created.id,
-                         "name":vm_created.name,
-                         "displayname":vm_created.displayname,
-                         "state":"Running",
-                         "zoneid":vm_created.zoneid,
-                         "account":vm_created.account,
-                         "template":vm_created.templateid
-                         }
+            "id": vm_created.id,
+            "name": vm_created.name,
+            "displayname": vm_created.displayname,
+            "state": "Running",
+            "zoneid": vm_created.zoneid,
+            "account": vm_created.account,
+            "template": vm_created.templateid
+        }
         actual_dict = {
-                       "id":list_running_vm[0].id,
-                       "name":list_running_vm[0].name,
-                       "displayname":list_running_vm[0].displayname,
-                       "state":list_running_vm[0].state,
-                       "zoneid":list_running_vm[0].zoneid,
-                       "account":list_running_vm[0].account,
-                       "template":list_running_vm[0].templateid
-                       }
+            "id": list_running_vm[0].id,
+            "name": list_running_vm[0].name,
+            "displayname": list_running_vm[0].displayname,
+            "state": list_running_vm[0].state,
+            "zoneid": list_running_vm[0].zoneid,
+            "account": list_running_vm[0].account,
+            "template": list_running_vm[0].templateid
+        }
         list_vm_status = self.__verify_values(
-                                              expected_dict,
-                                              actual_dict
-                                              )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         list_vm_status,
-                         "Listed VM details are not as expected"
-                         )
+            True,
+            list_vm_status,
+            "Listed VM details are not as expected"
+        )
         # Listing the VM by matching name and non matching state
         list_running_vm = VirtualMachine.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              page=1,
-                                              pagesize=self.services["pagesize"],
-                                              domainid=self.account.domainid,
-                                              name=vm_created.name,
-                                              state="Stopped"
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            name=vm_created.name,
+            state="Stopped"
+        )
         self.assertIsNone(
-                          list_running_vm,
-                          "Listed VM with non matching state"
-                          )
+            list_running_vm,
+            "Listed VM with non matching state"
+        )
         # Listing the VM by non matching name and matching state
         list_running_vm = VirtualMachine.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              page=1,
-                                              pagesize=self.services["pagesize"],
-                                              domainid=self.account.domainid,
-                                              name="name",
-                                              state="Running"
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            name="name",
+            state="Running"
+        )
         self.assertIsNone(
-                          list_running_vm,
-                          "Listed VM with non matching name"
-                          )
+            list_running_vm,
+            "Listed VM with non matching name"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
     def test_08_list_vm_by_zone(self):
-        """  
-        @Desc: Test List VM by Zone. 
+        """
+        @Desc: Test List VM by Zone.
         This test case is applicable for a setup having multiple zones.
         @Steps:
         Step1: Listing all the zones
@@ -966,7 +996,8 @@ class TestListInstances(cloudstackTestCase):
         Step6: Deploying a VM
         Step7: Listing all the VMs for a user again for matching zone
         Step8: Verifying that the size of the list is 1
-        Step9: Verifying that the details of the Listed VM are same as the VM deployed in Step6
+        Step9: Verifying that the details of the Listed VM are same
+               as the VM deployed in Step6
         Step10: Listing all the VMs for a user again for non-matching zone
         Step11: Verifying that the size of the list is 0
         """
@@ -974,10 +1005,10 @@ class TestListInstances(cloudstackTestCase):
         zones_list = Zone.list(self.apiClient)
         status = validateList(zones_list)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "zones not available in the given setup"
-                          )
+            PASS,
+            status[0],
+            "zones not available in the given setup"
+        )
         current_zone = self.services["virtual_machine"]["zoneid"]
         current_template = self.services["virtual_machine"]["template"]
         # Checking if there are multiple zones in the setup.
@@ -986,114 +1017,114 @@ class TestListInstances(cloudstackTestCase):
         else:
             # Getting the template available under the zone
             template = get_template(
-                                    self.apiClient,
-                                    zones_list[0].id,
-                                    self.services["ostype"]
-                                    )
+                self.apiClient,
+                zones_list[0].id,
+                self.services["ostype"]
+            )
             self.assertIsNotNone(
-                                 template,
-                                 "Template not found for zone"
-                                 )
+                template,
+                "Template not found for zone"
+            )
             self.services["virtual_machine"]["zoneid"] = zones_list[0].id
             self.services["virtual_machine"]["template"] = template.id
             # Listing all the VM's for a User
             list_vms_before = VirtualMachine.list(
-                                                  self.userapiclient,
-                                                  listall=self.services["listall"],
-                                                  page=1,
-                                                  pagesize=self.services["pagesize"],
-                                                  domainid=self.account.domainid,
-                                                  zoneid=zones_list[0].id
-                                                  )
+                self.userapiclient,
+                listall=self.services["listall"],
+                page=1,
+                pagesize=self.services["pagesize"],
+                domainid=self.account.domainid,
+                zoneid=zones_list[0].id
+            )
             self.assertIsNone(
-                               list_vms_before,
-                               "Virtual Machine already exists for newly created user"
-                               )
+                list_vms_before,
+                "Virtual Machine already exists for newly created user"
+            )
             # Deploying a VM
             vm_created = VirtualMachine.create(
-                                               self.userapiclient,
-                                               self.services["virtual_machine"],
-                                               accountid=self.account.name,
-                                               domainid=self.account.domainid,
-                                               serviceofferingid=self.service_offering.id,
-                                               )
+                self.userapiclient,
+                self.services["virtual_machine"],
+                accountid=self.account.name,
+                domainid=self.account.domainid,
+                serviceofferingid=self.service_offering.id,
+            )
             self.assertIsNotNone(
-                                 vm_created,
-                                 "VM creation failed"
-                                 )
-            self.cleanup.append(vm_created)
+                vm_created,
+                "VM creation failed"
+            )
             # Listing all the VMs for a user again for matching zone
             list_vms_after = VirtualMachine.list(
-                                                 self.userapiclient,
-                                                 listall=self.services["listall"],
-                                                 page=1,
-                                                 pagesize=self.services["pagesize"],
-                                                 domainid=self.account.domainid,
-                                                 zoneid=zones_list[0].id
-                                                 )
+                self.userapiclient,
+                listall=self.services["listall"],
+                page=1,
+                pagesize=self.services["pagesize"],
+                domainid=self.account.domainid,
+                zoneid=zones_list[0].id
+            )
             status = validateList(list_vms_after)
             self.assertEquals(
-                              PASS,
-                              status[0],
-                              "VM creation failed"
-                              )
+                PASS,
+                status[0],
+                "VM creation failed"
+            )
             # Verifying that the size of the list is 1
             self.assertEquals(
-                              1,
-                              len(list_vms_after),
-                              "VM list count is not matching"
-                              )
+                1,
+                len(list_vms_after),
+                "VM list count is not matching"
+            )
             listed_vm = list_vms_after[0]
-            # Verifying that the details of the Listed VM are same as the VM deployed above
+            # Verifying that the details of the Listed VM are
+            # same as the VM deployed above
             # Creating expected and actual values dictionaries
             expected_dict = {
-                               "id":vm_created.id,
-                               "name":vm_created.name,
-                               "displayname":vm_created.displayname,
-                               "state":vm_created.state,
-                               "zoneid":vm_created.zoneid,
-                               "account":vm_created.account,
-                               "template":vm_created.templateid
-                               }
+                "id": vm_created.id,
+                "name": vm_created.name,
+                "displayname": vm_created.displayname,
+                "state": vm_created.state,
+                "zoneid": vm_created.zoneid,
+                "account": vm_created.account,
+                "template": vm_created.templateid
+            }
             actual_dict = {
-                               "id":listed_vm.id,
-                               "name":listed_vm.name,
-                               "displayname":listed_vm.displayname,
-                               "state":listed_vm.state,
-                               "zoneid":listed_vm.zoneid,
-                               "account":listed_vm.account,
-                               "template":listed_vm.templateid
-                               }
+                "id": listed_vm.id,
+                "name": listed_vm.name,
+                "displayname": listed_vm.displayname,
+                "state": listed_vm.state,
+                "zoneid": listed_vm.zoneid,
+                "account": listed_vm.account,
+                "template": listed_vm.templateid
+            }
             list_vm_status = self.__verify_values(
-                                                  expected_dict,
-                                                  actual_dict
-                                                  )
+                expected_dict,
+                actual_dict
+            )
             self.assertEqual(
-                             True,
-                             list_vm_status,
-                             "Listed VM by Id details are not as expected"
-                             )
+                True,
+                list_vm_status,
+                "Listed VM by Id details are not as expected"
+            )
             # Listing all the VMs for a user again for non-matching zone
             list_vms = VirtualMachine.list(
-                                           self.userapiclient,
-                                           listall=self.services["listall"],
-                                           page=1,
-                                           pagesize=self.services["pagesize"],
-                                           domainid=self.account.domainid,
-                                           zoneid=zones_list[1].id
-                                           )
+                self.userapiclient,
+                listall=self.services["listall"],
+                page=1,
+                pagesize=self.services["pagesize"],
+                domainid=self.account.domainid,
+                zoneid=zones_list[1].id
+            )
             self.assertIsNone(
-                              list_vms,
-                              "VM's listed for non matching zone"
-                              )
+                list_vms,
+                "VM's listed for non matching zone"
+            )
             self.services["virtual_machine"]["zoneid"] = current_zone
             self.services["virtual_machine"]["template"] = current_template
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
     def test_09_list_vm_by_zone_name(self):
-        """  
-        @Desc: Test List VM by Zone. 
+        """
+        @Desc: Test List VM by Zone.
         This test case is applicable for a setup having multiple zones.
         @Steps:
         Step1: Listing all the zones
@@ -1105,22 +1136,26 @@ class TestListInstances(cloudstackTestCase):
         Step6: Deploying a VM
         Step7: Listing all the VMs for a user again
         Step8: Verifying that list size is increased by 1
-        Step9: Listing the VM by specifying name of VM created in step6 and matching zone (matching name and zone)
+        Step9: Listing the VM by specifying name of VM created in step6
+               and matching zone (matching name and zone)
         Step10: Verifying that the size of the list is 1
-        Step11: Verifying that the details of the listed VM are same as the VM created in step3
-        Step12: Listing the VM by specifying name of VM created in step6 and non matching zone (non matching zone)
+        Step11: Verifying that the details of the listed VM are same
+                as the VM created in step3
+        Step12: Listing the VM by specifying name of VM created in step6
+                and non matching zone (non matching zone)
         Step13: Verifying that the size of the list is 0
-        Step14: Listing the VM by specifying non matching name and matching zone (non matching name)
+        Step14: Listing the VM by specifying non matching name and
+                matching zone (non matching name)
         Step15: Verifying that the size of the list is 0
         """
         # Listing all the zones available
         zones_list = Zone.list(self.apiClient)
         status = validateList(zones_list)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "zones not available in the given setup"
-                          )
+            PASS,
+            status[0],
+            "zones not available in the given setup"
+        )
         current_zone = self.services["virtual_machine"]["zoneid"]
         current_template = self.services["virtual_machine"]["template"]
         # Checking if there are multiple zones in the setup.
@@ -1129,343 +1164,353 @@ class TestListInstances(cloudstackTestCase):
         else:
             # Getting the template available under the zone
             template = get_template(
-                                    self.apiClient,
-                                    zones_list[0].id,
-                                    self.services["ostype"]
-                                    )
+                self.apiClient,
+                zones_list[0].id,
+                self.services["ostype"]
+            )
             self.assertIsNotNone(
-                                 template,
-                                 "Template not found for zone"
-                                 )
+                template,
+                "Template not found for zone"
+            )
             self.services["virtual_machine"]["zoneid"] = zones_list[0].id
             self.services["virtual_machine"]["template"] = template.id
             # Listing all the VM's for a User
             list_vms_before = VirtualMachine.list(
-                                                  self.userapiclient,
-                                                  listall=self.services["listall"],
-                                                  page=1,
-                                                  pagesize=self.services["pagesize"],
-                                                  domainid=self.account.domainid,
-                                                  zoneid=zones_list[0].id,
-                                                  account=self.account.name
-                                                  )
+                self.userapiclient,
+                listall=self.services["listall"],
+                page=1,
+                pagesize=self.services["pagesize"],
+                domainid=self.account.domainid,
+                zoneid=zones_list[0].id,
+                account=self.account.name
+            )
             self.assertIsNone(
-                               list_vms_before,
-                               "Virtual Machine already exists for newly created user"
-                               )
+                list_vms_before,
+                "Virtual Machine already exists for newly created user"
+            )
             # Deploying a VM
             vm_created = VirtualMachine.create(
-                                               self.userapiclient,
-                                               self.services["virtual_machine"],
-                                               accountid=self.account.name,
-                                               domainid=self.account.domainid,
-                                               serviceofferingid=self.service_offering.id,
-                                               )
+                self.userapiclient,
+                self.services["virtual_machine"],
+                accountid=self.account.name,
+                domainid=self.account.domainid,
+                serviceofferingid=self.service_offering.id,
+            )
             self.assertIsNotNone(
-                                 vm_created,
-                                 "VM creation failed"
-                                 )
-            self.cleanup.append(vm_created)
+                vm_created,
+                "VM creation failed"
+            )
             # Listing all the VMs for a user again for matching zone
             list_vms_after = VirtualMachine.list(
-                                                 self.userapiclient,
-                                                 listall=self.services["listall"],
-                                                 page=1,
-                                                 pagesize=self.services["pagesize"],
-                                                 domainid=self.account.domainid,
-                                                 zoneid=zones_list[0].id,
-                                                 account=self.account.name
-                                                 )
+                self.userapiclient,
+                listall=self.services["listall"],
+                page=1,
+                pagesize=self.services["pagesize"],
+                domainid=self.account.domainid,
+                zoneid=zones_list[0].id,
+                account=self.account.name
+            )
             status = validateList(list_vms_after)
             self.assertEquals(
-                              PASS,
-                              status[0],
-                              "VM creation failed"
-                              )
+                PASS,
+                status[0],
+                "VM creation failed"
+            )
             # Verifying that the size of the list is 1
             self.assertEquals(
-                              1,
-                              len(list_vms_after),
-                              "VM list count is not matching"
-                              )
-            # Listing the VM by specifying name of VM created in above and matching zone
+                1,
+                len(list_vms_after),
+                "VM list count is not matching"
+            )
+            # Listing the VM by specifying name of VM created in above and
+            # matching zone
             list_vms = VirtualMachine.list(
-                                           self.userapiclient,
-                                           listall=self.services["listall"],
-                                           page=1,
-                                           pagesize=self.services["pagesize"],
-                                           domainid=self.account.domainid,
-                                           zoneid=zones_list[0].id,
-                                           name=vm_created.name
-                                           )
+                self.userapiclient,
+                listall=self.services["listall"],
+                page=1,
+                pagesize=self.services["pagesize"],
+                domainid=self.account.domainid,
+                zoneid=zones_list[0].id,
+                name=vm_created.name
+            )
             status = validateList(list_vms)
             self.assertEquals(
-                              PASS,
-                              status[0],
-                              "Listing VM's by name and zone failed"
-                              )
+                PASS,
+                status[0],
+                "Listing VM's by name and zone failed"
+            )
             # Verifying Verifying that the size of the list is 1
             self.assertEquals(
-                              1,
-                              len(list_vms),
-                              "Count of listed VM's by name and zone is not as expected"
-                              )
+                1,
+                len(list_vms),
+                "Count of listed VM's by name and zone is not as expected"
+            )
             listed_vm = list_vms[0]
-            # Verifying that the details of the Listed VM are same as the VM deployed above
+            # Verifying that the details of the Listed VM are same
+            # as the VM deployed above
             # Creating expected and actual values dictionaries
             expected_dict = {
-                             "id":vm_created.id,
-                             "name":vm_created.name,
-                             "displayname":vm_created.displayname,
-                             "state":vm_created.state,
-                             "zoneid":vm_created.zoneid,
-                             "account":vm_created.account,
-                             "template":vm_created.templateid
-                               }
+                "id": vm_created.id,
+                "name": vm_created.name,
+                "displayname": vm_created.displayname,
+                "state": vm_created.state,
+                "zoneid": vm_created.zoneid,
+                "account": vm_created.account,
+                "template": vm_created.templateid
+            }
             actual_dict = {
-                               "id":listed_vm.id,
-                               "name":listed_vm.name,
-                               "displayname":listed_vm.displayname,
-                               "state":listed_vm.state,
-                               "zoneid":listed_vm.zoneid,
-                               "account":listed_vm.account,
-                               "template":listed_vm.templateid
-                               }
+                "id": listed_vm.id,
+                "name": listed_vm.name,
+                "displayname": listed_vm.displayname,
+                "state": listed_vm.state,
+                "zoneid": listed_vm.zoneid,
+                "account": listed_vm.account,
+                "template": listed_vm

<TRUNCATED>

[04/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Handle the case where the volume a snapshot was created from is removed from the database


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

Branch: refs/heads/statscollector-graphite
Commit: ebb96f5e2f533802107492e5e7741786d6266a3b
Parents: 05bec59
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Thu Nov 6 17:43:07 2014 -0700
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Thu Nov 6 19:44:46 2014 -0700

----------------------------------------------------------------------
 .../snapshot/StorageSystemSnapshotStrategy.java | 20 +++++++++-
 server/src/com/cloud/api/ApiResponseHelper.java | 42 +++++++++++++++++---
 .../com/cloud/template/TemplateManagerImpl.java | 13 ++++--
 3 files changed, 66 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ebb96f5e/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
index 9a6c51b..2367825 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
@@ -37,6 +37,8 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService;
 import org.apache.cloudstack.storage.command.SnapshotAndCopyAnswer;
 import org.apache.cloudstack.storage.command.SnapshotAndCopyCommand;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 
 import com.cloud.agent.AgentManager;
@@ -76,6 +78,7 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase {
     @Inject private PrimaryDataStoreDao _storagePoolDao;
     @Inject private SnapshotDao _snapshotDao;
     @Inject private SnapshotDataFactory _snapshotDataFactory;
+    @Inject private SnapshotDataStoreDao _snapshotStoreDao;
     @Inject private SnapshotDetailsDao _snapshotDetailsDao;
     @Inject private VMInstanceDao _vmInstanceDao;
     @Inject private VolumeDao _volumeDao;
@@ -400,7 +403,22 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase {
         long volumeId = snapshot.getVolumeId();
         VolumeVO volumeVO = _volumeDao.findById(volumeId);
 
-        long storagePoolId = volumeVO.getPoolId();
+        long storagePoolId;
+
+        if (volumeVO == null) {
+            SnapshotDataStoreVO snapshotStore = _snapshotStoreDao.findBySnapshot(snapshot.getId(), DataStoreRole.Primary);
+
+            if (snapshotStore != null) {
+                storagePoolId = snapshotStore.getDataStoreId();
+            }
+            else {
+                throw new CloudRuntimeException("Unable to determine the storage pool of the snapshot");
+            }
+        }
+        else {
+            storagePoolId = volumeVO.getPoolId();
+        }
+
         DataStore dataStore = _dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);
 
         Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ebb96f5e/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 4c22127..8172987 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -149,8 +149,10 @@ import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
 import org.apache.cloudstack.region.PortableIp;
 import org.apache.cloudstack.region.PortableIpRange;
 import org.apache.cloudstack.region.Region;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.cloudstack.usage.Usage;
 import org.apache.cloudstack.usage.UsageService;
 import org.apache.cloudstack.usage.UsageTypes;
@@ -295,6 +297,7 @@ import com.cloud.uservm.UserVm;
 import com.cloud.utils.Pair;
 import com.cloud.utils.StringUtils;
 import com.cloud.utils.db.EntityManager;
+import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.Ip;
 import com.cloud.utils.net.NetUtils;
 import com.cloud.vm.ConsoleProxyVO;
@@ -333,7 +336,9 @@ public class ApiResponseHelper implements ResponseGenerator {
     @Inject
     private DataStoreManager _dataStoreMgr;
     @Inject
-    SnapshotDataStoreDao _snapshotStoreDao;
+    private SnapshotDataStoreDao _snapshotStoreDao;
+    @Inject
+    private PrimaryDataStoreDao _storagePoolDao;
 
     @Override
     public UserResponse createUserResponse(User user) {
@@ -1447,14 +1452,41 @@ public class ApiResponseHelper implements ResponseGenerator {
 
     @Override
     public List<TemplateResponse> createTemplateResponses(ResponseView view, long templateId, Long snapshotId, Long volumeId, boolean readyOnly) {
-        VolumeVO volume = null;
+        Long zoneId = null;
+
         if (snapshotId != null) {
             Snapshot snapshot = ApiDBUtils.findSnapshotById(snapshotId);
-            volume = findVolumeById(snapshot.getVolumeId());
+            VolumeVO volume = findVolumeById(snapshot.getVolumeId());
+
+            // it seems that the volume can actually be removed from the DB at some point if it's deleted
+            // if volume comes back null, use another technique to try to discover the zone
+            if (volume == null) {
+                SnapshotDataStoreVO snapshotStore = _snapshotStoreDao.findBySnapshot(snapshot.getId(), DataStoreRole.Primary);
+
+                if (snapshotStore != null) {
+                    long storagePoolId = snapshotStore.getDataStoreId();
+
+                    StoragePoolVO storagePool = _storagePoolDao.findById(storagePoolId);
+
+                    if (storagePool != null) {
+                        zoneId = storagePool.getDataCenterId();
+                    }
+                }
+            }
+            else {
+                zoneId = volume.getDataCenterId();
+            }
         } else {
-            volume = findVolumeById(volumeId);
+            VolumeVO volume = findVolumeById(volumeId);
+
+            zoneId = volume.getDataCenterId();
         }
-        return createTemplateResponses(view, templateId, volume.getDataCenterId(), readyOnly);
+
+        if (zoneId == null) {
+            throw new CloudRuntimeException("Unable to determine the zone ID");
+        }
+
+        return createTemplateResponses(view, templateId, zoneId, readyOnly);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ebb96f5e/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index e495eb9..da3940c 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -80,6 +80,8 @@ import org.apache.cloudstack.storage.command.AttachCommand;
 import org.apache.cloudstack.storage.command.CommandResult;
 import org.apache.cloudstack.storage.command.DettachCommand;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
@@ -245,6 +247,8 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
     private EndPointSelector _epSelector;
     @Inject
     private UserVmJoinDao _userVmJoinDao;
+    @Inject
+    private SnapshotDataStoreDao _snapshotStoreDao;
 
     @Inject
     MessageBus _messageBus;
@@ -1470,10 +1474,13 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
     }
 
     private DataStoreRole getDataStoreRole(Snapshot snapshot) {
-        long volumeId = snapshot.getVolumeId();
-        VolumeVO volumeVO = _volumeDao.findById(volumeId);
+        SnapshotDataStoreVO snapshotStore = _snapshotStoreDao.findBySnapshot(snapshot.getId(), DataStoreRole.Primary);
+
+        if (snapshotStore == null) {
+            return DataStoreRole.Image;
+        }
 
-        long storagePoolId = volumeVO.getPoolId();
+        long storagePoolId = snapshotStore.getDataStoreId();
         DataStore dataStore = _dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);
 
         Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();


[10/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Allow infrastructure to handle delete of volume from DB


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

Branch: refs/heads/statscollector-graphite
Commit: b1915f35f86ffd9101b043f8114fe15a061f5e35
Parents: 330bd27
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Fri Nov 7 07:49:23 2014 -0700
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Fri Nov 7 07:49:53 2014 -0700

----------------------------------------------------------------------
 .../datastore/driver/ElastistorPrimaryDataStoreDriver.java        | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b1915f35/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
index 23db12d..770dcb9 100755
--- a/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
@@ -231,9 +231,6 @@ public class ElastistorPrimaryDataStoreDriver extends CloudStackPrimaryDataStore
             }
 
             if (result) {
-
-                _volumeDao.deleteVolumesByInstance(volumeInfo.getId());
-
                 long usedBytes = storagePool.getUsedBytes();
                 long capacityIops = storagePool.getCapacityIops();
 


[25/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7870: When Vm deployments fail and end in error state volume count should be decremented


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

Branch: refs/heads/statscollector-graphite
Commit: a8b89bea4f37a54267694b9a49be6b5bec91f0b0
Parents: 1e1cc11
Author: Nitin Mehta <ni...@citrix.com>
Authored: Sun Nov 9 23:01:28 2014 -0800
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Sun Nov 9 23:01:28 2014 -0800

----------------------------------------------------------------------
 .../cloudstack/engine/orchestration/VolumeOrchestrator.java     | 4 ++++
 server/src/com/cloud/vm/UserVmManagerImpl.java                  | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a8b89bea/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index 4b40d5a..826e2ee 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -1380,9 +1380,13 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
             } else {
                 volService.destroyVolume(volume.getId());
             }
+            // FIXME - All this is boiler plate code and should be done as part of state transition. This shouldn't be part of orchestrator.
             // publish usage event for the volume
             UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_DELETE, volume.getAccountId(), volume.getDataCenterId(), volume.getId(), volume.getName(),
                     Volume.class.getName(), volume.getUuid(), volume.isDisplayVolume());
+            _resourceLimitMgr.decrementResourceCount(volume.getAccountId(), ResourceType.volume, volume.isDisplay());
+            //FIXME - why recalculate and not decrement
+            _resourceLimitMgr.recalculateResourceCount(volume.getAccountId(), volume.getDomainId(), ResourceType.primary_storage.getOrdinal());
         } catch (Exception e) {
             s_logger.debug("Failed to destroy volume" + volume.getId(), e);
             throw new CloudRuntimeException("Failed to destroy volume" + volume.getId(), e);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a8b89bea/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 ba07211..8096841 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -4785,7 +4785,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
                 newVol = volumeMgr.allocateDuplicateVolume(root, null);
             }
 
-            // Create Usage event for the newly created volume
+            // 1. Save usage event and update resource count for user vm volumes
+            _resourceLimitMgr.incrementResourceCount(newVol.getAccountId(), ResourceType.volume, newVol.isDisplay());
+            _resourceLimitMgr.incrementResourceCount(newVol.getAccountId(), ResourceType.primary_storage, newVol.isDisplay(), new Long(newVol.getSize()));
+            // 2. Create Usage event for the newly created volume
             UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VOLUME_CREATE, newVol.getAccountId(), newVol.getDataCenterId(), newVol.getId(), newVol.getName(), newVol.getDiskOfferingId(), template.getId(), newVol.getSize());
             _usageEventDao.persist(usageEvent);
 


[16/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7868: Failed storage.PrimaryStorageDownloadCommand leaves corrupt VDIs in primary storage.


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

Branch: refs/heads/statscollector-graphite
Commit: 6a6d4d876f876bf37219a381029184ba54024bb3
Parents: a275bd7
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Sat Nov 8 13:34:31 2014 +0530
Committer: Sanjay Tripathi <sa...@citrix.com>
Committed: Sat Nov 8 13:43:56 2014 +0530

----------------------------------------------------------------------
 .../xenserver/resource/CitrixResourceBase.java          | 10 ++++++++++
 scripts/vm/hypervisor/xenserver/vmopspremium            | 12 +++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a6d4d87/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index 0dde4cc..aa115b1 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -2744,6 +2744,16 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
                 try {
                     vdi.destroy(conn);
                 } catch (Exception e) {
+                    String msg = "Failed to destroy VDI : " + nameLabel + "due to " + e.toString() + "\n Force deleting VDI using system 'rm' command";
+                    s_logger.warn(msg);
+                    try {
+                        String srUUID = vdi.getSR(conn).getUuid(conn);
+                        String vdiUUID = vdi.getUuid(conn);
+                        String vdifile = "/var/run/sr-mount/" + srUUID + "/" + vdiUUID + ".vhd";
+                        String results = callHostPluginAsync(conn, "vmopspremium", "remove_corrupt_vdi", 10, "vdifile", vdifile);
+                    } catch (Exception e2) {
+                        s_logger.warn(e2);
+                    }
                 }
             }
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a6d4d87/scripts/vm/hypervisor/xenserver/vmopspremium
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmopspremium b/scripts/vm/hypervisor/xenserver/vmopspremium
index 5b9c34f..3b0b4ac 100755
--- a/scripts/vm/hypervisor/xenserver/vmopspremium
+++ b/scripts/vm/hypervisor/xenserver/vmopspremium
@@ -101,6 +101,16 @@ def copy_vhd_from_secondarystorage(session, args):
     return txt
 
 @echo
+def remove_corrupt_vdi(session, args):
+    vdifile = args['vdifile']
+    try:
+        cmd = ['rm', '-f', vdifile]
+        txt = util.pread2(cmd)
+    except:
+        txt = '10#failed'
+    return txt
+
+@echo
 def setup_heartbeat_sr(session, args):
     host = args['host']
     sr = args['sr']
@@ -146,4 +156,4 @@ def asmonitor(session, args):
         return 'fail'
 
 if __name__ == "__main__":
-    XenAPIPlugin.dispatch({"forceShutdownVM":forceShutdownVM, "upgrade_snapshot":upgrade_snapshot, "create_privatetemplate_from_snapshot":create_privatetemplate_from_snapshot, "copy_vhd_to_secondarystorage":copy_vhd_to_secondarystorage, "copy_vhd_from_secondarystorage":copy_vhd_from_secondarystorage, "setup_heartbeat_sr":setup_heartbeat_sr, "setup_heartbeat_file":setup_heartbeat_file, "heartbeat": heartbeat, "asmonitor": asmonitor})
+    XenAPIPlugin.dispatch({"forceShutdownVM":forceShutdownVM, "upgrade_snapshot":upgrade_snapshot, "create_privatetemplate_from_snapshot":create_privatetemplate_from_snapshot, "copy_vhd_to_secondarystorage":copy_vhd_to_secondarystorage, "copy_vhd_from_secondarystorage":copy_vhd_from_secondarystorage, "setup_heartbeat_sr":setup_heartbeat_sr, "setup_heartbeat_file":setup_heartbeat_file, "heartbeat": heartbeat, "asmonitor": asmonitor, "remove_corrupt_vdi": remove_corrupt_vdi})


[02/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7683: hold a db lock during vm expunge


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

Branch: refs/heads/statscollector-graphite
Commit: 812b0122e2972987e3b4a38cc7431ace78b09145
Parents: 885bba9
Author: Edison Su <su...@gmail.com>
Authored: Thu Nov 6 15:22:34 2014 -0800
Committer: Edison Su <su...@gmail.com>
Committed: Thu Nov 6 15:37:15 2014 -0800

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/812b0122/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 2636096..01a692d 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1703,6 +1703,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
     @Override
     public boolean expunge(UserVmVO vm, long callerUserId, Account caller) {
+        vm = _vmDao.acquireInLockTable(vm.getId());
+        if (vm == null) {
+            return false;
+        }
         try {
             List<VolumeVO> rootVol = _volsDao.findByInstanceAndType(vm.getId(), Volume.Type.ROOT);
             // expunge the vm
@@ -1739,6 +1743,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         } catch (ConcurrentOperationException e) {
             s_logger.warn("Concurrent operations on expunging " + vm, e);
             return false;
+        } finally {
+            _vmDao.releaseFromLockTable(vm.getId());
         }
     }
 


[36/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Add check to ensure VR template version matches digit.digit.digit format. Returns version as 0 otherwise


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

Branch: refs/heads/statscollector-graphite
Commit: 990da0845170d1ca6af9c26de94195417d1fbd19
Parents: 781648f
Author: Kishan Kavala <ki...@apache.org>
Authored: Mon Oct 20 22:15:17 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Mon Nov 10 15:33:50 2014 +0530

----------------------------------------------------------------------
 utils/src/com/cloud/maint/Version.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/990da084/utils/src/com/cloud/maint/Version.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/maint/Version.java b/utils/src/com/cloud/maint/Version.java
index 22b2f33..925806e 100644
--- a/utils/src/com/cloud/maint/Version.java
+++ b/utils/src/com/cloud/maint/Version.java
@@ -64,7 +64,7 @@ public class Version {
 
     public static String trimRouterVersion(String version) {
         String[] tokens = version.split(" ");
-        if (tokens.length >= 3) {
+        if (tokens.length >= 3 && tokens[2].matches("[0-9]+(\\.[0-9]+)*")) {
             return tokens[2];
         }
         return "0";


[40/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
CLOUDSTACK-7862: Fixed the script 'maint/test_high_availability.py' - Test Cases failing on Simulator as Testcases try to ssh to the VMs

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


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

Branch: refs/heads/statscollector-graphite
Commit: fa8f0a43c3ae9025fede058178284792936c8657
Parents: aed6e95
Author: Chandan Purushothama <Ch...@citrix.com>
Authored: Fri Nov 7 15:00:03 2014 -0800
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Nov 10 16:34:30 2014 +0530

----------------------------------------------------------------------
 test/integration/component/maint/test_high_availability.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fa8f0a43/test/integration/component/maint/test_high_availability.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_high_availability.py b/test/integration/component/maint/test_high_availability.py
index cc687f8..3e69fd5 100644
--- a/test/integration/component/maint/test_high_availability.py
+++ b/test/integration/component/maint/test_high_availability.py
@@ -165,7 +165,7 @@ class TestHighAvailability(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags = ["advanced", "advancedns", "multihost"])
+    @attr(tags = ["advanced", "advancedns", "multihost"], required_hardware="true")
     def test_01_host_maintenance_mode(self):
         """Test host maintenance mode
         """
@@ -556,7 +556,7 @@ class TestHighAvailability(cloudstackTestCase):
                       )
         return
 
-    @attr(tags = ["advanced", "advancedns", "multihost"])
+    @attr(tags = ["advanced", "advancedns", "multihost"], required_hardware="true")
     def test_02_host_maintenance_mode_with_activities(self):
         """Test host maintenance mode with activities
         """


[31/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814

Posted by wi...@apache.org.
Normalize some error message strings to make maintenance (i.e., changing said error messages) a bit easier.

Signed-off-by: Rajani Karuturi <ra...@gmail.com>


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

Branch: refs/heads/statscollector-graphite
Commit: de3eb88b33eabc98568c353df4f5ee9e3233239c
Parents: 1cc733b
Author: Derrick Schneider <de...@opower.com>
Authored: Wed Nov 5 16:37:29 2014 -0800
Committer: Rajani Karuturi <ra...@gmail.com>
Committed: Mon Nov 10 15:00:28 2014 +0530

----------------------------------------------------------------------
 .../cloud/upgrade/DatabaseUpgradeChecker.java   | 30 +++++++++++---------
 1 file changed, 17 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de3eb88b/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java b/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
index 34d3bdf..fcc5c37 100755
--- a/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
+++ b/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
@@ -276,10 +276,10 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
         }
 
         if (Version.compare(trimmedCurrentVersion, upgrades[upgrades.length - 1].getUpgradedVersion()) != 0) {
-            s_logger.error("The end upgrade version is actually at " + upgrades[upgrades.length - 1].getUpgradedVersion() +
-                    " but our management server code version is at " + currentVersion);
-            throw new CloudRuntimeException("The end upgrade version is actually at " + upgrades[upgrades.length - 1].getUpgradedVersion() +
-                    " but our management server code version is at " + currentVersion);
+            String errorMessage = "The end upgrade version is actually at " + upgrades[upgrades.length - 1].getUpgradedVersion() +
+                    " but our management server code version is at " + currentVersion;
+            s_logger.error(errorMessage);
+            throw new CloudRuntimeException(errorMessage);
         }
 
         boolean supportsRollingUpgrade = true;
@@ -292,9 +292,10 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
 
         if (!supportsRollingUpgrade && false) { // FIXME: Needs to detect if there are management servers running
             // ClusterManagerImpl.arePeersRunning(null)) {
-            s_logger.error("Unable to run upgrade because the upgrade sequence does not support rolling update and there are other management server nodes running");
-            throw new CloudRuntimeException(
-                    "Unable to run upgrade because the upgrade sequence does not support rolling update and there are other management server nodes running");
+            String errorMessage =
+                "Unable to run upgrade because the upgrade sequence does not support rolling update and there are other management server nodes running";
+            s_logger.error(errorMessage);
+            throw new CloudRuntimeException(errorMessage);
         }
 
         for (DbUpgrade upgrade : upgrades) {
@@ -307,8 +308,9 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
                 try {
                     conn = txn.getConnection();
                 } catch (SQLException e) {
-                    s_logger.error("Unable to upgrade the database", e);
-                    throw new CloudRuntimeException("Unable to upgrade the database", e);
+                    String errorMessage = "Unable to upgrade the database";
+                    s_logger.error(errorMessage, e);
+                    throw new CloudRuntimeException(errorMessage, e);
                 }
                 File[] scripts = upgrade.getPrepareScripts();
                 if (scripts != null) {
@@ -342,8 +344,9 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
 
                 txn.commit();
             } catch (CloudRuntimeException e) {
-                s_logger.error("Unable to upgrade the database", e);
-                throw new CloudRuntimeException("Unable to upgrade the database", e);
+                String errorMessage = "Unable to upgrade the database";
+                s_logger.error(errorMessage, e);
+                throw new CloudRuntimeException(errorMessage, e);
             } finally {
                 txn.close();
             }
@@ -382,8 +385,9 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
                             try {
                                 conn = txn.getConnection();
                             } catch (SQLException e) {
-                                s_logger.error("Unable to cleanup the database", e);
-                                throw new CloudRuntimeException("Unable to cleanup the database", e);
+                                String errorMessage = "Unable to cleanup the database";
+                                s_logger.error(errorMessage, e);
+                                throw new CloudRuntimeException(errorMessage, e);
                             }
 
                             File[] scripts = upgrade.getCleanupScripts();