cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject [33/44] git commit: updated refs/heads/vpc-toolkit-hugo to 1ad1883
Date Mon, 14 Jul 2014 13:37:37 GMT
CLOUDSTACK-7099. Volume snapshot is not getting backed up.
Correctly inject ConfigDao into SnapshotStateListener.


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

Branch: refs/heads/vpc-toolkit-hugo
Commit: 00778de96eb9f47a34bac79dc5175d16d71df194
Parents: ba38981
Author: Likitha Shetty <likitha.shetty@citrix.com>
Authored: Fri Jul 11 14:37:26 2014 +0530
Committer: Likitha Shetty <likitha.shetty@citrix.com>
Committed: Fri Jul 11 17:06:15 2014 +0530

----------------------------------------------------------------------
 .../spring-server-storage-context.xml             |  3 ++-
 .../storage/listener/SnapshotStateListener.java   | 18 +++++++++++++++---
 2 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/00778de9/server/resources/META-INF/cloudstack/server-storage/spring-server-storage-context.xml
----------------------------------------------------------------------
diff --git a/server/resources/META-INF/cloudstack/server-storage/spring-server-storage-context.xml
b/server/resources/META-INF/cloudstack/server-storage/spring-server-storage-context.xml
index 8b90200..8fe24ff 100644
--- a/server/resources/META-INF/cloudstack/server-storage/spring-server-storage-context.xml
+++ b/server/resources/META-INF/cloudstack/server-storage/spring-server-storage-context.xml
@@ -29,6 +29,7 @@
 
     <bean id="secondaryStorageVmDefaultAllocator"
         class="com.cloud.storage.secondary.SecondaryStorageVmDefaultAllocator" />
-
+    <bean id="snapshotStateListener"
+        class="com.cloud.storage.listener.SnapshotStateListener" />
 
 </beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/00778de9/server/src/com/cloud/storage/listener/SnapshotStateListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/listener/SnapshotStateListener.java b/server/src/com/cloud/storage/listener/SnapshotStateListener.java
index d995a82..8da71a6 100644
--- a/server/src/com/cloud/storage/listener/SnapshotStateListener.java
+++ b/server/src/com/cloud/storage/listener/SnapshotStateListener.java
@@ -22,10 +22,13 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
 import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.stereotype.Component;
 
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.framework.events.EventBus;
@@ -41,18 +44,27 @@ import com.cloud.storage.SnapshotVO;
 import com.cloud.utils.component.ComponentContext;
 import com.cloud.utils.fsm.StateListener;
 
+@Component
+@Local(value = {SnapshotStateListener.class})
 public class SnapshotStateListener implements StateListener<State, Event, SnapshotVO>
{
 
     protected static EventBus s_eventBus = null;
+    protected static ConfigurationDao s_configDao;
+
     @Inject
-    private ConfigurationDao _configDao;
+    private ConfigurationDao configDao;
 
-    private static final Logger s_logger = Logger.getLogger(VolumeStateListener.class);
+    private static final Logger s_logger = Logger.getLogger(SnapshotStateListener.class);
 
     public SnapshotStateListener() {
 
     }
 
+    @PostConstruct
+    void init() {
+        s_configDao = configDao;
+    }
+
     @Override
     public boolean preStateTransitionEvent(State oldState, Event event, State newState, SnapshotVO
vo, boolean status, Object opaque) {
         pubishOnEventBus(event.name(), "preStateTransitionEvent", vo, oldState, newState);
@@ -68,7 +80,7 @@ public class SnapshotStateListener implements StateListener<State, Event,
Snapsh
     private void pubishOnEventBus(String event, String status, Snapshot vo, State oldState,
State newState) {
 
         String configKey = Config.PublishResourceStateEvent.key();
-        String value = _configDao.getValue(configKey);
+        String value = s_configDao.getValue(configKey);
         boolean configValue = Boolean.parseBoolean(value);
         if(!configValue)
             return;


Mime
View raw message