diff --git a/api/src/com/cloud/agent/api/storage/ListTemplateCommand.java b/api/src/com/cloud/agent/api/storage/ListTemplateCommand.java index 390f09b51b0..e5339f2982d 100644 --- a/api/src/com/cloud/agent/api/storage/ListTemplateCommand.java +++ b/api/src/com/cloud/agent/api/storage/ListTemplateCommand.java @@ -20,14 +20,14 @@ import com.cloud.agent.api.to.DataStoreTO; public class ListTemplateCommand extends StorageCommand { private DataStoreTO store; - private String secUrl; + //private String secUrl; public ListTemplateCommand() { } - public ListTemplateCommand(DataStoreTO store, String url) { + public ListTemplateCommand(DataStoreTO store) { this.store = store; - this.secUrl = url; +// this.secUrl = url; } @Override @@ -40,8 +40,8 @@ public class ListTemplateCommand extends StorageCommand { return store; } - public String getSecUrl() { - return secUrl; - } + // public String getSecUrl() { + // return secUrl; + // } } diff --git a/core/src/com/cloud/storage/resource/NfsSecondaryStorageResource.java b/core/src/com/cloud/storage/resource/NfsSecondaryStorageResource.java index 9c09faa6723..d9f91a33e84 100755 --- a/core/src/com/cloud/storage/resource/NfsSecondaryStorageResource.java +++ b/core/src/com/cloud/storage/resource/NfsSecondaryStorageResource.java @@ -1153,7 +1153,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S DataStoreTO store = cmd.getDataStore(); if (store instanceof NfsTO) { NfsTO nfs = (NfsTO) store; - String secUrl = cmd.getSecUrl(); + String secUrl = nfs.getUrl(); String root = getRootDir(secUrl); Map templateInfos = _dlMgr.gatherTemplateInfo(root); return new ListTemplateAnswer(secUrl, templateInfos); diff --git a/core/test/com/cloud/agent/transport/RequestTest.java b/core/test/com/cloud/agent/transport/RequestTest.java index 27bb4ff7426..510be91ae6e 100644 --- a/core/test/com/cloud/agent/transport/RequestTest.java +++ b/core/test/com/cloud/agent/transport/RequestTest.java @@ -33,6 +33,7 @@ import com.cloud.agent.api.SecStorageFirewallCfgCommand; import com.cloud.agent.api.SecStorageSetupCommand; import com.cloud.agent.api.UpdateHostPasswordCommand; import com.cloud.agent.api.storage.DownloadAnswer; +import com.cloud.agent.api.storage.ListTemplateCommand; import com.cloud.agent.api.to.NfsTO; import com.cloud.exception.UnsupportedVersionException; import com.cloud.hypervisor.Hypervisor.HypervisorType; @@ -135,7 +136,8 @@ public class RequestTest extends TestCase { s_logger.info("Testing serializing and deserializing interface TO works as expected"); NfsTO nfs = new NfsTO("nfs://192.168.56.10/opt/storage/secondary", DataStoreRole.Image); - SecStorageSetupCommand cmd = new SecStorageSetupCommand(nfs, "nfs://192.168.56.10/opt/storage/secondary", null); + // SecStorageSetupCommand cmd = new SecStorageSetupCommand(nfs, "nfs://192.168.56.10/opt/storage/secondary", null); + ListTemplateCommand cmd = new ListTemplateCommand(nfs); Request sreq = new Request(2, 3, cmd, true); sreq.setSequence(892403718); @@ -158,6 +160,7 @@ public class RequestTest extends TestCase { assert creq != null : "Couldn't get the request back"; compareRequest(creq, sreq); + assertEquals("nfs://192.168.56.10/opt/storage/secondary", ((NfsTO)((ListTemplateCommand)creq.getCommand()).getDataStore()).getUrl()); } public void testDownload() { diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java index b7b42e5d4c7..60b3f5389d8 100644 --- a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java @@ -417,7 +417,7 @@ public class TemplateServiceImpl implements TemplateService { private Map listTemplate(DataStore ssStore) { - ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO(), ssStore.getUri()); + ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO()); EndPoint ep = _epSelector.select(ssStore); Answer answer = ep.sendMessage(cmd); if (answer != null && answer.getResult()) {