cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject git commit: updated refs/heads/object_store to 389d7c1
Date Thu, 16 May 2013 21:34:25 GMT
Updated Branches:
  refs/heads/object_store cd318661d -> 389d7c1fa


if object is already stored in cache store, don't download again


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

Branch: refs/heads/object_store
Commit: 389d7c1fa075441b6c6471b81dedbd8e8720fe88
Parents: cd31866
Author: Edison Su <sudison@gmail.com>
Authored: Thu May 16 14:33:36 2013 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Thu May 16 14:34:06 2013 -0700

----------------------------------------------------------------------
 .../cache/manager/StorageCacheManagerImpl.java     |   10 ++++++++++
 .../com/cloud/ovm/hypervisor/OvmResourceBase.java  |    1 -
 test/integration/smoke/test_volumes.py             |    9 +++------
 3 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/389d7c1f/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheManagerImpl.java
b/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheManagerImpl.java
index 8fb898e..c76e67b 100644
--- a/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheManagerImpl.java
+++ b/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheManagerImpl.java
@@ -28,7 +28,9 @@ import javax.naming.ConfigurationException;
 import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataMotionService;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
 import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event;
 import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
 import org.apache.cloudstack.engine.subsystem.api.storage.StorageCacheManager;
@@ -51,6 +53,8 @@ public class StorageCacheManagerImpl implements StorageCacheManager, Manager
{
     List<StorageCacheAllocator> storageCacheAllocator;
     @Inject
     DataMotionService dataMotionSvr;
+    @Inject
+    ObjectInDataStoreManager objectInStoreMgr;
 
     @Override
     public DataStore getCacheStorage(Scope scope) {
@@ -133,6 +137,12 @@ public class StorageCacheManagerImpl implements StorageCacheManager,
Manager {
 	@Override
 	public DataObject createCacheObject(DataObject data, Scope scope) {
 		DataStore cacheStore = this.getCacheStorage(scope);
+		DataObjectInStore obj = objectInStoreMgr.findObject(data, cacheStore);
+		if (obj != null && obj.getState() == ObjectInDataStoreStateMachine.State.Ready)
{
+			s_logger.debug("there is already one in the cache store");
+			return objectInStoreMgr.get(data, cacheStore);
+		}
+		
 		//TODO: consider multiple thread to create
 		DataObject objOnCacheStore = cacheStore.create(data);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/389d7c1f/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java
index 61ac54e..59ba001 100755
--- a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java
+++ b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java
@@ -131,7 +131,6 @@ import com.cloud.vm.DiskProfile;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachine.State;
 import com.trilead.ssh2.SCPClient;
-import com.xensource.xenapi.Types.XenAPIException;
 
 public class OvmResourceBase implements ServerResource, HypervisorResource {
 	private static final Logger s_logger = Logger.getLogger(OvmResourceBase.class);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/389d7c1f/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index 4bf8203..f29410d 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -19,6 +19,7 @@
 #Import Local Modules
 import marvin
 from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import *
 from marvin.cloudstackAPI import *
 from marvin.remoteSSHClient import remoteSSHClient
 from marvin.integration.lib.utils import *
@@ -449,12 +450,8 @@ class TestVolumes(cloudstackTestCase):
         cmd.id = self.volume.id
         #Proper exception should be raised; deleting attach VM is not allowed
         #with self.assertRaises(Exception):
-        result = self.apiClient.deleteVolume(cmd)
-        self.assertEqual(
-                         result,
-                         None,
-                         "Check for delete download error while volume is attached"
-                         )
+        with self.assertRaises(cloudstackAPIException):
+            self.apiClient.deleteVolume(cmd)
         
     @attr(tags = ["advanced", "advancedns", "smoke"])    
     def test_05_detach_volume(self):


Mime
View raw message