You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2013/10/04 02:03:59 UTC
git commit: updated refs/heads/spring-modularization to c9a9a3b
Updated Branches:
refs/heads/spring-modularization 12146ce40 -> c9a9a3b7b
Make SnapshotStrategy and DataMotionStrategy discovered and registered
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c9a9a3b7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c9a9a3b7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c9a9a3b7
Branch: refs/heads/spring-modularization
Commit: c9a9a3b7b3a6c09adc279b31b3fef3606fe62fe8
Parents: 12146ce
Author: Darren Shepherd <da...@gmail.com>
Authored: Thu Oct 3 17:03:28 2013 -0700
Committer: Darren Shepherd <da...@gmail.com>
Committed: Thu Oct 3 17:03:28 2013 -0700
----------------------------------------------------------------------
.../core/spring-core-registry-core-context.xml | 10 ++++++
...ng-lifecycle-storage-context-inheritable.xml | 14 ++++++++
...g-engine-storage-datamotion-core-context.xml | 14 ++------
...ngine-storage-datamotion-storage-context.xml | 34 ++++++++++++++++++++
.../storage/motion/DataMotionServiceImpl.java | 7 +++-
...ing-engine-storage-snapshot-core-context.xml | 3 --
...-engine-storage-snapshot-storage-context.xml | 33 +++++++++++++++++++
.../spring-server-core-managers-context.xml | 4 ++-
.../storage/snapshot/SnapshotManagerImpl.java | 11 ++++++-
9 files changed, 112 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9a9a3b7/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
----------------------------------------------------------------------
diff --git a/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml b/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
index 170d33d..1de9a04 100644
--- a/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
+++ b/core/resources/META-INF/cloudstack/core/spring-core-registry-core-context.xml
@@ -184,4 +184,14 @@
</property>
</bean>
+ <bean id="snapshotStrategiesRegistry"
+ class="org.apache.cloudstack.spring.lifecycle.registry.ExtensionRegistry">
+ <property name="excludeKey" value="snapshot.strategies.exclude" />
+ </bean>
+
+ <bean id="dataMotionStrategiesRegistry"
+ class="org.apache.cloudstack.spring.lifecycle.registry.ExtensionRegistry">
+ <property name="excludeKey" value="data.motion.strategies.exclude" />
+ </bean>
+
</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9a9a3b7/core/resources/META-INF/cloudstack/storage/spring-lifecycle-storage-context-inheritable.xml
----------------------------------------------------------------------
diff --git a/core/resources/META-INF/cloudstack/storage/spring-lifecycle-storage-context-inheritable.xml b/core/resources/META-INF/cloudstack/storage/spring-lifecycle-storage-context-inheritable.xml
index 617dd21..b6eed7d 100644
--- a/core/resources/META-INF/cloudstack/storage/spring-lifecycle-storage-context-inheritable.xml
+++ b/core/resources/META-INF/cloudstack/storage/spring-lifecycle-storage-context-inheritable.xml
@@ -49,6 +49,7 @@
<property name="registry" ref="templateAdapterRegistry" />
<property name="typeClass" value="com.cloud.template.TemplateAdapter" />
</bean>
+
<bean class="org.apache.cloudstack.spring.lifecycle.registry.RegistryLifecycle">
<property name="registry" ref="podAllocatorsRegistry" />
@@ -56,5 +57,18 @@
value="com.cloud.agent.manager.allocator.PodAllocator" />
</bean>
+ <bean class="org.apache.cloudstack.spring.lifecycle.registry.RegistryLifecycle">
+ <property name="registry" ref="snapshotStrategiesRegistry" />
+ <property name="typeClass"
+ value="org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy" />
+ </bean>
+
+ <bean class="org.apache.cloudstack.spring.lifecycle.registry.RegistryLifecycle">
+ <property name="registry" ref="dataMotionStrategiesRegistry" />
+ <property name="typeClass"
+ value="org.apache.cloudstack.engine.subsystem.api.storage.DataMotionStrategy" />
+ </bean>
+
+
</beans>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9a9a3b7/engine/storage/datamotion/resources/META-INF/cloudstack/core/spring-engine-storage-datamotion-core-context.xml
----------------------------------------------------------------------
diff --git a/engine/storage/datamotion/resources/META-INF/cloudstack/core/spring-engine-storage-datamotion-core-context.xml b/engine/storage/datamotion/resources/META-INF/cloudstack/core/spring-engine-storage-datamotion-core-context.xml
index 822644e..07c0fdf 100644
--- a/engine/storage/datamotion/resources/META-INF/cloudstack/core/spring-engine-storage-datamotion-core-context.xml
+++ b/engine/storage/datamotion/resources/META-INF/cloudstack/core/spring-engine-storage-datamotion-core-context.xml
@@ -26,20 +26,10 @@
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
>
- <bean id="ancientDataMotionStrategy"
- class="org.apache.cloudstack.storage.motion.AncientDataMotionStrategy" />
- <bean id="xenserverStorageMotionStrategy"
- class="org.apache.cloudstack.storage.motion.XenServerStorageMotionStrategy" />
<bean id="dataMotionServiceImpl"
class="org.apache.cloudstack.storage.motion.DataMotionServiceImpl">
- <property name="strategies">
- <list>
- <ref local="ancientDataMotionStrategy" />
- <ref local="xenserverStorageMotionStrategy" />
- </list>
- </property>
+ <property name="strategies" value="#{dataMotionStrategiesRegistry.registered}" />
</bean>
-
-
+
</beans>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9a9a3b7/engine/storage/datamotion/resources/META-INF/cloudstack/storage/spring-engine-storage-datamotion-storage-context.xml
----------------------------------------------------------------------
diff --git a/engine/storage/datamotion/resources/META-INF/cloudstack/storage/spring-engine-storage-datamotion-storage-context.xml b/engine/storage/datamotion/resources/META-INF/cloudstack/storage/spring-engine-storage-datamotion-storage-context.xml
new file mode 100644
index 0000000..725f7d3
--- /dev/null
+++ b/engine/storage/datamotion/resources/META-INF/cloudstack/storage/spring-engine-storage-datamotion-storage-context.xml
@@ -0,0 +1,34 @@
+<!--
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:aop="http://www.springframework.org/schema/aop"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+ >
+ <bean id="ancientDataMotionStrategy"
+ class="org.apache.cloudstack.storage.motion.AncientDataMotionStrategy" />
+ <bean id="xenserverStorageMotionStrategy"
+ class="org.apache.cloudstack.storage.motion.XenServerStorageMotionStrategy" />
+
+</beans>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9a9a3b7/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java
index 9f0f531..4da7305 100644
--- a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java
+++ b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java
@@ -36,7 +36,7 @@ import java.util.Map;
@Component
public class DataMotionServiceImpl implements DataMotionService {
- @Inject
+
List<DataMotionStrategy> strategies;
@Override
@@ -74,7 +74,12 @@ public class DataMotionServiceImpl implements DataMotionService {
throw new CloudRuntimeException("can't find strategy to move data");
}
+ @Inject
public void setStrategies(List<DataMotionStrategy> strategies) {
this.strategies = strategies;
}
+
+ public List<DataMotionStrategy> getStrategies() {
+ return strategies;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9a9a3b7/engine/storage/snapshot/resources/META-INF/cloudstack/core/spring-engine-storage-snapshot-core-context.xml
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/resources/META-INF/cloudstack/core/spring-engine-storage-snapshot-core-context.xml b/engine/storage/snapshot/resources/META-INF/cloudstack/core/spring-engine-storage-snapshot-core-context.xml
index c9c89e3..3088992 100644
--- a/engine/storage/snapshot/resources/META-INF/cloudstack/core/spring-engine-storage-snapshot-core-context.xml
+++ b/engine/storage/snapshot/resources/META-INF/cloudstack/core/spring-engine-storage-snapshot-core-context.xml
@@ -31,9 +31,6 @@
class="org.apache.cloudstack.storage.snapshot.SnapshotServiceImpl"
depends-on="snapshotStateMachineManagerImpl, snapshotDataFactoryImpl, dataStoreManagerImpl, dataMotionServiceImpl, objectInDataStoreManagerImpl" />
- <bean id="xenserverSnapshotStrategy"
- class="org.apache.cloudstack.storage.snapshot.XenserverSnapshotStrategy" />
-
<bean id="snapshotDataFactoryImpl"
class="org.apache.cloudstack.storage.snapshot.SnapshotDataFactoryImpl"
depends-on="dataStoreManagerImpl, snapshotDataStoreDaoImpl, volumeDataFactoryImpl" />
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9a9a3b7/engine/storage/snapshot/resources/META-INF/cloudstack/storage/spring-engine-storage-snapshot-storage-context.xml
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/resources/META-INF/cloudstack/storage/spring-engine-storage-snapshot-storage-context.xml b/engine/storage/snapshot/resources/META-INF/cloudstack/storage/spring-engine-storage-snapshot-storage-context.xml
new file mode 100644
index 0000000..3faa894
--- /dev/null
+++ b/engine/storage/snapshot/resources/META-INF/cloudstack/storage/spring-engine-storage-snapshot-storage-context.xml
@@ -0,0 +1,33 @@
+<!--
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:aop="http://www.springframework.org/schema/aop"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+ >
+
+ <bean id="xenserverSnapshotStrategy"
+ class="org.apache.cloudstack.storage.snapshot.XenserverSnapshotStrategy" />
+
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9a9a3b7/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
----------------------------------------------------------------------
diff --git a/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml b/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
index 11b69d2..7400759 100644
--- a/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
+++ b/server/resources/META-INF/cloudstack/core/spring-server-core-managers-context.xml
@@ -142,7 +142,9 @@
<bean id="site2SiteVpnManagerImpl" class="com.cloud.network.vpn.Site2SiteVpnManagerImpl" />
- <bean id="snapshotManagerImpl" class="com.cloud.storage.snapshot.SnapshotManagerImpl" />
+ <bean id="snapshotManagerImpl" class="com.cloud.storage.snapshot.SnapshotManagerImpl" >
+ <property name="snapshotStrategies" value="#{snapshotStrategiesRegistry.registered}" />
+ </bean>
<bean id="snapshotSchedulerImpl" class="com.cloud.storage.snapshot.SnapshotSchedulerImpl" />
<bean id="storageNetworkManagerImpl" class="com.cloud.network.StorageNetworkManagerImpl" />
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9a9a3b7/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 2297e6a..9337705 100755
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -195,7 +195,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
@Inject EndPointSelector _epSelector;
@Inject
private ResourceManager _resourceMgr;
- @Inject
+
protected List<SnapshotStrategy> snapshotStrategies;
@@ -1193,4 +1193,13 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
}
return snapshot;
}
+
+ public List<SnapshotStrategy> getSnapshotStrategies() {
+ return snapshotStrategies;
+ }
+
+ @Inject
+ public void setSnapshotStrategies(List<SnapshotStrategy> snapshotStrategies) {
+ this.snapshotStrategies = snapshotStrategies;
+ }
}