cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject git commit: updated refs/heads/object_store to f16f92d
Date Wed, 24 Apr 2013 22:06:58 GMT
Updated Branches:
  refs/heads/object_store 8d29cdf80 -> f16f92dd1


Remove TemplateManager.getSecondaryStorageHost api.

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

Branch: refs/heads/object_store
Commit: f16f92dd1d21c62ea8cfa8f1215ef44808493fd9
Parents: 8d29cdf
Author: Min Chen <min.chen@citrix.com>
Authored: Wed Apr 24 15:06:36 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Wed Apr 24 15:06:36 2013 -0700

----------------------------------------------------------------------
 .../src/com/cloud/server/ManagementServerImpl.java |    9 +-
 .../storage/snapshot/SnapshotManagerImpl.java      |    9 +-
 .../com/cloud/storage/upload/UploadListener.java   |   17 +++-
 .../com/cloud/storage/upload/UploadMonitor.java    |    3 +-
 .../cloud/storage/upload/UploadMonitorImpl.java    |   72 +++++++--------
 server/src/com/cloud/template/TemplateManager.java |    4 -
 .../com/cloud/template/TemplateManagerImpl.java    |   29 ------
 7 files changed, 58 insertions(+), 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f16f92dd/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 c2871d9..92d8c7b 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -313,6 +313,7 @@ import org.apache.cloudstack.api.command.user.vpc.*;
 import org.apache.cloudstack.api.command.user.vpn.*;
 import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
 import org.apache.cloudstack.api.response.ExtractResponse;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
@@ -2673,8 +2674,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
 
         long accountId = volume.getAccountId();
         StoragePool srcPool = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(volume.getPoolId());
-        HostVO sserver = this.templateMgr.getSecondaryStorageHost(zoneId);
-        String secondaryStorageURL = sserver.getStorageUrl();
+        DataStore secStore = this.dataStoreMgr.getImageStore(zoneId);
+        String secondaryStorageURL = secStore.getUri();
 
         List<UploadVO> extractURLList = _uploadDao.listByTypeUploadStatus(volumeId,
Upload.Type.VOLUME, UploadVO.Status.DOWNLOAD_URL_CREATED);
 
@@ -2682,7 +2683,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
             return extractURLList.get(0).getId(); // If download url already
             // exists then return
         } else {
-            UploadVO uploadJob = _uploadMonitor.createNewUploadEntry(sserver.getId(), volumeId,
UploadVO.Status.COPY_IN_PROGRESS, Upload.Type.VOLUME,
+            UploadVO uploadJob = _uploadMonitor.createNewUploadEntry(secStore.getId(), volumeId,
UploadVO.Status.COPY_IN_PROGRESS, Upload.Type.VOLUME,
                     url, extractMode);
             s_logger.debug("Extract Mode - " + uploadJob.getMode());
             uploadJob = _uploadDao.createForUpdate(uploadJob.getId());
@@ -2740,7 +2741,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
             if (extractMode == Mode.FTP_UPLOAD) { // Now that the volume is
                 // copied perform the actual
                 // uploading
-                _uploadMonitor.extractVolume(uploadJob, sserver, volume, url, zoneId, volumeLocalPath,
cmd.getStartEventId(), job.getId(), _asyncMgr);
+                _uploadMonitor.extractVolume(uploadJob, secStore, volume, url, zoneId, volumeLocalPath,
cmd.getStartEventId(), job.getId(), _asyncMgr);
                 return uploadJob.getId();
             } else { // Volume is copied now make it visible under apache and
                 // create a URL.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f16f92dd/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 a7842fa..624d1d5 100755
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -358,8 +358,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
         VolumeVO volume = _volsDao.findById(volumeId);
         Long dcId = volume.getDataCenterId();
         Long accountId = volume.getAccountId();
-        HostVO secHost = this.templateMgr.getSecondaryStorageHost(dcId);
-        String secondaryStoragePoolUrl = secHost.getStorageUrl();
+        DataStore secStore = this.dataStoreMgr.getImageStore(dcId);
 
         Long swiftId = ss.getSwiftId();
         SwiftTO swift = _swiftMgr.getSwiftTO(swiftId);
@@ -376,7 +375,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
         String parent = null;
         try {
             for (String backupUuid : BackupUuids) {
-                downloadSnapshotFromSwiftCommand cmd = new downloadSnapshotFromSwiftCommand(swift,
secondaryStoragePoolUrl, dcId, accountId, volumeId, parent, backupUuid, _backupsnapshotwait);
+                downloadSnapshotFromSwiftCommand cmd = new downloadSnapshotFromSwiftCommand(swift,
secStore.getUri(), dcId, accountId, volumeId, parent, backupUuid, _backupsnapshotwait);
                 Answer answer = _agentMgr.sendToSSVM(dcId, cmd);
                 if ((answer == null) || !answer.getResult()) {
                     throw new CloudRuntimeException("downloadSnapshotsFromSwift failed ");
@@ -409,7 +408,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
 
         final VolumeVO volume = _volsDao.findById(snapshot.getVolumeId());
         final Long zoneId = volume.getDataCenterId();
-        final HostVO secHost = this.templateMgr.getSecondaryStorageHost(zoneId);
+        final DataStore secStore = this.dataStoreMgr.getImageStore(zoneId);
 
         final S3TO s3 = _s3Mgr.getS3TO(snapshot.getS3Id());
         final List<String> backupUuids = determineBackupUuids(snapshot);
@@ -418,7 +417,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
             String parent = null;
             for (final String backupUuid : backupUuids) {
                 final DownloadSnapshotFromS3Command cmd = new DownloadSnapshotFromS3Command(
-                        s3, parent, secHost.getStorageUrl(), zoneId,
+                        s3, parent, secStore.getUri(), zoneId,
                         volume.getAccountId(), volume.getId(), backupUuid,
                         _backupsnapshotwait);
                 final Answer answer = _agentMgr.sendToSSVM(zoneId, cmd);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f16f92dd/server/src/com/cloud/storage/upload/UploadListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/upload/UploadListener.java b/server/src/com/cloud/storage/upload/UploadListener.java
index 891610f..8d9cbb6 100755
--- a/server/src/com/cloud/storage/upload/UploadListener.java
+++ b/server/src/com/cloud/storage/upload/UploadListener.java
@@ -24,6 +24,8 @@ import java.util.Map;
 import java.util.Timer;
 import java.util.TimerTask;
 
+import javax.inject.Inject;
+
 import org.apache.cloudstack.api.command.user.iso.ExtractIsoCmd;
 import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd;
 import org.apache.log4j.Level;
@@ -42,6 +44,9 @@ import com.cloud.agent.api.storage.UploadProgressCommand;
 import com.cloud.agent.api.storage.UploadProgressCommand.RequestType;
 import org.apache.cloudstack.api.command.user.template.ExtractTemplateCmd;
 import org.apache.cloudstack.api.response.ExtractResponse;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
 
 import com.cloud.api.ApiDBUtils;
 import com.cloud.async.AsyncJobManager;
@@ -109,7 +114,7 @@ public class UploadListener implements Listener {
 	}
 
 
-	private HostVO sserver;
+	private DataStore sserver;
 
 	private boolean uploadActive = true;
 
@@ -134,6 +139,7 @@ public class UploadListener implements Listener {
 	private long eventId;
 	private AsyncJobManager asyncMgr;
 	private ExtractResponse resultObj;
+	@Inject EndPointSelector _epSelector;
 
 	public AsyncJobManager getAsyncMgr() {
 		return asyncMgr;
@@ -162,7 +168,7 @@ public class UploadListener implements Listener {
 	private final Map<String,  UploadState> stateMap = new HashMap<String, UploadState>();
 	private Long uploadId;
 
-	public UploadListener(HostVO host, Timer _timer, UploadDao uploadDao,
+	public UploadListener(DataStore host, Timer _timer, UploadDao uploadDao,
 			UploadVO uploadObj, UploadMonitorImpl uploadMonitor, UploadCommand cmd,
 			Long accountId, String typeName, Type type, long eventId, long asyncJobId, AsyncJobManager
asyncMgr) {
 		this.sserver = host;
@@ -272,7 +278,7 @@ public class UploadListener implements Listener {
 
 	public void setUploadInactive(Status reason) {
 		uploadActive=false;
-		uploadMonitor.handleUploadEvent(sserver, accountId, typeName, type, uploadId, reason, eventId);
+		uploadMonitor.handleUploadEvent(accountId, typeName, type, uploadId, reason, eventId);
 	}
 
 	public void logUploadStart() {
@@ -430,8 +436,9 @@ public class UploadListener implements Listener {
 				log("Sending progress command ", Level.TRACE);
 			}
 			try {
-	            uploadMonitor.send(sserver.getId(), new UploadProgressCommand(getCommand(),
getJobId(), reqType), this);
-            } catch (AgentUnavailableException e) {
+			    EndPoint ep = _epSelector.select(sserver);
+			    ep.sendMessageAsyncWithListener(new UploadProgressCommand(getCommand(), getJobId(),
reqType), this);
+            } catch (Exception e) {
             	s_logger.debug("Send command failed", e);
 				setDisconnected();
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f16f92dd/server/src/com/cloud/storage/upload/UploadMonitor.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/upload/UploadMonitor.java b/server/src/com/cloud/storage/upload/UploadMonitor.java
index dd50d1a..4e41048 100755
--- a/server/src/com/cloud/storage/upload/UploadMonitor.java
+++ b/server/src/com/cloud/storage/upload/UploadMonitor.java
@@ -17,6 +17,7 @@
 package com.cloud.storage.upload;
 
 
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
 import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
 
 import com.cloud.async.AsyncJobManager;
@@ -48,7 +49,7 @@ public interface UploadMonitor extends Manager{
     UploadVO createNewUploadEntry(Long hostId, Long typeId, Status uploadState,
             Type type, String errorString, Mode extractMode);
 
-    void extractVolume(UploadVO uploadVolumeObj, HostVO sserver, VolumeVO volume, String
url,
+    void extractVolume(UploadVO uploadVolumeObj, DataStore secStore, VolumeVO volume, String
url,
             Long dataCenterId, String installPath, long eventId,
             long asyncJobId, AsyncJobManager asyncMgr);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f16f92dd/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
index 3f07cba..0d0883e 100755
--- a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
+++ b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
@@ -156,20 +156,21 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor
{
 	}
 
 	@Override
-	public void extractVolume(UploadVO uploadVolumeObj, HostVO sserver, VolumeVO volume, String
url, Long dataCenterId, String installPath, long eventId, long asyncJobId, AsyncJobManager
asyncMgr){
+	public void extractVolume(UploadVO uploadVolumeObj, DataStore secStore, VolumeVO volume,
String url, Long dataCenterId, String installPath, long eventId, long asyncJobId, AsyncJobManager
asyncMgr){
 
 		uploadVolumeObj.setUploadState(Upload.Status.NOT_UPLOADED);
 		_uploadDao.update(uploadVolumeObj.getId(), uploadVolumeObj);
 
 	    start();
 		UploadCommand ucmd = new UploadCommand(url, volume.getId(), volume.getSize(), installPath,
Type.VOLUME);
-		UploadListener ul = new UploadListener(sserver, _timer, _uploadDao, uploadVolumeObj, this,
ucmd, volume.getAccountId(), volume.getName(), Type.VOLUME, eventId, asyncJobId, asyncMgr);
+		UploadListener ul = new UploadListener(secStore, _timer, _uploadDao, uploadVolumeObj, this,
ucmd, volume.getAccountId(), volume.getName(), Type.VOLUME, eventId, asyncJobId, asyncMgr);
 		_listenerMap.put(uploadVolumeObj, ul);
 
 		try {
-	        send(sserver.getId(), ucmd, ul);
-        } catch (AgentUnavailableException e) {
-			s_logger.warn("Unable to start upload of volume " + volume.getName() + " from " + sserver.getName()
+ " to " +url, e);
+		    EndPoint ep = _epSelector.select(secStore);
+		    ep.sendMessageAsyncWithListener(ucmd, ul);
+        } catch (Exception e) {
+			s_logger.warn("Unable to start upload of volume " + volume.getName() + " from " + secStore.getName()
+ " to " +url, e);
 			ul.setDisconnected();
 			ul.scheduleStatusCheck(RequestType.GET_OR_RESTART);
         }
@@ -181,23 +182,22 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor
{
 
 		Type type = (template.getFormat() == ImageFormat.ISO) ? Type.ISO : Type.TEMPLATE ;
 
-		List<HostVO> storageServers = _resourceMgr.listAllHostsInOneZoneByType(Host.Type.SecondaryStorage,
dataCenterId);
-		HostVO sserver = storageServers.get(0);
+		DataStore secStore = this.storeMgr.getImageStore(dataCenterId);
 
-		UploadVO uploadTemplateObj = new UploadVO(sserver.getId(), template.getId(), new Date(),
+		UploadVO uploadTemplateObj = new UploadVO(secStore.getId(), template.getId(), new Date(),
 													Upload.Status.NOT_UPLOADED, type, url, Mode.FTP_UPLOAD);
 		_uploadDao.persist(uploadTemplateObj);
 
 		if(vmTemplateHost != null) {
 		    start();
 			UploadCommand ucmd = new UploadCommand(template, url, vmTemplateHost.getInstallPath(),
vmTemplateHost.getSize());
-			UploadListener ul = new UploadListener(sserver, _timer, _uploadDao, uploadTemplateObj,
this, ucmd, template.getAccountId(), template.getName(), type, eventId, asyncJobId, asyncMgr);
+			UploadListener ul = new UploadListener(secStore, _timer, _uploadDao, uploadTemplateObj,
this, ucmd, template.getAccountId(), template.getName(), type, eventId, asyncJobId, asyncMgr);
 			_listenerMap.put(uploadTemplateObj, ul);
-
-			try {
-	            send(sserver.getId(), ucmd, ul);
-            } catch (AgentUnavailableException e) {
-				s_logger.warn("Unable to start upload of " + template.getUniqueName() + " from " + sserver.getName()
+ " to " +url, e);
+			try{
+			    EndPoint ep = _epSelector.select(secStore);
+			    ep.sendMessageAsyncWithListener(ucmd, ul);
+            } catch (Exception e) {
+				s_logger.warn("Unable to start upload of " + template.getUniqueName() + " from " + secStore.getName()
+ " to " +url, e);
 				ul.setDisconnected();
 				ul.scheduleStatusCheck(RequestType.GET_OR_RESTART);
             }
@@ -282,19 +282,18 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor
{
 
             // Create Symlink at ssvm
             String uuid = UUID.randomUUID().toString() + path.substring(path.length() - 4)
; // last 4 characters of the path specify the format like .vhd
-            HostVO secStorage = ApiDBUtils.findHostById(ApiDBUtils.findUploadById(uploadId).getHostId());
-            HostVO ssvm = _ssvmMgr.pickSsvmHost(secStorage);
-            if( ssvm == null ) {
-            	errorString = "There is no secondary storage VM for secondary storage host "
+ secStorage.getName();
+            DataStore secStore = this.storeMgr.getDataStore(ApiDBUtils.findUploadById(uploadId).getHostId(),
DataStoreRole.Image);
+            EndPoint ep = _epSelector.select(secStore);
+            if( ep == null ) {
+            	errorString = "There is no secondary storage VM for secondary storage host "
+ secStore.getName();
             	throw new CloudRuntimeException(errorString);
             }
 
-            CreateEntityDownloadURLCommand cmd = new CreateEntityDownloadURLCommand(secStorage.getParent(),
path, uuid);
-            try {
-	            send(ssvm.getId(), cmd, null);
-            } catch (AgentUnavailableException e) {
-                errorString = "Unable to create a link for " +type+ " id:"+entityId + ","
+ e.getMessage();
-                s_logger.warn(errorString, e);
+            CreateEntityDownloadURLCommand cmd = new CreateEntityDownloadURLCommand(((ImageStoreVO)secStore).getParent(),
path, uuid);
+            Answer ans = ep.sendMessage(cmd);
+            if (ans == null || !ans.getResult()) {
+                errorString = "Unable to create a link for " +type+ " id:"+entityId + ","
+ ans.getDetails();
+                s_logger.warn(errorString);
                 throw new CloudRuntimeException(errorString);
             }
 
@@ -342,9 +341,6 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor
{
 
 
 
-	public void send(Long hostId, Command cmd, Listener listener) throws AgentUnavailableException
{
-		_agentMgr.send(hostId, new Commands(cmd), listener);
-	}
 
 	@Override
 	public boolean configure(String name, Map<String, Object> params)
@@ -382,7 +378,7 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor
{
 		return true;
 	}
 
-	public void handleUploadEvent(HostVO host, Long accountId, String typeName, Type type, Long
uploadId, com.cloud.storage.Upload.Status reason, long eventId) {
+	public void handleUploadEvent(Long accountId, String typeName, Type type, Long uploadId,
com.cloud.storage.Upload.Status reason, long eventId) {
 
 		if ((reason == Upload.Status.UPLOADED) || (reason==Upload.Status.ABANDONED)){
 			UploadVO uploadObj = new UploadVO(uploadId);
@@ -463,23 +459,25 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor
{
         for (UploadVO extractJob : extractJobs){
             if( getTimeDiff(extractJob.getLastUpdated()) > EXTRACT_URL_LIFE_LIMIT_IN_SECONDS
){
                 String path = extractJob.getInstallPath();
-                HostVO secStorage = ApiDBUtils.findHostById(extractJob.getHostId());
+                DataStore secStore = this.storeMgr.getDataStore(extractJob.getHostId(), DataStoreRole.Image);
+
 
                 // Would delete the symlink for the Type and if Type == VOLUME then also
the volume
-                DeleteEntityDownloadURLCommand cmd = new DeleteEntityDownloadURLCommand(path,
extractJob.getType(),extractJob.getUploadUrl(), secStorage.getParent());
-                HostVO ssvm = _ssvmMgr.pickSsvmHost(secStorage);
-                if( ssvm == null ) {
+                DeleteEntityDownloadURLCommand cmd = new DeleteEntityDownloadURLCommand(path,
extractJob.getType(),extractJob.getUploadUrl(), ((ImageStoreVO)secStore).getParent());
+                EndPoint ep = _epSelector.select(secStore);
+                 if( ep == null ) {
                 	s_logger.warn("UploadMonitor cleanup: There is no secondary storage VM for
secondary storage host " + extractJob.getHostId());
                 	continue; //TODO: why continue? why not break?
                 }
                 if (s_logger.isDebugEnabled()) {
-                	s_logger.debug("UploadMonitor cleanup: Sending deletion of extract URL "+
extractJob.getUploadUrl() + " to ssvm " + ssvm.getId());
+                	s_logger.debug("UploadMonitor cleanup: Sending deletion of extract URL "+
extractJob.getUploadUrl() + " to ssvm " + ep.getHostAddr());
                 }
-                try {
-                    send(ssvm.getId(), cmd, null); //TODO: how do you know if it was successful?
+                Answer ans = ep.sendMessage(cmd);
+                if ( ans != null && ans.getResult()){
                     _uploadDao.remove(extractJob.getId());
-                } catch (AgentUnavailableException e) {
-                	s_logger.warn("UploadMonitor cleanup: Unable to delete the link for " +
extractJob.getType()+ " id=" + extractJob.getTypeId()+ " url="+ extractJob.getUploadUrl()
+ " on ssvm " + ssvm.getId(), e);
+                }
+                else{
+                    s_logger.warn("UploadMonitor cleanup: Unable to delete the link for "
+ extractJob.getType()+ " id=" + extractJob.getTypeId()+ " url="+ extractJob.getUploadUrl()
+ " on ssvm " + ep.getHostAddr());
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f16f92dd/server/src/com/cloud/template/TemplateManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManager.java b/server/src/com/cloud/template/TemplateManager.java
index dedb0b4..202feef 100755
--- a/server/src/com/cloud/template/TemplateManager.java
+++ b/server/src/com/cloud/template/TemplateManager.java
@@ -100,10 +100,6 @@ public interface TemplateManager extends TemplateApiService{
 
     DataStore getImageStore(long zoneId, long tmpltId);
 
-    HostVO getSecondaryStorageHost(long zoneId);
-
-    List<HostVO> getSecondaryStorageHosts(long zoneId);
-
     Long getTemplateSize(long templateId, long zoneId);
 
     DataStore getImageStore(String storeUuid, Long zoneId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f16f92dd/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 abe467a..eb628a9 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1742,35 +1742,6 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
     }
 
 
-    @Override
-    public HostVO getSecondaryStorageHost(long zoneId) {
-        List<HostVO> hosts = _ssvmMgr
-                .listSecondaryStorageHostsInOneZone(zoneId);
-        if (hosts == null || hosts.size() == 0) {
-            hosts = _ssvmMgr.listLocalSecondaryStorageHostsInOneZone(zoneId);
-            if (hosts.isEmpty()) {
-                return null;
-            }
-        }
-
-        int size = hosts.size();
-        Random rn = new Random();
-        int index = rn.nextInt(size);
-        return hosts.get(index);
-    }
-
-    @Override
-    public List<HostVO> getSecondaryStorageHosts(long zoneId) {
-        List<HostVO> hosts = _ssvmMgr
-                .listSecondaryStorageHostsInOneZone(zoneId);
-        if (hosts == null || hosts.size() == 0) {
-            hosts = _ssvmMgr.listLocalSecondaryStorageHostsInOneZone(zoneId);
-            if (hosts.isEmpty()) {
-                return new ArrayList<HostVO>();
-            }
-        }
-        return hosts;
-    }
 
     @Override
     public Long getTemplateSize(long templateId, long zoneId) {


Mime
View raw message