mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-9252: Add nfs version to commands
This commit is contained in:
parent
476e9f0210
commit
0bc1b2727a
|
|
@ -30,6 +30,7 @@ public class GetStorageStatsCommand extends Command {
|
|||
private StoragePoolType pooltype;
|
||||
private String secUrl;
|
||||
private DataStoreTO store;
|
||||
private String nfsVersion;
|
||||
|
||||
public String getSecUrl() {
|
||||
return secUrl;
|
||||
|
|
@ -54,6 +55,11 @@ public class GetStorageStatsCommand extends Command {
|
|||
this.store = store;
|
||||
}
|
||||
|
||||
public GetStorageStatsCommand(DataStoreTO store, String nfsVersion) {
|
||||
this.store = store;
|
||||
this.nfsVersion = nfsVersion;
|
||||
}
|
||||
|
||||
public GetStorageStatsCommand(String secUrl) {
|
||||
this.secUrl = secUrl;
|
||||
}
|
||||
|
|
@ -81,6 +87,14 @@ public class GetStorageStatsCommand extends Command {
|
|||
return this.store;
|
||||
}
|
||||
|
||||
public String getNfsVersion() {
|
||||
return nfsVersion;
|
||||
}
|
||||
|
||||
public void setNfsVersion(String nfsVersion) {
|
||||
this.nfsVersion = nfsVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public class SecStorageSetupCommand extends Command {
|
|||
private String secUrl;
|
||||
private KeystoreManager.Certificates certs;
|
||||
private String postUploadKey;
|
||||
private String nfsVersion;
|
||||
|
||||
|
||||
public SecStorageSetupCommand() {
|
||||
|
|
@ -74,4 +75,12 @@ public class SecStorageSetupCommand extends Command {
|
|||
public void setPostUploadKey(String postUploadKey) {
|
||||
this.postUploadKey = postUploadKey;
|
||||
}
|
||||
|
||||
public String getNfsVersion() {
|
||||
return nfsVersion;
|
||||
}
|
||||
|
||||
public void setNfsVersion(String nfsVersion) {
|
||||
this.nfsVersion = nfsVersion;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.cloud.agent.api.to.DataStoreTO;
|
|||
|
||||
public class ListTemplateCommand extends StorageCommand {
|
||||
private DataStoreTO store;
|
||||
private String nfsVersion;
|
||||
|
||||
//private String secUrl;
|
||||
|
||||
|
|
@ -34,6 +35,11 @@ public class ListTemplateCommand extends StorageCommand {
|
|||
// this.secUrl = url;
|
||||
}
|
||||
|
||||
public ListTemplateCommand(DataStoreTO store, String nfsVersion) {
|
||||
this.store = store;
|
||||
this.nfsVersion = nfsVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
|
|
@ -43,6 +49,10 @@ public class ListTemplateCommand extends StorageCommand {
|
|||
return store;
|
||||
}
|
||||
|
||||
public String getNfsVersion() {
|
||||
return nfsVersion;
|
||||
}
|
||||
|
||||
// public String getSecUrl() {
|
||||
// return secUrl;
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ import org.apache.cloudstack.storage.command.CommandResult;
|
|||
import org.apache.cloudstack.storage.command.DeleteCommand;
|
||||
import org.apache.cloudstack.storage.datastore.DataObjectManager;
|
||||
import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager;
|
||||
import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
|
||||
import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity;
|
||||
|
|
@ -135,6 +136,8 @@ public class TemplateServiceImpl implements TemplateService {
|
|||
ConfigurationDao _configDao;
|
||||
@Inject
|
||||
StorageCacheManager _cacheMgr;
|
||||
@Inject
|
||||
ImageStoreDetailsDao _imageStoreDetailsDao;
|
||||
|
||||
class TemplateOpContext<T> extends AsyncRpcContext<T> {
|
||||
final TemplateObject template;
|
||||
|
|
@ -564,7 +567,7 @@ public class TemplateServiceImpl implements TemplateService {
|
|||
}
|
||||
|
||||
private Map<String, TemplateProp> listTemplate(DataStore ssStore) {
|
||||
ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO());
|
||||
ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO(), getNfsVersion(ssStore.getId()));
|
||||
EndPoint ep = _epSelector.select(ssStore);
|
||||
Answer answer = null;
|
||||
if (ep == null) {
|
||||
|
|
@ -586,6 +589,17 @@ public class TemplateServiceImpl implements TemplateService {
|
|||
return null;
|
||||
}
|
||||
|
||||
private String getNfsVersion(long storeId) {
|
||||
String nfsVersion = null;
|
||||
if (_imageStoreDetailsDao.getDetails(storeId) != null){
|
||||
Map<String, String> storeDetails = _imageStoreDetailsDao.getDetails(storeId);
|
||||
if (storeDetails != null && storeDetails.containsKey("nfs.version")){
|
||||
nfsVersion = storeDetails.get("nfs.version");
|
||||
}
|
||||
}
|
||||
return nfsVersion;
|
||||
}
|
||||
|
||||
protected Void createTemplateCallback(AsyncCallbackDispatcher<TemplateServiceImpl, CreateCmdResult> callback, TemplateOpContext<TemplateApiResult> context) {
|
||||
TemplateObject template = context.getTemplate();
|
||||
AsyncCompletionCallback<TemplateApiResult> parentCallback = context.getParentCallback();
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
|
|||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.framework.security.keystore.KeystoreManager;
|
||||
import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
|
||||
|
|
@ -236,6 +237,8 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
|||
@Inject
|
||||
ImageStoreDao _imageStoreDao;
|
||||
@Inject
|
||||
ImageStoreDetailsDao _imageStoreDetailsDao;
|
||||
@Inject
|
||||
TemplateDataStoreDao _tmplStoreDao;
|
||||
@Inject
|
||||
VolumeDataStoreDao _volumeStoreDao;
|
||||
|
|
@ -310,6 +313,8 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
|||
setupCmd = new SecStorageSetupCommand(ssStore.getTO(), secUrl, certs);
|
||||
}
|
||||
|
||||
setupCmd.setNfsVersion(getNfsVersion(ssStore.getId()));
|
||||
|
||||
//template/volume file upload key
|
||||
String postUploadKey = _configDao.getValue(Config.SSVMPSK.key());
|
||||
setupCmd.setPostUploadKey(postUploadKey);
|
||||
|
|
@ -358,6 +363,17 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
|||
return true;
|
||||
}
|
||||
|
||||
private String getNfsVersion(long storeId) {
|
||||
String nfsVersion = null;
|
||||
if (_imageStoreDetailsDao.getDetails(storeId) != null){
|
||||
Map<String, String> storeDetails = _imageStoreDetailsDao.getDetails(storeId);
|
||||
if (storeDetails != null && storeDetails.containsKey("nfs.version")){
|
||||
nfsVersion = storeDetails.get("nfs.version");
|
||||
}
|
||||
}
|
||||
return nfsVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generateVMSetupCommand(Long ssAHostId) {
|
||||
HostVO ssAHost = _hostDao.findById(ssAHostId);
|
||||
|
|
|
|||
Loading…
Reference in New Issue