incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [8/44] Revert "Merge remote-tracking branch 'origin/javelin' into javelin"
Date Tue, 15 Jan 2013 02:04:55 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/server/src/com/cloud/storage/listener/StoragePoolMonitor.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/listener/StoragePoolMonitor.java b/server/src/com/cloud/storage/listener/StoragePoolMonitor.java
index af6f0f5..e848a87 100755
--- a/server/src/com/cloud/storage/listener/StoragePoolMonitor.java
+++ b/server/src/com/cloud/storage/listener/StoragePoolMonitor.java
@@ -18,6 +18,8 @@ package com.cloud.storage.listener;
 
 import java.util.List;
 
+import javax.inject.Inject;
+
 import org.apache.log4j.Logger;
 
 import com.cloud.agent.Listener;
@@ -31,96 +33,93 @@ import com.cloud.exception.ConnectionException;
 import com.cloud.host.HostVO;
 import com.cloud.host.Status;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.server.ManagementService;
 import com.cloud.storage.OCFS2Manager;
+import com.cloud.storage.Storage.StoragePoolType;
 import com.cloud.storage.StorageManagerImpl;
 import com.cloud.storage.StoragePoolStatus;
 import com.cloud.storage.StoragePoolVO;
-import com.cloud.storage.Storage.StoragePoolType;
 import com.cloud.storage.dao.StoragePoolDao;
-import com.cloud.utils.component.ComponentLocator;
+
 
 public class StoragePoolMonitor implements Listener {
     private static final Logger s_logger = Logger.getLogger(StoragePoolMonitor.class);
-	private final StorageManagerImpl _storageManager;
-	private final StoragePoolDao _poolDao;
-	OCFS2Manager _ocfs2Mgr;
-	
+    private final StorageManagerImpl _storageManager;
+    private final StoragePoolDao _poolDao;
+    @Inject OCFS2Manager _ocfs2Mgr;
+
     public StoragePoolMonitor(StorageManagerImpl mgr, StoragePoolDao poolDao) {
-    	this._storageManager = mgr;
-    	this._poolDao = poolDao;
-    	
-    	ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
-    	this._ocfs2Mgr = locator.getManager(OCFS2Manager.class);
+        this._storageManager = mgr;
+        this._poolDao = poolDao;
+
     }
-    
-    
+
+
     @Override
     public boolean isRecurring() {
         return false;
     }
-    
+
     @Override
     public synchronized boolean processAnswers(long agentId, long seq, Answer[] resp) {
         return true;
     }
-    
+
     @Override
     public synchronized boolean processDisconnect(long agentId, Status state) {
         return true;
     }
-    
+
     @Override
     public void processConnect(HostVO host, StartupCommand cmd, boolean forRebalance) throws
ConnectionException {
-    	if (cmd instanceof StartupRoutingCommand) {
-    		StartupRoutingCommand scCmd = (StartupRoutingCommand)cmd;
-    		if (scCmd.getHypervisorType() == HypervisorType.XenServer || scCmd.getHypervisorType()
==  HypervisorType.KVM ||
-				scCmd.getHypervisorType() == HypervisorType.VMware || scCmd.getHypervisorType() ==  HypervisorType.Simulator
|| scCmd.getHypervisorType() == HypervisorType.Ovm) {
-    			List<StoragePoolVO> pools = _poolDao.listBy(host.getDataCenterId(), host.getPodId(),
host.getClusterId());
-    			for (StoragePoolVO pool : pools) {
-    			    if (pool.getStatus() != StoragePoolStatus.Up) {
-    			        continue;
-    			    }
-    			    if (!pool.getPoolType().isShared()) {
-    			        continue;
-    			    }
-    			    
-    			    if (pool.getPoolType() == StoragePoolType.OCFS2 && !_ocfs2Mgr.prepareNodes(pool.getClusterId()))
{
-    			        throw new ConnectionException(true, "Unable to prepare OCFS2 nodes for pool
" + pool.getId());
-    			    }
-    			    
-    				Long hostId = host.getId();
-    				s_logger.debug("Host " + hostId + " connected, sending down storage pool information
...");
-    				try {
-    				    _storageManager.connectHostToSharedPool(hostId, pool);
-    					_storageManager.createCapacityEntry(pool);
-    				} catch (Exception e) {
-    				    s_logger.warn("Unable to connect host " + hostId + " to pool " + pool + " due
to " + e.toString(), e);
-    				}
-    			}
-    		}
-    	}
+        if (cmd instanceof StartupRoutingCommand) {
+            StartupRoutingCommand scCmd = (StartupRoutingCommand)cmd;
+            if (scCmd.getHypervisorType() == HypervisorType.XenServer || scCmd.getHypervisorType()
==  HypervisorType.KVM ||
+                    scCmd.getHypervisorType() == HypervisorType.VMware || scCmd.getHypervisorType()
==  HypervisorType.Simulator || scCmd.getHypervisorType() == HypervisorType.Ovm) {
+                List<StoragePoolVO> pools = _poolDao.listBy(host.getDataCenterId(),
host.getPodId(), host.getClusterId());
+                for (StoragePoolVO pool : pools) {
+                    if (pool.getStatus() != StoragePoolStatus.Up) {
+                        continue;
+                    }
+                    if (!pool.getPoolType().isShared()) {
+                        continue;
+                    }
+
+                    if (pool.getPoolType() == StoragePoolType.OCFS2 && !_ocfs2Mgr.prepareNodes(pool.getClusterId()))
{
+                        throw new ConnectionException(true, "Unable to prepare OCFS2 nodes
for pool " + pool.getId());
+                    }
+
+                    Long hostId = host.getId();
+                    s_logger.debug("Host " + hostId + " connected, sending down storage pool
information ...");
+                    try {
+                        _storageManager.connectHostToSharedPool(hostId, pool);
+                        _storageManager.createCapacityEntry(pool);
+                    } catch (Exception e) {
+                        s_logger.warn("Unable to connect host " + hostId + " to pool " +
pool + " due to " + e.toString(), e);
+                    }
+                }
+            }
+        }
     }
-    
+
 
     @Override
     public boolean processCommands(long agentId, long seq, Command[] req) {
         return false;
     }
-   
+
     @Override
     public AgentControlAnswer processControlCommand(long agentId, AgentControlCommand cmd)
{
-    	return null;
+        return null;
     }
-    
+
     @Override
     public boolean processTimeout(long agentId, long seq) {
-    	return true;
+        return true;
     }
-    
+
     @Override
     public int getTimeout() {
-    	return -1;
+        return -1;
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/server/src/com/cloud/storage/resource/DummySecondaryStorageResource.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/resource/DummySecondaryStorageResource.java b/server/src/com/cloud/storage/resource/DummySecondaryStorageResource.java
index 23f3def..2773e29 100644
--- a/server/src/com/cloud/storage/resource/DummySecondaryStorageResource.java
+++ b/server/src/com/cloud/storage/resource/DummySecondaryStorageResource.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
 import org.apache.log4j.Logger;
@@ -50,42 +51,42 @@ import com.cloud.storage.VMTemplateVO;
 import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.storage.template.TemplateConstants;
 import com.cloud.storage.template.TemplateInfo;
-import com.cloud.utils.component.ComponentLocator;
+
 
 public class DummySecondaryStorageResource extends ServerResourceBase implements ServerResource
{
     private static final Logger s_logger = Logger.getLogger(DummySecondaryStorageResource.class);
-    
+
     String _dc;
     String _pod;
     String _guid;
     String _dummyPath;
-    VMTemplateDao _tmpltDao;
-	private boolean _useServiceVm;
-	
-    
-	public DummySecondaryStorageResource(boolean useServiceVM) {
-		setUseServiceVm(useServiceVM);
-	}
-
-	@Override
-	protected String getDefaultScriptsDir() {
-		return "dummy";
-	}
-
-	@Override
-	public Answer executeRequest(Command cmd) {
+    @Inject VMTemplateDao _tmpltDao;
+    private boolean _useServiceVm;
+
+
+    public DummySecondaryStorageResource(boolean useServiceVM) {
+        setUseServiceVm(useServiceVM);
+    }
+
+    @Override
+    protected String getDefaultScriptsDir() {
+        return "dummy";
+    }
+
+    @Override
+    public Answer executeRequest(Command cmd) {
         if (cmd instanceof DownloadProgressCommand) {
             return new DownloadAnswer(null, 100, cmd,
-            		com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOADED,
-            		"dummyFS",
-            		"/dummy");
+                    com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOADED,
+                    "dummyFS",
+                    "/dummy");
         } else if (cmd instanceof DownloadCommand) {
             return new DownloadAnswer(null, 100, cmd,
-            		com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOADED,
-            		"dummyFS",
-            		"/dummy");
+                    com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOADED,
+                    "dummyFS",
+                    "/dummy");
         } else if (cmd instanceof GetStorageStatsCommand) {
-        	return execute((GetStorageStatsCommand)cmd);
+            return execute((GetStorageStatsCommand)cmd);
         } else if (cmd instanceof CheckHealthCommand) {
             return new CheckHealthAnswer((CheckHealthCommand)cmd, true);
         } else if (cmd instanceof ReadyCommand) {
@@ -93,33 +94,33 @@ public class DummySecondaryStorageResource extends ServerResourceBase
implements
         } else {
             return Answer.createUnsupportedCommandAnswer(cmd);
         }
-	}
+    }
 
-	@Override
-	public PingCommand getCurrentStatus(long id) {
+    @Override
+    public PingCommand getCurrentStatus(long id) {
         return new PingStorageCommand(Host.Type.Storage, id, new HashMap<String, Boolean>());
-	}
+    }
 
-	@Override
-	public Type getType() {
+    @Override
+    public Type getType() {
         return Host.Type.SecondaryStorage;
-	}
+    }
 
-	@Override
-	public StartupCommand[] initialize() {
+    @Override
+    public StartupCommand[] initialize() {
         final StartupStorageCommand cmd = new StartupStorageCommand("dummy",
-        	StoragePoolType.NetworkFilesystem, 1024*1024*1024*100L,
-        	new HashMap<String, TemplateInfo>());
-        
+                StoragePoolType.NetworkFilesystem, 1024*1024*1024*100L,
+                new HashMap<String, TemplateInfo>());
+
         cmd.setResourceType(Storage.StorageResourceType.SECONDARY_STORAGE);
         cmd.setIqn(null);
         cmd.setNfsShare(_guid);
-        
+
         fillNetworkInformation(cmd);
         cmd.setDataCenter(_dc);
         cmd.setPod(_pod);
         cmd.setGuid(_guid);
-        
+
         cmd.setName(_guid);
         cmd.setVersion(DummySecondaryStorageResource.class.getPackage().getImplementationVersion());
         /* gather TemplateInfo in second storage */
@@ -127,62 +128,57 @@ public class DummySecondaryStorageResource extends ServerResourceBase
implements
         cmd.getHostDetails().put("mount.parent", "dummy");
         cmd.getHostDetails().put("mount.path", "dummy");
         cmd.getHostDetails().put("orig.url", _guid);
-        
+
         String tok[] = _dummyPath.split(":");
         cmd.setPrivateIpAddress(tok[0]);
         return new StartupCommand [] {cmd};
-	}
-	
+    }
+
     protected GetStorageStatsAnswer execute(GetStorageStatsCommand cmd) {
         long size = 1024*1024*1024*100L;
         return new GetStorageStatsAnswer(cmd, 0, size);
     }
-    
+
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException
{
         super.configure(name, params);
-        
+
         _guid = (String)params.get("guid");
         if (_guid == null) {
             throw new ConfigurationException("Unable to find the guid");
         }
-        
+
         _dc = (String)params.get("zone");
         if (_dc == null) {
             throw new ConfigurationException("Unable to find the zone");
         }
         _pod = (String)params.get("pod");
-        
+
         _dummyPath = (String)params.get("mount.path");
         if (_dummyPath == null) {
             throw new ConfigurationException("Unable to find mount.path");
         }
-        
-    	ComponentLocator locator = ComponentLocator.getLocator("management-server");
-    	_tmpltDao = locator.getDao(VMTemplateDao.class);
-    	if (_tmpltDao == null) {
-    		throw new ConfigurationException("Unable to find VMTemplate dao");
-    	}
+
         return true;
     }
 
-	public void setUseServiceVm(boolean _useServiceVm) {
-		this._useServiceVm = _useServiceVm;
-	}
-
-	public boolean useServiceVm() {
-		return _useServiceVm;
-	}
-	
-	 public Map<String, TemplateInfo> getDefaultSystemVmTemplateInfo() {	        
-	        List<VMTemplateVO> tmplts = _tmpltDao.listAllSystemVMTemplates();
-	        Map<String, TemplateInfo> tmpltInfo = new HashMap<String, TemplateInfo>();
-	        if (tmplts != null) {
-	        	for (VMTemplateVO tmplt : tmplts) {
-	        		TemplateInfo routingInfo = new TemplateInfo(tmplt.getUniqueName(), TemplateConstants.DEFAULT_SYSTEM_VM_TEMPLATE_PATH
+ tmplt.getId() + File.separator, false, false);
-	        		tmpltInfo.put(tmplt.getUniqueName(), routingInfo);
-	        	}
-	        }
-	        return tmpltInfo;
-	    }
+    public void setUseServiceVm(boolean _useServiceVm) {
+        this._useServiceVm = _useServiceVm;
+    }
+
+    public boolean useServiceVm() {
+        return _useServiceVm;
+    }
+
+    public Map<String, TemplateInfo> getDefaultSystemVmTemplateInfo() {	        
+        List<VMTemplateVO> tmplts = _tmpltDao.listAllSystemVMTemplates();
+        Map<String, TemplateInfo> tmpltInfo = new HashMap<String, TemplateInfo>();
+        if (tmplts != null) {
+            for (VMTemplateVO tmplt : tmplts) {
+                TemplateInfo routingInfo = new TemplateInfo(tmplt.getUniqueName(), TemplateConstants.DEFAULT_SYSTEM_VM_TEMPLATE_PATH
+ tmplt.getId() + File.separator, false, false);
+                tmpltInfo.put(tmplt.getUniqueName(), routingInfo);
+            }
+        }
+        return tmpltInfo;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/server/src/com/cloud/storage/s3/S3ManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/s3/S3ManagerImpl.java b/server/src/com/cloud/storage/s3/S3ManagerImpl.java
index 069edf3..16e2ad9 100644
--- a/server/src/com/cloud/storage/s3/S3ManagerImpl.java
+++ b/server/src/com/cloud/storage/s3/S3ManagerImpl.java
@@ -41,11 +41,15 @@ import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.Callable;
 
+import javax.annotation.PostConstruct;
 import javax.ejb.Local;
+import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
 import org.apache.cloudstack.api.command.admin.storage.AddS3Cmd;
+import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd;
 import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
@@ -53,9 +57,6 @@ import com.cloud.agent.api.DeleteTemplateFromS3Command;
 import com.cloud.agent.api.DownloadTemplateFromS3ToSecondaryStorageCommand;
 import com.cloud.agent.api.UploadTemplateToS3FromSecondaryStorageCommand;
 import com.cloud.agent.api.to.S3TO;
-import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd;
-import org.springframework.stereotype.Component;
-
 import com.cloud.configuration.Config;
 import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.dc.DataCenterVO;
@@ -77,7 +78,6 @@ import com.cloud.storage.dao.VMTemplateS3Dao;
 import com.cloud.storage.dao.VMTemplateZoneDao;
 import com.cloud.storage.secondary.SecondaryStorageVmManager;
 import com.cloud.utils.S3Utils.ClientOptions;
-import com.cloud.utils.component.Inject;
 import com.cloud.utils.db.Filter;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.exception.CloudRuntimeException;
@@ -90,7 +90,7 @@ public class S3ManagerImpl implements S3Manager {
 
     private String name;
 
-    @Inject
+    @Inject 
     private AgentManager agentManager;
 
     @Inject
@@ -120,10 +120,9 @@ public class S3ManagerImpl implements S3Manager {
     @Inject
     private SecondaryStorageVmManager secondaryStorageVMManager;
 
-    protected S3ManagerImpl() {
-        super();
+    public S3ManagerImpl() {
     }
-
+    
     private void verifyConnection(final S3TO s3) throws DiscoveryException {
 
         if (!canConnect(s3)) {
@@ -288,32 +287,32 @@ public class S3ManagerImpl implements S3Manager {
             executeWithNoWaitLock(determineLockId(accountId, templateId),
                     new Callable<Void>() {
 
-                        @Override
-                        public Void call() throws Exception {
-
-                            final Answer answer = agentManager.sendToSSVM(null,
-                                    new DeleteTemplateFromS3Command(s3,
-                                            accountId, templateId));
-                            if (answer == null || !answer.getResult()) {
-                                final String errorMessage = format(
-                                        "Delete Template Failed: Unable to delete template
id %1$s from S3 due to following error: %2$s",
-                                        templateId,
-                                        ((answer == null) ? "answer is null"
-                                                : answer.getDetails()));
-                                LOGGER.error(errorMessage);
-                                throw new CloudRuntimeException(errorMessage);
-                            }
-
-                            vmTemplateS3Dao.remove(vmTemplateS3VO.getId());
-                            LOGGER.debug(format(
-                                    "Deleted template %1$s from S3.",
-                                    templateId));
+                @Override
+                public Void call() throws Exception {
+
+                    final Answer answer = agentManager.sendToSSVM(null,
+                            new DeleteTemplateFromS3Command(s3,
+                                    accountId, templateId));
+                    if (answer == null || !answer.getResult()) {
+                        final String errorMessage = format(
+                                "Delete Template Failed: Unable to delete template id %1$s
from S3 due to following error: %2$s",
+                                templateId,
+                                ((answer == null) ? "answer is null"
+                                        : answer.getDetails()));
+                        LOGGER.error(errorMessage);
+                        throw new CloudRuntimeException(errorMessage);
+                    }
+
+                    vmTemplateS3Dao.remove(vmTemplateS3VO.getId());
+                    LOGGER.debug(format(
+                            "Deleted template %1$s from S3.",
+                            templateId));
 
-                            return null;
+                    return null;
 
-                        }
+                }
 
-                    });
+            });
 
         } catch (Exception e) {
 
@@ -384,38 +383,38 @@ public class S3ManagerImpl implements S3Manager {
             executeWithNoWaitLock(determineLockId(accountId, templateId),
                     new Callable<Void>() {
 
-                        @Override
-                        public Void call() throws Exception {
-
-                            final Answer answer = agentManager.sendToSSVM(
-                                    dataCenterId, cmd);
+                @Override
+                public Void call() throws Exception {
 
-                            if (answer == null || !answer.getResult()) {
-                                final String errMsg = String
-                                        .format("Failed to download template from S3 to secondary
storage due to %1$s",
-                                                (answer == null ? "answer is null"
-                                                        : answer.getDetails()));
-                                LOGGER.error(errMsg);
-                                throw new CloudRuntimeException(errMsg);
-                            }
+                    final Answer answer = agentManager.sendToSSVM(
+                            dataCenterId, cmd);
 
-                            final String installPath = join(
-                                    asList("template", "tmpl", accountId,
-                                            templateId), File.separator);
-                            final VMTemplateHostVO tmpltHost = new VMTemplateHostVO(
-                                    secondaryStorageHost.getId(), templateId,
-                                    now(), 100, Status.DOWNLOADED, null, null,
-                                    null, installPath, template.getUrl());
-                            tmpltHost.setSize(templateS3VO.getSize());
-                            tmpltHost.setPhysicalSize(templateS3VO
-                                    .getPhysicalSize());
-                            vmTemplateHostDao.persist(tmpltHost);
-
-                            return null;
+                    if (answer == null || !answer.getResult()) {
+                        final String errMsg = String
+                                .format("Failed to download template from S3 to secondary
storage due to %1$s",
+                                        (answer == null ? "answer is null"
+                                                : answer.getDetails()));
+                        LOGGER.error(errMsg);
+                        throw new CloudRuntimeException(errMsg);
+                    }
+
+                    final String installPath = join(
+                            asList("template", "tmpl", accountId,
+                                    templateId), File.separator);
+                    final VMTemplateHostVO tmpltHost = new VMTemplateHostVO(
+                            secondaryStorageHost.getId(), templateId,
+                            now(), 100, Status.DOWNLOADED, null, null,
+                            null, installPath, template.getUrl());
+                    tmpltHost.setSize(templateS3VO.getSize());
+                    tmpltHost.setPhysicalSize(templateS3VO
+                            .getPhysicalSize());
+                    vmTemplateHostDao.persist(tmpltHost);
+
+                    return null;
 
-                        }
+                }
 
-                    });
+            });
 
         } catch (Exception e) {
             final String errMsg = "Failed to download template from S3 to secondary storage
due to "
@@ -608,50 +607,50 @@ public class S3ManagerImpl implements S3Manager {
             executeWithNoWaitLock(determineLockId(accountId, templateId),
                     new Callable<Void>() {
 
-                        @Override
-                        public Void call() throws Exception {
+                @Override
+                public Void call() throws Exception {
 
-                            final UploadTemplateToS3FromSecondaryStorageCommand cmd = new
UploadTemplateToS3FromSecondaryStorageCommand(
-                                    s3, secondaryHost.getStorageUrl(),
-                                    dataCenterId, accountId, templateId);
+                    final UploadTemplateToS3FromSecondaryStorageCommand cmd = new UploadTemplateToS3FromSecondaryStorageCommand(
+                            s3, secondaryHost.getStorageUrl(),
+                            dataCenterId, accountId, templateId);
 
-                            final Answer answer = agentManager.sendToSSVM(
-                                    dataCenterId, cmd);
-                            if (answer == null || !answer.getResult()) {
+                    final Answer answer = agentManager.sendToSSVM(
+                            dataCenterId, cmd);
+                    if (answer == null || !answer.getResult()) {
 
-                                final String reason = answer != null ? answer
-                                        .getDetails()
-                                        : "S3 template sync failed due to an unspecified
error.";
+                        final String reason = answer != null ? answer
+                                .getDetails()
+                                : "S3 template sync failed due to an unspecified error.";
                                 throw new CloudRuntimeException(
                                         format("Failed to upload template id %1$s to S3 from
secondary storage due to %2$s.",
                                                 templateId, reason));
 
-                            }
+                    }
 
-                            if (LOGGER.isDebugEnabled()) {
-                                LOGGER.debug(format(
-                                        "Creating VMTemplateS3VO instance using template
id %1s.",
-                                        templateId));
-                            }
+                    if (LOGGER.isDebugEnabled()) {
+                        LOGGER.debug(format(
+                                "Creating VMTemplateS3VO instance using template id %1s.",
+                                templateId));
+                    }
 
-                            final VMTemplateS3VO vmTemplateS3VO = new VMTemplateS3VO(
-                                    s3.getId(), templateId, now(),
-                                    templateHostRef.getSize(), templateHostRef
-                                            .getPhysicalSize());
+                    final VMTemplateS3VO vmTemplateS3VO = new VMTemplateS3VO(
+                            s3.getId(), templateId, now(),
+                            templateHostRef.getSize(), templateHostRef
+                            .getPhysicalSize());
 
-                            if (LOGGER.isDebugEnabled()) {
-                                LOGGER.debug(format("Persisting %1$s",
-                                        vmTemplateS3VO));
-                            }
+                    if (LOGGER.isDebugEnabled()) {
+                        LOGGER.debug(format("Persisting %1$s",
+                                vmTemplateS3VO));
+                    }
 
-                            vmTemplateS3Dao.persist(vmTemplateS3VO);
-                            propagateTemplateToAllZones(vmTemplateS3VO);
+                    vmTemplateS3Dao.persist(vmTemplateS3VO);
+                    propagateTemplateToAllZones(vmTemplateS3VO);
 
-                            return null;
+                    return null;
 
-                        }
+                }
 
-                    });
+            });
 
         } catch (Exception e) {
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/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 fb4ece5..6bf6d5e 100755
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -114,7 +114,7 @@ import com.cloud.utils.DateUtil.IntervalType;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.Ternary;
-import com.cloud.utils.component.ComponentLocator;
+
 import com.cloud.utils.component.Manager;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.Filter;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
index 190b054..18dc1f9 100644
--- a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
@@ -55,7 +55,7 @@ import com.cloud.user.User;
 import com.cloud.utils.DateUtil;
 import com.cloud.utils.DateUtil.IntervalType;
 import com.cloud.utils.NumbersUtil;
-import com.cloud.utils.component.ComponentLocator;
+
 import com.cloud.utils.concurrency.TestClock;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.GlobalLock;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/110465b5/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 0e91472..1ce9578 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -130,8 +130,8 @@ import com.cloud.user.dao.UserAccountDao;
 import com.cloud.user.dao.UserDao;
 import com.cloud.uservm.UserVm;
 import com.cloud.utils.NumbersUtil;
-import com.cloud.utils.component.Adapters;
-import com.cloud.utils.component.ComponentLocator;
+import com.cloud.utils.component.AdapterBase;
+
 import com.cloud.utils.component.Manager;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
@@ -216,10 +216,10 @@ public class TemplateManagerImpl implements TemplateManager, Manager,
TemplateSe
     private TemplateAdapter getAdapter(HypervisorType type) {
     	TemplateAdapter adapter = null;
     	if (type == HypervisorType.BareMetal) {
-    		adapter = Adapters.getAdapterByName(_adapters, TemplateAdapterType.BareMetal.getName());
+    		adapter = AdapterBase.getAdapterByName(_adapters, TemplateAdapterType.BareMetal.getName());
     	} else {
     		// see HyervisorTemplateAdapter
-    		adapter =  Adapters.getAdapterByName(_adapters, TemplateAdapterType.Hypervisor.getName());
+    		adapter =  AdapterBase.getAdapterByName(_adapters, TemplateAdapterType.Hypervisor.getName());
     	}
     	
     	if (adapter == null) {
@@ -1098,7 +1098,7 @@ public class TemplateManagerImpl implements TemplateManager, Manager,
TemplateSe
             s_logger.info("S3 secondary storage synchronization is disabled.");
         }
 
-        return false;
+        return true;
     }
     
     protected TemplateManagerImpl() {


Mime
View raw message