mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
server: Added nfs minor version support (#4180)
This PR adds minor version support when mounting nfs on the SSVM as requested in #2861 The global setting "secstorage.nfs.version" has been changed to use the String data type which allows any minor version to be specified.
This commit is contained in:
parent
d949302d0f
commit
d57aa83517
@ -24,7 +24,7 @@ public class NfsTO implements DataStoreTO {
|
||||
private DataStoreRole _role;
|
||||
private String uuid;
|
||||
private static final String pathSeparator = "/";
|
||||
private Integer nfsVersion;
|
||||
private String nfsVersion;
|
||||
|
||||
public NfsTO() {
|
||||
|
||||
@ -73,11 +73,11 @@ public class NfsTO implements DataStoreTO {
|
||||
return pathSeparator;
|
||||
}
|
||||
|
||||
public Integer getNfsVersion() {
|
||||
public String getNfsVersion() {
|
||||
return nfsVersion;
|
||||
}
|
||||
|
||||
public void setNfsVersion(Integer nfsVersion) {
|
||||
public void setNfsVersion(String nfsVersion) {
|
||||
this.nfsVersion = nfsVersion;
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ public class GetStorageStatsCommand extends StorageNfsVersionCommand {
|
||||
this.store = store;
|
||||
}
|
||||
|
||||
public GetStorageStatsCommand(DataStoreTO store, Integer nfsVersion) {
|
||||
public GetStorageStatsCommand(DataStoreTO store, String nfsVersion) {
|
||||
super(nfsVersion);
|
||||
this.store = store;
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ public class ListTemplateCommand extends StorageCommand {
|
||||
this.store = store;
|
||||
}
|
||||
|
||||
public ListTemplateCommand(DataStoreTO store, Integer nfsVersion) {
|
||||
public ListTemplateCommand(DataStoreTO store, String nfsVersion) {
|
||||
super(nfsVersion);
|
||||
this.store = store;
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ public abstract class StorageCommand extends StorageNfsVersionCommand {
|
||||
super();
|
||||
}
|
||||
|
||||
protected StorageCommand(Integer nfsVersion){
|
||||
protected StorageCommand(String nfsVersion){
|
||||
super(nfsVersion);
|
||||
}
|
||||
|
||||
|
||||
@ -26,18 +26,18 @@ public abstract class StorageNfsVersionCommand extends Command {
|
||||
super();
|
||||
}
|
||||
|
||||
protected StorageNfsVersionCommand(Integer nfsVersion){
|
||||
protected StorageNfsVersionCommand(String nfsVersion){
|
||||
super();
|
||||
this.nfsVersion = nfsVersion;
|
||||
}
|
||||
|
||||
private Integer nfsVersion;
|
||||
private String nfsVersion;
|
||||
|
||||
public Integer getNfsVersion() {
|
||||
public String getNfsVersion() {
|
||||
return nfsVersion;
|
||||
}
|
||||
|
||||
public void setNfsVersion(Integer nfsVersion) {
|
||||
public void setNfsVersion(String nfsVersion) {
|
||||
this.nfsVersion = nfsVersion;
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ public class TemplateOrVolumePostUploadCommand {
|
||||
|
||||
private long accountId;
|
||||
|
||||
private Integer nfsVersion;
|
||||
private String nfsVersion;
|
||||
|
||||
public TemplateOrVolumePostUploadCommand(long entityId, String entityUUID, String absolutePath, String checksum, String type, String name, String imageFormat, String dataTo,
|
||||
String dataToRole) {
|
||||
@ -201,11 +201,11 @@ public class TemplateOrVolumePostUploadCommand {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public Integer getNfsVersion() {
|
||||
public String getNfsVersion() {
|
||||
return nfsVersion;
|
||||
}
|
||||
|
||||
public void setNfsVersion(Integer nfsVersion) {
|
||||
public void setNfsVersion(String nfsVersion) {
|
||||
this.nfsVersion = nfsVersion;
|
||||
}
|
||||
|
||||
|
||||
@ -73,9 +73,9 @@ public interface CapacityManager {
|
||||
"If set to true, creates VMs as full clones on ESX hypervisor",
|
||||
true,
|
||||
ConfigKey.Scope.StoragePool);
|
||||
static final ConfigKey<Integer> ImageStoreNFSVersion =
|
||||
new ConfigKey<Integer>(
|
||||
Integer.class,
|
||||
static final ConfigKey<String> ImageStoreNFSVersion =
|
||||
new ConfigKey<String>(
|
||||
String.class,
|
||||
"secstorage.nfs.version",
|
||||
"Advanced",
|
||||
null,
|
||||
|
||||
@ -671,7 +671,7 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
}
|
||||
|
||||
private Map<String, TemplateProp> listTemplate(DataStore ssStore) {
|
||||
Integer nfsVersion = imageStoreDetailsUtil.getNfsVersion(ssStore.getId());
|
||||
String nfsVersion = imageStoreDetailsUtil.getNfsVersion(ssStore.getId());
|
||||
ListTemplateCommand cmd = new ListTemplateCommand(ssStore.getTO(), nfsVersion);
|
||||
EndPoint ep = _epSelector.select(ssStore);
|
||||
Answer answer = null;
|
||||
|
||||
@ -36,12 +36,11 @@ public abstract class NfsImageStoreDriverImpl extends BaseImageStoreDriverImpl {
|
||||
* @param imgStoreId store id
|
||||
* @return "secstorage.nfs.version" associated value for imgStoreId in image_store_details table if exists, null if not
|
||||
*/
|
||||
protected Integer getNfsVersion(long imgStoreId){
|
||||
protected String getNfsVersion(long imgStoreId){
|
||||
Map<String, String> imgStoreDetails = _imageStoreDetailsDao.getDetails(imgStoreId);
|
||||
String nfsVersionKey = CapacityManager.ImageStoreNFSVersion.key();
|
||||
if (imgStoreDetails != null && imgStoreDetails.containsKey(nfsVersionKey)){
|
||||
String nfsVersionParam = imgStoreDetails.get(nfsVersionKey);
|
||||
return (nfsVersionParam != null ? Integer.valueOf(nfsVersionParam) : null);
|
||||
return imgStoreDetails.get(nfsVersionKey);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -109,8 +109,7 @@ public class AgentStorageResource extends AgentResourceBase implements Secondary
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRootDir(String url, Integer nfsVersion) {
|
||||
// TODO Auto-generated method stub
|
||||
public String getRootDir(String cmd, String nfsVersion) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -633,7 +633,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
||||
|
||||
@Override
|
||||
public void prepareSecondaryStorageStore(String storageUrl, Long storeId) {
|
||||
Integer nfsVersion = imageStoreDetailsUtil.getNfsVersion(storeId);
|
||||
String nfsVersion = imageStoreDetailsUtil.getNfsVersion(storeId);
|
||||
String mountPoint = getMountPoint(storageUrl, nfsVersion);
|
||||
|
||||
GlobalLock lock = GlobalLock.getInternLock("prepare.systemvm");
|
||||
@ -729,7 +729,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMountPoint(String storageUrl, Integer nfsVersion) {
|
||||
public String getMountPoint(String storageUrl, String nfsVersion) {
|
||||
String mountPoint = null;
|
||||
synchronized (_storageMounts) {
|
||||
mountPoint = _storageMounts.get(storageUrl);
|
||||
@ -820,7 +820,7 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
|
||||
}
|
||||
}
|
||||
|
||||
protected String mount(String path, String parent, Integer nfsVersion) {
|
||||
protected String mount(String path, String parent, String nfsVersion) {
|
||||
String mountPoint = setupMountPoint(parent);
|
||||
if (mountPoint == null) {
|
||||
s_logger.warn("Unable to create a mount point");
|
||||
|
||||
@ -93,7 +93,7 @@ import com.cloud.vm.snapshot.VMSnapshot;
|
||||
|
||||
public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
|
||||
private Integer _nfsVersion;
|
||||
private String _nfsVersion;
|
||||
|
||||
@Override
|
||||
public boolean execute(VmwareHostService hostService, CreateEntityDownloadURLCommand cmd) {
|
||||
@ -147,7 +147,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
_mountService = mountService;
|
||||
}
|
||||
|
||||
public VmwareStorageManagerImpl(VmwareStorageMount mountService, Integer nfsVersion) {
|
||||
public VmwareStorageManagerImpl(VmwareStorageMount mountService, String nfsVersion) {
|
||||
assert (mountService != null);
|
||||
_mountService = mountService;
|
||||
_nfsVersion = nfsVersion;
|
||||
@ -558,7 +558,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
// templateName: name in secondary storage
|
||||
// templateUuid: will be used at hypervisor layer
|
||||
private void copyTemplateFromSecondaryToPrimary(VmwareHypervisorHost hyperHost, DatastoreMO datastoreMo, String secondaryStorageUrl, String templatePathAtSecondaryStorage,
|
||||
String templateName, String templateUuid, Integer nfsVersion) throws Exception {
|
||||
String templateName, String templateUuid, String nfsVersion) throws Exception {
|
||||
|
||||
s_logger.info("Executing copyTemplateFromSecondaryToPrimary. secondaryStorage: " + secondaryStorageUrl + ", templatePathAtSecondaryStorage: "
|
||||
+ templatePathAtSecondaryStorage + ", templateName: " + templateName);
|
||||
@ -613,7 +613,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
}
|
||||
|
||||
private Ternary<String, Long, Long> createTemplateFromVolume(VirtualMachineMO vmMo, long accountId, long templateId, String templateUniqueName, String secStorageUrl,
|
||||
String volumePath, String workerVmName, Integer nfsVersion) throws Exception {
|
||||
String volumePath, String workerVmName, String nfsVersion) throws Exception {
|
||||
|
||||
String secondaryMountPoint = _mountService.getMountPoint(secStorageUrl, nfsVersion);
|
||||
String installPath = getTemplateRelativeDirInSecStorage(accountId, templateId);
|
||||
@ -678,7 +678,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
}
|
||||
|
||||
private Ternary<String, Long, Long> createTemplateFromSnapshot(long accountId, long templateId, String templateUniqueName, String secStorageUrl, long volumeId,
|
||||
String backedUpSnapshotUuid, Integer nfsVersion) throws Exception {
|
||||
String backedUpSnapshotUuid, String nfsVersion) throws Exception {
|
||||
|
||||
String secondaryMountPoint = _mountService.getMountPoint(secStorageUrl, nfsVersion);
|
||||
String installPath = getTemplateRelativeDirInSecStorage(accountId, templateId);
|
||||
@ -862,14 +862,14 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
}
|
||||
|
||||
private String createVolumeFromSnapshot(VmwareHypervisorHost hyperHost, DatastoreMO primaryDsMo, String newVolumeName, long accountId, long volumeId, String secStorageUrl,
|
||||
String snapshotBackupUuid, Integer nfsVersion) throws Exception {
|
||||
String snapshotBackupUuid, String nfsVersion) throws Exception {
|
||||
|
||||
restoreVolumeFromSecStorage(hyperHost, primaryDsMo, newVolumeName, secStorageUrl, getSnapshotRelativeDirInSecStorage(accountId, volumeId), snapshotBackupUuid, nfsVersion);
|
||||
return null;
|
||||
}
|
||||
|
||||
private void restoreVolumeFromSecStorage(VmwareHypervisorHost hyperHost, DatastoreMO primaryDsMo, String newVolumeName, String secStorageUrl, String secStorageDir,
|
||||
String backupName, Integer nfsVersion) throws Exception {
|
||||
String backupName, String nfsVersion) throws Exception {
|
||||
|
||||
String secondaryMountPoint = _mountService.getMountPoint(secStorageUrl, nfsVersion);
|
||||
String srcOVAFileName = secondaryMountPoint + "/" + secStorageDir + "/" + backupName + "." + ImageFormat.OVA.getFileExtension();
|
||||
@ -929,7 +929,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
}
|
||||
|
||||
private String backupSnapshotToSecondaryStorage(VirtualMachineMO vmMo, long accountId, long volumeId, String volumePath, String snapshotUuid, String secStorageUrl,
|
||||
String prevSnapshotUuid, String prevBackupUuid, String workerVmName, Integer nfsVersion) throws Exception {
|
||||
String prevSnapshotUuid, String prevBackupUuid, String workerVmName, String nfsVersion) throws Exception {
|
||||
|
||||
String backupUuid = UUID.randomUUID().toString();
|
||||
exportVolumeToSecondaryStorage(vmMo, volumePath, secStorageUrl, getSnapshotRelativeDirInSecStorage(accountId, volumeId), backupUuid, workerVmName, nfsVersion, true);
|
||||
@ -937,7 +937,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
}
|
||||
|
||||
private void exportVolumeToSecondaryStorage(VirtualMachineMO vmMo, String volumePath, String secStorageUrl, String secStorageDir, String exportName, String workerVmName,
|
||||
Integer nfsVersion, boolean clonedWorkerVMNeeded) throws Exception {
|
||||
String nfsVersion, boolean clonedWorkerVMNeeded) throws Exception {
|
||||
|
||||
String secondaryMountPoint = _mountService.getMountPoint(secStorageUrl, nfsVersion);
|
||||
String exportPath = secondaryMountPoint + "/" + secStorageDir + "/" + exportName;
|
||||
@ -985,7 +985,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
}
|
||||
|
||||
private Pair<String, String> copyVolumeToSecStorage(VmwareHostService hostService, VmwareHypervisorHost hyperHost, CopyVolumeCommand cmd, String vmName, long volumeId,
|
||||
String poolId, String volumePath, String secStorageUrl, String workerVmName, Integer nfsVersion) throws Exception {
|
||||
String poolId, String volumePath, String secStorageUrl, String workerVmName, String nfsVersion) throws Exception {
|
||||
|
||||
String volumeFolder = String.valueOf(volumeId) + "/";
|
||||
VirtualMachineMO workerVm = null;
|
||||
@ -1050,7 +1050,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
}
|
||||
|
||||
private Pair<String, String> copyVolumeFromSecStorage(VmwareHypervisorHost hyperHost, long volumeId, DatastoreMO dsMo, String secStorageUrl, String exportName,
|
||||
Integer nfsVersion) throws Exception {
|
||||
String nfsVersion) throws Exception {
|
||||
|
||||
String volumeFolder = String.valueOf(volumeId) + "/";
|
||||
String newVolume = UUID.randomUUID().toString().replace("-", "");
|
||||
@ -1464,7 +1464,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
}
|
||||
}
|
||||
|
||||
private String deleteVolumeDirOnSecondaryStorage(long volumeId, String secStorageUrl, Integer nfsVersion) throws Exception {
|
||||
private String deleteVolumeDirOnSecondaryStorage(long volumeId, String secStorageUrl, String nfsVersion) throws Exception {
|
||||
String secondaryMountPoint = _mountService.getMountPoint(secStorageUrl, nfsVersion);
|
||||
String volumeMountRoot = secondaryMountPoint + "/" + getVolumeRelativeDirInSecStroage(volumeId);
|
||||
|
||||
|
||||
@ -17,5 +17,5 @@
|
||||
package com.cloud.hypervisor.vmware.manager;
|
||||
|
||||
public interface VmwareStorageMount {
|
||||
String getMountPoint(String storageUrl, Integer nfsVersion);
|
||||
String getMountPoint(String storageUrl, String nfsVersion);
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
||||
protected String _password;
|
||||
protected String _guid;
|
||||
protected String _vCenterAddress;
|
||||
protected Integer storageNfsVersion;
|
||||
protected String storageNfsVersion;
|
||||
|
||||
protected String _privateNetworkVSwitchName;
|
||||
protected VmwareTrafficLabel _guestTrafficInfo = new VmwareTrafficLabel(TrafficType.Guest);
|
||||
|
||||
@ -102,7 +102,7 @@ public class PremiumSecondaryStorageResource extends NfsSecondaryStorageResource
|
||||
VmwareSecondaryStorageContextFactory.initFactoryEnvironment();
|
||||
}
|
||||
|
||||
Integer nfsVersion = NfsSecondaryStorageResource.retrieveNfsVersionFromParams(params);
|
||||
String nfsVersion = NfsSecondaryStorageResource.retrieveNfsVersionFromParams(params);
|
||||
registerHandler(Hypervisor.HypervisorType.VMware, new VmwareSecondaryStorageResourceHandler(this, nfsVersion));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ public class VmwareSecondaryStorageResourceHandler implements SecondaryStorageRe
|
||||
* private Map<String, HostMO> _activeHosts = new HashMap<String, HostMO>();
|
||||
*/
|
||||
|
||||
public VmwareSecondaryStorageResourceHandler(PremiumSecondaryStorageResource resource, Integer nfsVersion) {
|
||||
public VmwareSecondaryStorageResourceHandler(PremiumSecondaryStorageResource resource, String nfsVersion) {
|
||||
_resource = resource;
|
||||
_storageMgr = new VmwareStorageManagerImpl(this, nfsVersion);
|
||||
_gson = GsonHelper.getGsonLogger();
|
||||
@ -307,7 +307,7 @@ public class VmwareSecondaryStorageResourceHandler implements SecondaryStorageRe
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMountPoint(String storageUrl, Integer nfsVersion) {
|
||||
public String getMountPoint(String storageUrl, String nfsVersion) {
|
||||
return _resource.getRootDir(storageUrl, nfsVersion);
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,11 +154,11 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
protected Integer _shutdownWaitMs;
|
||||
private final Gson _gson;
|
||||
private final StorageLayer _storage = new JavaStorageLayer();
|
||||
private Integer _nfsVersion;
|
||||
private String _nfsVersion;
|
||||
private static final Random RANDOM = new Random(System.nanoTime());
|
||||
|
||||
public VmwareStorageProcessor(VmwareHostService hostService, boolean fullCloneFlag, VmwareStorageMount mountService, Integer timeout, VmwareResource resource,
|
||||
Integer shutdownWaitMs, PremiumSecondaryStorageResource storageResource, Integer nfsVersion) {
|
||||
Integer shutdownWaitMs, PremiumSecondaryStorageResource storageResource, String nfsVersion) {
|
||||
this.hostService = hostService;
|
||||
_fullCloneFlag = fullCloneFlag;
|
||||
this.mountService = mountService;
|
||||
@ -479,7 +479,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
|
||||
private Pair<VirtualMachineMO, Long> copyTemplateFromSecondaryToPrimary(VmwareHypervisorHost hyperHost, DatastoreMO datastoreMo, String secondaryStorageUrl,
|
||||
String templatePathAtSecondaryStorage, String templateName, String templateUuid,
|
||||
boolean createSnapshot, Integer nfsVersion) throws Exception {
|
||||
boolean createSnapshot, String nfsVersion) throws Exception {
|
||||
s_logger.info("Executing copyTemplateFromSecondaryToPrimary. secondaryStorage: " + secondaryStorageUrl + ", templatePathAtSecondaryStorage: " +
|
||||
templatePathAtSecondaryStorage + ", templateName: " + templateName);
|
||||
|
||||
@ -892,7 +892,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
}
|
||||
|
||||
private Pair<String, String> copyVolumeFromSecStorage(VmwareHypervisorHost hyperHost, String srcVolumePath, DatastoreMO dsMo, String secStorageUrl,
|
||||
long wait, Integer nfsVersion) throws Exception {
|
||||
long wait, String nfsVersion) throws Exception {
|
||||
String volumeFolder;
|
||||
String volumeName;
|
||||
String sufix = ".ova";
|
||||
@ -911,7 +911,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
return new Pair<>(volumeFolder, newVolume);
|
||||
}
|
||||
|
||||
private String deleteVolumeDirOnSecondaryStorage(String volumeDir, String secStorageUrl, Integer nfsVersion) throws Exception {
|
||||
private String deleteVolumeDirOnSecondaryStorage(String volumeDir, String secStorageUrl, String nfsVersion) throws Exception {
|
||||
String secondaryMountPoint = mountService.getMountPoint(secStorageUrl, nfsVersion);
|
||||
String volumeMountRoot = secondaryMountPoint + File.separator + volumeDir;
|
||||
|
||||
@ -1098,7 +1098,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
}
|
||||
|
||||
private Ternary<String, Long, Long> createTemplateFromVolume(VirtualMachineMO vmMo, String installPath, long templateId, String templateUniqueName,
|
||||
String secStorageUrl, String volumePath, String workerVmName, Integer nfsVersion) throws Exception {
|
||||
String secStorageUrl, String volumePath, String workerVmName, String nfsVersion) throws Exception {
|
||||
|
||||
String secondaryMountPoint = mountService.getMountPoint(secStorageUrl, nfsVersion);
|
||||
String installFullPath = secondaryMountPoint + "/" + installPath;
|
||||
@ -1263,7 +1263,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
}
|
||||
|
||||
private Ternary<String, Long, Long> createTemplateFromSnapshot(String installPath, String templateUniqueName, String secStorageUrl, String snapshotPath,
|
||||
Long templateId, long wait, Integer nfsVersion) throws Exception {
|
||||
Long templateId, long wait, String nfsVersion) throws Exception {
|
||||
//Snapshot path is decoded in this form: /snapshots/account/volumeId/uuid/uuid
|
||||
String backupSSUuid;
|
||||
String snapshotFolder;
|
||||
@ -1669,7 +1669,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
|
||||
// return Pair<String(divice bus name), String[](disk chain)>
|
||||
private Pair<String, String[]> exportVolumeToSecondaryStorage(VirtualMachineMO vmMo, String volumePath, String secStorageUrl, String secStorageDir,
|
||||
String exportName, String workerVmName, Integer nfsVersion, boolean clonedWorkerVMNeeded) throws Exception {
|
||||
String exportName, String workerVmName, String nfsVersion, boolean clonedWorkerVMNeeded) throws Exception {
|
||||
|
||||
String secondaryMountPoint = mountService.getMountPoint(secStorageUrl, nfsVersion);
|
||||
String exportPath = secondaryMountPoint + "/" + secStorageDir + "/" + exportName;
|
||||
@ -1718,7 +1718,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
// Ternary<String(backup uuid in secondary storage), String(device bus name), String[](original disk chain in the snapshot)>
|
||||
private Ternary<String, String, String[]> backupSnapshotToSecondaryStorage(VirtualMachineMO vmMo, String installPath, String volumePath, String snapshotUuid,
|
||||
String secStorageUrl, String prevSnapshotUuid, String prevBackupUuid, String workerVmName,
|
||||
Integer nfsVersion) throws Exception {
|
||||
String nfsVersion) throws Exception {
|
||||
|
||||
String backupUuid = UUID.randomUUID().toString();
|
||||
Pair<String, String[]> snapshotInfo = exportVolumeToSecondaryStorage(vmMo, volumePath, secStorageUrl, installPath, backupUuid, workerVmName, nfsVersion, true);
|
||||
@ -3382,7 +3382,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
}
|
||||
|
||||
private Long restoreVolumeFromSecStorage(VmwareHypervisorHost hyperHost, DatastoreMO primaryDsMo, String newVolumeName, String secStorageUrl, String secStorageDir,
|
||||
String backupName, long wait, Integer nfsVersion) throws Exception {
|
||||
String backupName, long wait, String nfsVersion) throws Exception {
|
||||
|
||||
String secondaryMountPoint = mountService.getMountPoint(secStorageUrl, null);
|
||||
String srcOVAFileName;
|
||||
@ -3540,7 +3540,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
return DiskControllerType.lsilogic.toString();
|
||||
}
|
||||
|
||||
void setNfsVersion(Integer nfsVersion){
|
||||
void setNfsVersion(String nfsVersion){
|
||||
this._nfsVersion = nfsVersion;
|
||||
s_logger.debug("VmwareProcessor instance now using NFS version: " + nfsVersion);
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ public class VmwareStorageSubsystemCommandHandler extends StorageSubsystemComman
|
||||
private static final Logger s_logger = Logger.getLogger(VmwareStorageSubsystemCommandHandler.class);
|
||||
private VmwareStorageManager storageManager;
|
||||
private PremiumSecondaryStorageResource storageResource;
|
||||
private Integer _nfsVersion;
|
||||
private String _nfsVersion;
|
||||
|
||||
public PremiumSecondaryStorageResource getStorageResource() {
|
||||
return storageResource;
|
||||
@ -65,7 +65,7 @@ public class VmwareStorageSubsystemCommandHandler extends StorageSubsystemComman
|
||||
this.storageManager = storageManager;
|
||||
}
|
||||
|
||||
public VmwareStorageSubsystemCommandHandler(StorageProcessor processor, Integer nfsVersion) {
|
||||
public VmwareStorageSubsystemCommandHandler(StorageProcessor processor, String nfsVersion) {
|
||||
super(processor);
|
||||
this._nfsVersion = nfsVersion;
|
||||
}
|
||||
@ -75,7 +75,7 @@ public class VmwareStorageSubsystemCommandHandler extends StorageSubsystemComman
|
||||
for (VmwareStorageProcessorConfigurableFields key : params.keySet()){
|
||||
switch (key){
|
||||
case NFS_VERSION:
|
||||
Integer nfsVersion = (Integer) params.get(key);
|
||||
String nfsVersion = (String) params.get(key);
|
||||
processor.setNfsVersion(nfsVersion);
|
||||
this._nfsVersion = nfsVersion;
|
||||
break;
|
||||
|
||||
@ -157,8 +157,8 @@ public class VmwareResourceTest {
|
||||
CopyCommand storageCmd;
|
||||
EnumMap<VmwareStorageProcessorConfigurableFields, Object> params = new EnumMap<VmwareStorageProcessorConfigurableFields,Object>(VmwareStorageProcessorConfigurableFields.class);
|
||||
|
||||
private static final Integer NFS_VERSION = Integer.valueOf(3);
|
||||
private static final Integer NFS_VERSION_NOT_PRESENT = null;
|
||||
private static final String NFS_VERSION = "3";
|
||||
private static final String NFS_VERSION_NOT_PRESENT = null;
|
||||
private static final long VRAM_MEMORY_SIZE = 131072l;
|
||||
private static final long VIDEO_CARD_MEMORY_SIZE = 65536l;
|
||||
private static final Boolean FULL_CLONE_FLAG = true;
|
||||
|
||||
@ -996,7 +996,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
||||
continue;
|
||||
}
|
||||
|
||||
Integer nfsVersion = imageStoreDetailsUtil.getNfsVersion(store.getId());
|
||||
String nfsVersion = imageStoreDetailsUtil.getNfsVersion(store.getId());
|
||||
GetStorageStatsCommand command = new GetStorageStatsCommand(store.getTO(), nfsVersion);
|
||||
EndPoint ssAhost = _epSelector.select(store);
|
||||
if (ssAhost == null) {
|
||||
|
||||
@ -42,11 +42,10 @@ public class ImageStoreDetailsUtil {
|
||||
* Retrieve global secondary storage NFS version default value
|
||||
* @return global default value
|
||||
*/
|
||||
protected Integer getGlobalDefaultNfsVersion(){
|
||||
protected String getGlobalDefaultNfsVersion(){
|
||||
ConfigurationVO globalNfsVersion = configurationDao.findByName(CapacityManager.ImageStoreNFSVersion.key());
|
||||
Preconditions.checkState(globalNfsVersion != null, "Unable to find global NFS version for version key " + CapacityManager.ImageStoreNFSVersion.key());
|
||||
String value = globalNfsVersion.getValue();
|
||||
return (value != null ? Integer.valueOf(value) : null);
|
||||
return globalNfsVersion.getValue();
|
||||
}
|
||||
/**
|
||||
* Obtain NFS protocol version (if provided) for a store id, if not use default config value<br/>
|
||||
@ -54,12 +53,11 @@ public class ImageStoreDetailsUtil {
|
||||
* @return {@code null} if {@code secstorage.nfs.version} is not found for storeId <br/>
|
||||
* {@code X} if {@code secstorage.nfs.version} is found found for storeId
|
||||
*/
|
||||
public Integer getNfsVersion(long storeId) throws NumberFormatException {
|
||||
public String getNfsVersion(long storeId) throws NumberFormatException {
|
||||
|
||||
final Map<String, String> storeDetails = imageStoreDetailsDao.getDetails(storeId);
|
||||
if (storeDetails != null && storeDetails.containsKey(CapacityManager.ImageStoreNFSVersion.key())) {
|
||||
final String version = storeDetails.get(CapacityManager.ImageStoreNFSVersion.key());
|
||||
return (version != null ? Integer.valueOf(version) : null);
|
||||
return storeDetails.get(CapacityManager.ImageStoreNFSVersion.key());
|
||||
}
|
||||
|
||||
return getGlobalDefaultNfsVersion();
|
||||
@ -68,11 +66,11 @@ public class ImageStoreDetailsUtil {
|
||||
|
||||
/**
|
||||
* Obtain NFS protocol version (if provided) for a store uuid.<br/>
|
||||
* @param resourceId image store id
|
||||
* @param storeUuid image store id
|
||||
* @return {@code null} if {@code secstorage.nfs.version} is not found for storeUuid <br/>
|
||||
* {@code X} if {@code secstorage.nfs.version} is found found for storeUuid
|
||||
*/
|
||||
public Integer getNfsVersionByUuid(String storeUuid){
|
||||
public String getNfsVersionByUuid(String storeUuid){
|
||||
ImageStoreVO imageStore = imageStoreDao.findByUuid(storeUuid);
|
||||
if (imageStore != null){
|
||||
return getNfsVersion(imageStore.getId());
|
||||
|
||||
@ -19,5 +19,5 @@ package org.apache.cloudstack.storage;
|
||||
|
||||
public interface NfsMountManager {
|
||||
|
||||
String getMountPoint(String storageUrl, Integer nfsVersion);
|
||||
String getMountPoint(String storageUrl, String nfsVersion);
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ public class NfsMountManagerImpl implements NfsMountManager {
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
||||
public String getMountPoint(String storageUrl, Integer nfsVersion) {
|
||||
public String getMountPoint(String storageUrl, String nfsVersion) {
|
||||
String mountPoint = storageMounts.get(storageUrl);
|
||||
if (mountPoint != null) {
|
||||
return mountPoint;
|
||||
@ -84,7 +84,7 @@ public class NfsMountManagerImpl implements NfsMountManager {
|
||||
return mountPoint;
|
||||
}
|
||||
|
||||
private String mount(String path, String parent, Integer nfsVersion) {
|
||||
private String mount(String path, String parent, String nfsVersion) {
|
||||
String mountPoint = setupMountPoint(parent);
|
||||
if (mountPoint == null) {
|
||||
s_logger.warn("Unable to create a mount point");
|
||||
|
||||
@ -37,8 +37,8 @@ public class ImageStoreDetailsUtilTest {
|
||||
|
||||
private final static long STORE_ID = 1l;
|
||||
private final static String STORE_UUID = "aaaa-aaaa-aaaa-aaaa";
|
||||
private final static Integer NFS_VERSION = 3;
|
||||
private final static Integer NFS_VERSION_DEFAULT = 2;
|
||||
private final static String NFS_VERSION = "3";
|
||||
private final static String NFS_VERSION_DEFAULT = "2";
|
||||
|
||||
ImageStoreDetailsUtil imageStoreDetailsUtil = new ImageStoreDetailsUtil();
|
||||
|
||||
@ -69,7 +69,7 @@ public class ImageStoreDetailsUtilTest {
|
||||
|
||||
@Test
|
||||
public void testGetNfsVersion(){
|
||||
Integer nfsVersion = imageStoreDetailsUtil.getNfsVersion(STORE_ID);
|
||||
String nfsVersion = imageStoreDetailsUtil.getNfsVersion(STORE_ID);
|
||||
assertEquals(NFS_VERSION, nfsVersion);
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ public class ImageStoreDetailsUtilTest {
|
||||
imgStoreDetails.put("other.prop", "propValue");
|
||||
when(imgStoreDetailsDao.getDetails(STORE_ID)).thenReturn(imgStoreDetails);
|
||||
|
||||
Integer nfsVersion = imageStoreDetailsUtil.getNfsVersion(STORE_ID);
|
||||
String nfsVersion = imageStoreDetailsUtil.getNfsVersion(STORE_ID);
|
||||
assertEquals(NFS_VERSION_DEFAULT, nfsVersion);
|
||||
}
|
||||
|
||||
@ -88,26 +88,26 @@ public class ImageStoreDetailsUtilTest {
|
||||
Map<String, String> imgStoreDetails = new HashMap<String, String>();
|
||||
when(imgStoreDetailsDao.getDetails(STORE_ID)).thenReturn(imgStoreDetails);
|
||||
|
||||
Integer nfsVersion = imageStoreDetailsUtil.getNfsVersion(STORE_ID);
|
||||
String nfsVersion = imageStoreDetailsUtil.getNfsVersion(STORE_ID);
|
||||
assertEquals(NFS_VERSION_DEFAULT, nfsVersion);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetNfsVersionByUuid(){
|
||||
Integer nfsVersion = imageStoreDetailsUtil.getNfsVersionByUuid(STORE_UUID);
|
||||
String nfsVersion = imageStoreDetailsUtil.getNfsVersionByUuid(STORE_UUID);
|
||||
assertEquals(NFS_VERSION, nfsVersion);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetNfsVersionByUuidNoImgStore(){
|
||||
when(imgStoreDao.findByUuid(STORE_UUID)).thenReturn(null);
|
||||
Integer nfsVersion = imageStoreDetailsUtil.getNfsVersionByUuid(STORE_UUID);
|
||||
String nfsVersion = imageStoreDetailsUtil.getNfsVersionByUuid(STORE_UUID);
|
||||
assertEquals(NFS_VERSION_DEFAULT, nfsVersion);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetGlobalDefaultNfsVersion(){
|
||||
Integer globalDefaultNfsVersion = imageStoreDetailsUtil.getGlobalDefaultNfsVersion();
|
||||
String globalDefaultNfsVersion = imageStoreDetailsUtil.getGlobalDefaultNfsVersion();
|
||||
assertEquals(NFS_VERSION_DEFAULT, globalDefaultNfsVersion);
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,7 +323,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
setupCmd = new SecStorageSetupCommand(ssStore.getTO(), secUrl, certs);
|
||||
}
|
||||
|
||||
Integer nfsVersion = imageStoreDetailsUtil.getNfsVersion(ssStore.getId());
|
||||
String nfsVersion = imageStoreDetailsUtil.getNfsVersion(ssStore.getId());
|
||||
setupCmd.setNfsVersion(nfsVersion);
|
||||
|
||||
//template/volume file upload key
|
||||
@ -1203,7 +1203,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
if (dc.getDns2() != null) {
|
||||
buf.append(" dns2=").append(dc.getDns2());
|
||||
}
|
||||
Integer nfsVersion = imageStoreDetailsUtil != null ? imageStoreDetailsUtil.getNfsVersion(secStore.getId()) : null;
|
||||
String nfsVersion = imageStoreDetailsUtil != null ? imageStoreDetailsUtil.getNfsVersion(secStore.getId()) : null;
|
||||
buf.append(" nfsVersion=").append(nfsVersion);
|
||||
|
||||
String bootArgs = buf.toString();
|
||||
|
||||
@ -53,7 +53,7 @@ public class LocalNfsSecondaryStorageResource extends NfsSecondaryStorageResourc
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public String getRootDir(String secUrl, Integer nfsVersion) {
|
||||
synchronized public String getRootDir(String secUrl, String nfsVersion) {
|
||||
try {
|
||||
URI uri = new URI(secUrl);
|
||||
String dir = mountUri(uri, nfsVersion);
|
||||
@ -66,7 +66,7 @@ public class LocalNfsSecondaryStorageResource extends NfsSecondaryStorageResourc
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mount(String localRootPath, String remoteDevice, URI uri, Integer nfsVersion) {
|
||||
protected void mount(String localRootPath, String remoteDevice, URI uri, String nfsVersion) {
|
||||
ensureLocalRootPathExists(localRootPath, uri);
|
||||
|
||||
if (mountExists(localRootPath, uri)) {
|
||||
|
||||
@ -72,7 +72,7 @@ public class LocalSecondaryStorageResource extends ServerResourceBase implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRootDir(String url, Integer nfsVersion) {
|
||||
public String getRootDir(String url, String nfsVersion) {
|
||||
return getRootDir();
|
||||
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
private String _storageIp;
|
||||
private String _storageNetmask;
|
||||
private String _storageGateway;
|
||||
private Integer _nfsVersion;
|
||||
private String _nfsVersion;
|
||||
private final List<String> nfsIps = new ArrayList<String>();
|
||||
protected String _parent = "/mnt/SecStorage";
|
||||
final private String _tmpltpp = "template.properties";
|
||||
@ -262,18 +262,8 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
* @param params
|
||||
* @return nfsVersion value if exists, null in other case
|
||||
*/
|
||||
public static Integer retrieveNfsVersionFromParams(Map<String, Object> params) {
|
||||
Integer nfsVersion = null;
|
||||
if (params.get("nfsVersion") != null) {
|
||||
String nfsVersionParam = (String)params.get("nfsVersion");
|
||||
try {
|
||||
nfsVersion = Integer.valueOf(nfsVersionParam);
|
||||
} catch (NumberFormatException e){
|
||||
s_logger.error("Couldn't cast " + nfsVersionParam + " to integer");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return nfsVersion;
|
||||
public static String retrieveNfsVersionFromParams(Map<String, Object> params) {
|
||||
return (String)params.get("nfsVersion");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -965,7 +955,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
return new CopyCmdAnswer("");
|
||||
}
|
||||
|
||||
protected File getFile(String path, String nfsPath, Integer nfsVersion) {
|
||||
protected File getFile(String path, String nfsPath, String nfsVersion) {
|
||||
String filePath = getRootDir(nfsPath, nfsVersion) + File.separator + path;
|
||||
File f = new File(filePath);
|
||||
if (!f.exists()) {
|
||||
@ -1097,7 +1087,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
return Long.parseLong(StringUtils.substringAfterLast(StringUtils.substringBeforeLast(key, S3Utils.SEPARATOR), S3Utils.SEPARATOR));
|
||||
}
|
||||
|
||||
private String determineStorageTemplatePath(final String storagePath, String dataPath, Integer nfsVersion) {
|
||||
private String determineStorageTemplatePath(final String storagePath, String dataPath, String nfsVersion) {
|
||||
return join(asList(getRootDir(storagePath, nfsVersion), dataPath), File.separator);
|
||||
}
|
||||
|
||||
@ -2444,7 +2434,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public String getRootDir(String secUrl, Integer nfsVersion) {
|
||||
synchronized public String getRootDir(String secUrl, String nfsVersion) {
|
||||
if (!_inSystemVM) {
|
||||
return _parent;
|
||||
}
|
||||
@ -2786,7 +2776,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
* @return name of folder in _parent that device was mounted.
|
||||
* @throws UnknownHostException
|
||||
*/
|
||||
protected String mountUri(URI uri, Integer nfsVersion) throws UnknownHostException {
|
||||
protected String mountUri(URI uri, String nfsVersion) throws UnknownHostException {
|
||||
String uriHostIp = getUriHostIp(uri);
|
||||
String nfsPath = uriHostIp + ":" + uri.getPath();
|
||||
|
||||
@ -2807,7 +2797,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
return dir;
|
||||
}
|
||||
|
||||
protected void mount(String localRootPath, String remoteDevice, URI uri, Integer nfsVersion) {
|
||||
protected void mount(String localRootPath, String remoteDevice, URI uri, String nfsVersion) {
|
||||
s_logger.debug("mount " + uri.toString() + " on " + localRootPath + ((nfsVersion != null) ? " nfsVersion=" + nfsVersion : ""));
|
||||
ensureLocalRootPathExists(localRootPath, uri);
|
||||
|
||||
@ -2823,7 +2813,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
checkForVolumesDir(localRootPath);
|
||||
}
|
||||
|
||||
protected void attemptMount(String localRootPath, String remoteDevice, URI uri, Integer nfsVersion) {
|
||||
protected void attemptMount(String localRootPath, String remoteDevice, URI uri, String nfsVersion) {
|
||||
String result;
|
||||
s_logger.debug("Make cmdline call to mount " + remoteDevice + " at " + localRootPath + " based on uri " + uri + ((nfsVersion != null) ? " nfsVersion=" + nfsVersion : ""));
|
||||
Script command = new Script(!_inSystemVM, "mount", _timeout, s_logger);
|
||||
|
||||
@ -23,6 +23,6 @@ import com.cloud.resource.ServerResource;
|
||||
*/
|
||||
public interface SecondaryStorageResource extends ServerResource {
|
||||
|
||||
String getRootDir(String cmd, Integer nfsVersion);
|
||||
String getRootDir(String cmd, String nfsVersion);
|
||||
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public class DownloadManagerImpl extends ManagerBase implements DownloadManager
|
||||
StorageLayer _storage;
|
||||
public Map<String, Processor> _processors;
|
||||
private long _processTimeout;
|
||||
private Integer _nfsVersion;
|
||||
private String _nfsVersion;
|
||||
|
||||
public class Completion implements DownloadCompleteCallback {
|
||||
private final String jobId;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user