CLOUDSTACK-3818: NFS Cache Improperly Named.

This commit is contained in:
Min Chen 2013-07-26 14:51:42 -07:00
parent f5e5b39c9b
commit c8cafb91a7
13 changed files with 75 additions and 75 deletions

View File

@ -20,9 +20,9 @@ import java.net.UnknownHostException;
import org.apache.cloudstack.api.command.admin.storage.AddImageStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
import org.apache.cloudstack.api.command.admin.storage.CreateCacheStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
import org.apache.cloudstack.api.command.admin.storage.DeleteCacheStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd;
import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
@ -50,7 +50,7 @@ public interface StorageService{
StoragePool createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException,
UnknownHostException, ResourceUnavailableException;
ImageStore createCacheStore(CreateCacheStoreCmd cmd);
ImageStore createSecondaryStagingStore(CreateSecondaryStagingStoreCmd cmd);
/**
* Delete the storage pool
@ -93,7 +93,7 @@ public interface StorageService{
boolean deleteImageStore(DeleteImageStoreCmd cmd);
boolean deleteCacheStore(DeleteCacheStoreCmd cmd);
boolean deleteSecondaryStagingStore(DeleteSecondaryStagingStoreCmd cmd);
ImageStore discoverImageStore(AddImageStoreCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;

View File

@ -35,32 +35,32 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@APICommand(name = "createCacheStore", description="create cache store.", responseObject=ImageStoreResponse.class)
public class CreateCacheStoreCmd extends BaseCmd {
@APICommand(name = "createSecondaryStagingStore", description = "create secondary staging store.", responseObject = ImageStoreResponse.class)
public class CreateSecondaryStagingStoreCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddImageStoreCmd.class.getName());
private static final String s_name = "createcachestoreresponse";
private static final String s_name = "createsecondarystagingstoreresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="the URL for the cache store")
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "the URL for the staging store")
private String url;
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
description="the Zone ID for the image store")
description = "the Zone ID for the staging store")
private Long zoneId;
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details for the image store")
@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "the details for the staging store")
private Map<String, String> details;
@Parameter(name=ApiConstants.SCOPE, type=CommandType.STRING,
required=false, description="the scope of the image store: zone only for now")
required = false, description = "the scope of the staging store: zone only for now")
private String scope;
@Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING,
required=false, description="the cache store provider name")
required = false, description = "the staging store provider name")
private String providerName;
/////////////////////////////////////////////////////
@ -75,25 +75,25 @@ public class CreateCacheStoreCmd extends BaseCmd {
return zoneId;
}
public Map<String, String> getDetails() {
Map<String, String> detailsMap = null;
if (details != null && !details.isEmpty()) {
detailsMap = new HashMap<String, String>();
Collection<?> props = details.values();
Iterator<?> iter = props.iterator();
while (iter.hasNext()) {
HashMap<String, String> detail = (HashMap<String, String>) iter.next();
String key = detail.get("key");
String value = detail.get("value");
detailsMap.put(key, value);
}
}
return detailsMap;
public Map<String, String> getDetails() {
Map<String, String> detailsMap = null;
if (details != null && !details.isEmpty()) {
detailsMap = new HashMap<String, String>();
Collection<?> props = details.values();
Iterator<?> iter = props.iterator();
while (iter.hasNext()) {
HashMap<String, String> detail = (HashMap<String, String>) iter.next();
String key = detail.get("key");
String value = detail.get("value");
detailsMap.put(key, value);
}
}
return detailsMap;
}
public String getScope() {
return this.scope;
}
}
public String getProviderName() {
return this.providerName;
@ -117,13 +117,13 @@ public class CreateCacheStoreCmd extends BaseCmd {
@Override
public void execute(){
try{
ImageStore result = _storageService.createCacheStore(this);
ImageStore result = _storageService.createSecondaryStagingStore(this);
ImageStoreResponse storeResponse = null;
if (result != null ) {
storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("secondarystorage");
this.setResponseObject(storeResponse);
storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("secondarystorage");
this.setResponseObject(storeResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
}

View File

@ -28,18 +28,18 @@ import org.apache.log4j.Logger;
import com.cloud.user.Account;
@APICommand(name = "deleteCacheStore", description = "Deletes a cache store .", responseObject = SuccessResponse.class, since = "4.2.0")
public class DeleteCacheStoreCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteCacheStoreCmd.class.getName());
@APICommand(name = "deleteSecondaryStagingStore", description = "Deletes a secondary staging store .", responseObject = SuccessResponse.class, since = "4.2.0")
public class DeleteSecondaryStagingStoreCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteSecondaryStagingStoreCmd.class.getName());
private static final String s_name = "deletecachestoreresponse";
private static final String s_name = "deletesecondarystagingstoreresponse";
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ImageStoreResponse.class,
required = true, description = "the cache store ID")
required = true, description = "the staging store ID")
private Long id;
@ -68,12 +68,12 @@ public class DeleteCacheStoreCmd extends BaseCmd {
@Override
public void execute() {
boolean result = _storageService.deleteCacheStore(this);
boolean result = _storageService.deleteSecondaryStagingStore(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete image store");
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete secondary staging store");
}
}
}

View File

@ -25,31 +25,31 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
@APICommand(name = "listCacheStores", description="Lists cache stores.", responseObject=ImageStoreResponse.class, since = "4.2.0")
public class ListCacheStoresCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListCacheStoresCmd.class.getName());
@APICommand(name = "listSecondaryStagingStores", description = "Lists secondary staging stores.", responseObject = ImageStoreResponse.class, since = "4.2.0")
public class ListSecondaryStagingStoresCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListSecondaryStagingStoresCmd.class.getName());
private static final String s_name = "listcachestoreresponse";
private static final String s_name = "listsecondarystagingstoreresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the cache store")
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the staging store")
private String storeName;
@Parameter(name=ApiConstants.PROTOCOL, type=CommandType.STRING, description="the cache store protocol")
@Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "the staging store protocol")
private String protocol;
@Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING, description="the cache store provider")
@Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "the staging store provider")
private String provider;
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
description="the Zone ID for the cache store")
description = "the Zone ID for the staging store")
private Long zoneId;
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = ImageStoreResponse.class,
description="the ID of the cache store")
description = "the ID of the staging store")
private Long id;
/////////////////////////////////////////////////////
@ -97,7 +97,7 @@ public class ListCacheStoresCmd extends BaseListCmd {
@Override
public void execute(){
ListResponse<ImageStoreResponse> response = _queryService.searchForCacheStores(this);
ListResponse<ImageStoreResponse> response = _queryService.searchForSecondaryStagingStores(this);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}

View File

@ -20,7 +20,7 @@ import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
import org.apache.cloudstack.api.command.admin.internallb.ListInternalLBVMsCmd;
import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
import org.apache.cloudstack.api.command.admin.storage.ListCacheStoresCmd;
import org.apache.cloudstack.api.command.admin.storage.ListSecondaryStagingStoresCmd;
import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd;
import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
import org.apache.cloudstack.api.command.admin.user.ListUsersCmd;
@ -81,7 +81,7 @@ public interface QueryService {
public ListResponse<ImageStoreResponse> searchForImageStores(ListImageStoresCmd cmd);
public ListResponse<ImageStoreResponse> searchForCacheStores(ListCacheStoresCmd cmd);
public ListResponse<ImageStoreResponse> searchForSecondaryStagingStores(ListSecondaryStagingStoresCmd cmd);
public ListResponse<AccountResponse> searchForAccounts(ListAccountsCmd cmd);

View File

@ -250,9 +250,9 @@ listS3s=1
addImageStore=1
listImageStores=1
deleteImageStore=1
createCacheStore=1
listCacheStores=1
#deleteCacheStore=1
createSecondaryStagingStore=1
listSecondaryStagingStores=1
deleteSecondaryStagingStore=1
#### host commands
addHost=3

View File

@ -46,7 +46,7 @@ public class StorageCacheRandomAllocator implements StorageCacheAllocator {
List<DataStore> cacheStores = dataStoreMgr.getImageCacheStores(scope);
if (cacheStores.size() <= 0) {
s_logger.debug("Can't find cache storage in zone: " + scope.getScopeId());
s_logger.debug("Can't find staging storage in zone: " + scope.getScopeId());
return null;
}

View File

@ -472,12 +472,12 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
if (secUrl == null) {
// we are using non-NFS image store, then use cache storage instead
s_logger.info("Secondary storage is not NFS, we need to use cache storage");
s_logger.info("Secondary storage is not NFS, we need to use staging storage");
DataStore cacheStore = _dataStoreMgr.getImageCacheStore(dcId);
if (cacheStore != null) {
secUrl = cacheStore.getUri();
} else {
s_logger.warn("No cache storage is found when non-NFS secondary storage is used");
s_logger.warn("No staging storage is found when non-NFS secondary storage is used");
}
}

View File

@ -34,7 +34,7 @@ import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
import org.apache.cloudstack.api.command.admin.internallb.ListInternalLBVMsCmd;
import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
import org.apache.cloudstack.api.command.admin.storage.ListCacheStoresCmd;
import org.apache.cloudstack.api.command.admin.storage.ListSecondaryStagingStoresCmd;
import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd;
import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
import org.apache.cloudstack.api.command.admin.user.ListUsersCmd;
@ -2107,7 +2107,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
}
@Override
public ListResponse<ImageStoreResponse> searchForCacheStores(ListCacheStoresCmd cmd) {
public ListResponse<ImageStoreResponse> searchForSecondaryStagingStores(ListSecondaryStagingStoresCmd cmd) {
Pair<List<ImageStoreJoinVO>, Integer> result = searchForCacheStoresInternal(cmd);
ListResponse<ImageStoreResponse> response = new ListResponse<ImageStoreResponse>();
@ -2117,7 +2117,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
return response;
}
private Pair<List<ImageStoreJoinVO>, Integer> searchForCacheStoresInternal(ListCacheStoresCmd cmd) {
private Pair<List<ImageStoreJoinVO>, Integer> searchForCacheStoresInternal(ListSecondaryStagingStoresCmd cmd) {
Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), cmd.getZoneId());
Object id = cmd.getId();

View File

@ -146,13 +146,13 @@ import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd;
import org.apache.cloudstack.api.command.admin.storage.AddImageStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.AddS3Cmd;
import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
import org.apache.cloudstack.api.command.admin.storage.CreateCacheStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
import org.apache.cloudstack.api.command.admin.storage.DeleteCacheStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd;
import org.apache.cloudstack.api.command.admin.storage.FindStoragePoolsForMigrationCmd;
import org.apache.cloudstack.api.command.admin.storage.ListCacheStoresCmd;
import org.apache.cloudstack.api.command.admin.storage.ListSecondaryStagingStoresCmd;
import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd;
import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd;
import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
@ -2798,9 +2798,9 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
cmdList.add(AddImageStoreCmd.class);
cmdList.add(ListImageStoresCmd.class);
cmdList.add(DeleteImageStoreCmd.class);
cmdList.add(CreateCacheStoreCmd.class);
cmdList.add(ListCacheStoresCmd.class);
cmdList.add(DeleteCacheStoreCmd.class);
cmdList.add(CreateSecondaryStagingStoreCmd.class);
cmdList.add(ListSecondaryStagingStoresCmd.class);
cmdList.add(DeleteSecondaryStagingStoreCmd.class);
cmdList.add(CreateApplicationLoadBalancerCmd.class);
cmdList.add(ListApplicationLoadBalancersCmd.class);
cmdList.add(DeleteApplicationLoadBalancerCmd.class);

View File

@ -46,9 +46,9 @@ import org.springframework.stereotype.Component;
import org.apache.cloudstack.api.command.admin.storage.AddImageStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
import org.apache.cloudstack.api.command.admin.storage.CreateCacheStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
import org.apache.cloudstack.api.command.admin.storage.DeleteCacheStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd;
import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
@ -1797,7 +1797,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
}
@Override
public ImageStore createCacheStore(CreateCacheStoreCmd cmd) {
public ImageStore createSecondaryStagingStore(CreateSecondaryStagingStoreCmd cmd) {
String providerName = cmd.getProviderName();
DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(providerName);
@ -1865,7 +1865,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
}
@Override
public boolean deleteCacheStore(DeleteCacheStoreCmd cmd) {
public boolean deleteSecondaryStagingStore(DeleteSecondaryStagingStoreCmd cmd) {
long storeId = cmd.getId();
User caller = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
// Verify that cache store exists

View File

@ -145,9 +145,9 @@ known_categories = {
'addImageStore': 'Image Store',
'listImageStore': 'Image Store',
'deleteImageStore': 'Image Store',
'createCacheStore': 'Image Store',
'deleteCacheStore': 'Image Store',
'listCacheStores': 'Image Store',
'createSecondaryStagingStore': 'Image Store',
'deleteSecondaryStagingStore': 'Image Store',
'listSecondaryStagingStores': 'Image Store',
'InternalLoadBalancer': 'Internal LB',
'DeploymentPlanners': 'Configuration',
'PortableIp': 'Portable IP',

View File

@ -174,7 +174,7 @@ specify a valid config file" % cfgFile)
if cacheStorages is None:
return
for cache in cacheStorages:
cachecmd = createCacheStore.createCacheStoreCmd()
cachecmd = createSecondaryStagingStore.createSecondaryStagingStoreCmd()
cachecmd.url = cache.url
cachecmd.provider = cache.provider
cachecmd.zoneid = zoneId
@ -186,7 +186,7 @@ specify a valid config file" % cfgFile)
'key': key,
'value': value
})
self.apiClient.createCacheStore(cachecmd)
self.apiClient.createSecondaryStagingStore(cachecmd)
def createnetworks(self, networks, zoneId):
if networks is None: