Revert previous workaround for ListTemplateCommand, which is correct

after updating the systemvm.iso on devcloud.
This commit is contained in:
Min Chen 2013-05-06 11:29:57 -07:00
parent bc244ccc8b
commit 7ad263b67e
4 changed files with 12 additions and 9 deletions

View File

@ -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;
// }
}

View File

@ -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<String, TemplateProp> templateInfos = _dlMgr.gatherTemplateInfo(root);
return new ListTemplateAnswer(secUrl, templateInfos);

View File

@ -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() {

View File

@ -417,7 +417,7 @@ public class TemplateServiceImpl implements TemplateService {
private Map<String, TemplateProp> 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()) {