Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
343acd4
Add support for FiberChannel Multipath SCSI for KVM, Pure Flash Array…
Aug 21, 2023
1d731e3
Correcting missing copyright headers
Aug 21, 2023
aafc20d
Fixing line endings from lint failures
Aug 22, 2023
3ffc813
Fix eol in README.md
Sep 18, 2023
a98cffd
Update api/src/main/java/org/apache/cloudstack/api/command/admin/stor…
Oct 7, 2023
34cf840
Update api/src/main/java/org/apache/cloudstack/api/command/admin/stor…
Oct 7, 2023
08a41d8
Update engine/storage/datamotion/src/main/java/org/apache/cloudstack/…
Oct 7, 2023
94b3a4b
Update engine/storage/datamotion/src/main/java/org/apache/cloudstack/…
Oct 10, 2023
6a51546
Update engine/storage/datamotion/src/main/java/org/apache/cloudstack/…
Oct 10, 2023
042b282
Update engine/storage/datamotion/src/main/java/org/apache/cloudstack/…
Oct 10, 2023
dbbeb87
Update plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm…
Oct 10, 2023
61ac672
Update plugins/storage/volume/flasharray/src/main/java/org/apache/clo…
Oct 10, 2023
2b9a72b
Update plugins/storage/volume/primera/src/main/java/org/apache/clouds…
Oct 10, 2023
00856d3
Update server/src/main/java/com/cloud/server/StatsCollector.java
Oct 10, 2023
fc361c3
updates from PR comments
Oct 10, 2023
d8e7c78
updates from PR comments
Oct 10, 2023
54aa093
Update engine/storage/datamotion/src/main/java/org/apache/cloudstack/…
Oct 11, 2023
62504a9
fix array index error in primera driver code during host access check
Oct 17, 2023
6e36bda
Fix issue where connectVolume.sh can inadverdantly remove a device wh…
Oct 20, 2023
ec81ac4
Update server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
Oct 26, 2023
d43f093
Update engine/storage/datamotion/src/main/java/org/apache/cloudstack/…
Oct 26, 2023
aad67de
Update engine/storage/datamotion/src/main/java/org/apache/cloudstack/…
Oct 26, 2023
ac05842
Update engine/storage/datamotion/src/main/java/org/apache/cloudstack/…
Oct 26, 2023
8ecbfea
Updates for latest PR feedback
Oct 27, 2023
a095316
small update on storage capacity calculation found in local testing
Oct 27, 2023
83395c0
fix minor logging statements and null checks
Nov 1, 2023
f5603c8
updates to work with main resync, minor fixes for issues found in test
Nov 16, 2023
c900b63
fix eol characters
Nov 16, 2023
9ed2807
commit changes from main merge and conflict resolution
Nov 16, 2023
2719d1e
fix trailing whitespace in AdaptiveDataStoreDriverImpl
Nov 17, 2023
0635bd0
eof resizeVolume.sh fix
Nov 17, 2023
889cf8c
Merge branch 'main' into primera-pure-storage-provider-feature
Nov 30, 2023
23ede47
merge conflict resolution/resolve minor issues
Nov 30, 2023
93ff52f
fix copyright/eof in copyVolume.sh
Nov 30, 2023
2ac9105
eol whitespace fix in UpdateStoragePoolCmd.java
Nov 30, 2023
9bb6dfd
merge upstream changes
Dec 4, 2023
9cf0ad0
resolving PR#7889 issues from slavkap
Dec 4, 2023
b58a5db
change trace to debug in AncientDataMotionStrategy
Dec 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions api/src/main/java/com/cloud/storage/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,18 @@ public String getFileExtension() {
}

public static enum Capability {
HARDWARE_ACCELERATION("HARDWARE_ACCELERATION");
HARDWARE_ACCELERATION("HARDWARE_ACCELERATION"),
ALLOW_MIGRATE_OTHER_POOLS("ALLOW_MIGRATE_OTHER_POOLS");

private final String capability;

private Capability(String capability) {
this.capability = capability;
}

public String toString() {
return this.capability;
}
}

public static enum ProvisioningType {
Expand Down Expand Up @@ -150,7 +155,8 @@ public static enum StoragePoolType {
ManagedNFS(true, false, false),
Linstor(true, true, false),
DatastoreCluster(true, true, false), // for VMware, to abstract pool of clusters
StorPool(true, true, true);
StorPool(true, true, true),
FiberChannel(true, true, false); // Fiber Channel Pool for KVM hypervisors is used to find the volume by WWN value (/dev/disk/by-id/wwn-<wwnvalue>)

private final boolean shared;
private final boolean overprovisioning;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.cloudstack.api.command.admin.storage;

import java.util.List;
import java.util.Map;

import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.log4j.Logger;
Expand All @@ -32,6 +33,7 @@
import com.cloud.storage.StoragePool;
import com.cloud.user.Account;

@SuppressWarnings("rawtypes")
@APICommand(name = "updateStoragePool", description = "Updates a storage pool.", responseObject = StoragePoolResponse.class, since = "3.0.0",
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateStoragePoolCmd extends BaseCmd {
Expand Down Expand Up @@ -61,6 +63,20 @@ public class UpdateStoragePoolCmd extends BaseCmd {
" enable it back.")
private Boolean enabled;

@Parameter(name = ApiConstants.DETAILS,
type = CommandType.MAP,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor - indentation seems a bit off

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in upcoming commit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rg9975 issue still seems to be there

required = false,
description = "the details for the storage pool",
since = "4.19.0")
private Map details;

@Parameter(name = ApiConstants.URL,
type = CommandType.STRING,
required = false,
description = "the URL of the storage pool",
since = "4.19.0")
private String url;

@Parameter(name = ApiConstants.IS_TAG_A_RULE, type = CommandType.BOOLEAN, description = ApiConstants.PARAMETER_DESCRIPTION_IS_TAG_A_RULE)
private Boolean isTagARule;

Expand Down Expand Up @@ -115,6 +131,22 @@ public ApiCommandResourceType getApiResourceType() {
return ApiCommandResourceType.StoragePool;
}

public Map<String,String> getDetails() {
return details;
}

public void setDetails(Map<String,String> details) {
this.details = details;
}

public String getUrl() {
return url;
}

public void setUrl(String url) {
this.url = url;
}

@Override
public void execute() {
StoragePool result = _storageService.updateStoragePool(this);
Expand Down
10 changes: 10 additions & 0 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@
<artifactId>cloud-plugin-storage-volume-storpool</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-storage-volume-primera</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-storage-volume-flasharray</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-server</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2957,6 +2957,7 @@ protected Map<Volume, StoragePool> buildMapUsingUserInformation(VirtualMachinePr
* <ul>
* <li> If the current storage pool of the volume is not a managed storage, we do not need to validate anything here.
* <li> If the current storage pool is a managed storage and the target storage pool ID is different from the current one, we throw an exception.
* <li> If the current storage pool is a managed storage and explicitly declared its capable of migration to alternate storage pools
* </ul>
*/
protected void executeManagedStorageChecksWhenTargetStoragePoolProvided(StoragePoolVO currentPool, VolumeVO volume, StoragePoolVO targetPool) {
Expand All @@ -2966,6 +2967,11 @@ protected void executeManagedStorageChecksWhenTargetStoragePoolProvided(StorageP
if (currentPool.getId() == targetPool.getId()) {
return;
}

Map<String, String> details = _storagePoolDao.getDetails(currentPool.getId());
if (details != null && Boolean.parseBoolean(details.get(Storage.Capability.ALLOW_MIGRATE_OTHER_POOLS.toString()))) {
return;
}
throw new CloudRuntimeException(String.format("Currently, a volume on managed storage can only be 'migrated' to itself " + "[volumeId=%s, currentStoragePoolId=%s, targetStoragePoolId=%s].",
volume.getUuid(), currentPool.getUuid(), targetPool.getUuid()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ protected Answer copyObject(DataObject srcData, DataObject destData, Host destHo
destData.getType() == DataObjectType.TEMPLATE)) {
// volume transfer from primary to secondary. Volume transfer between primary pools are already handled by copyVolumeBetweenPools
// Delete cache in order to certainly transfer a latest image.
s_logger.debug("Delete " + cacheType + " cache(id: " + cacheId +
if (s_logger.isDebugEnabled()) s_logger.debug("Delete " + cacheType + " cache(id: " + cacheId +
", uuid: " + cacheUuid + ")");
cacheMgr.deleteCacheObject(srcForCopy);
} else {
Expand All @@ -205,15 +205,15 @@ protected Answer copyObject(DataObject srcData, DataObject destData, Host destHo
", uuid: " + cacheUuid + ")");
cacheMgr.deleteCacheObject(srcForCopy);
} else {
s_logger.debug("Decrease reference count of " + cacheType +
if (s_logger.isDebugEnabled()) s_logger.debug("Decrease reference count of " + cacheType +
" cache(id: " + cacheId + ", uuid: " + cacheUuid + ")");
cacheMgr.releaseCacheObject(srcForCopy);
}
}
}
return answer;
} catch (Exception e) {
s_logger.debug("copy object failed: ", e);
if (s_logger.isDebugEnabled()) s_logger.debug("copy object failed: ", e);
if (cacheData != null) {
cacheMgr.deleteCacheObject(cacheData);
}
Expand Down Expand Up @@ -331,7 +331,7 @@ protected Answer cloneVolume(DataObject template, DataObject volume) {
}
return answer;
} catch (Exception e) {
s_logger.debug("Failed to send to storage pool", e);
if (s_logger.isDebugEnabled()) s_logger.debug("Failed to send to storage pool", e);
throw new CloudRuntimeException("Failed to send to storage pool", e);
}
}
Expand Down Expand Up @@ -388,7 +388,7 @@ protected Answer copyVolumeBetweenPools(DataObject srcData, DataObject destData)

if (answer == null || !answer.getResult()) {
if (answer != null) {
s_logger.debug("copy to image store failed: " + answer.getDetails());
if (s_logger.isDebugEnabled()) s_logger.debug("copy to image store failed: " + answer.getDetails());
}
objOnImageStore.processEvent(Event.OperationFailed);
imageStore.delete(objOnImageStore);
Expand All @@ -411,7 +411,7 @@ protected Answer copyVolumeBetweenPools(DataObject srcData, DataObject destData)

if (answer == null || !answer.getResult()) {
if (answer != null) {
s_logger.debug("copy to primary store failed: " + answer.getDetails());
if (s_logger.isDebugEnabled()) s_logger.debug("copy to primary store failed: " + answer.getDetails());
}
objOnImageStore.processEvent(Event.OperationFailed);
imageStore.delete(objOnImageStore);
Expand Down Expand Up @@ -471,13 +471,17 @@ protected Answer migrateVolumeToPool(DataObject srcData, DataObject destData) {
s_logger.error(errMsg);
answer = new Answer(command, false, errMsg);
} else {
if (s_logger.isDebugEnabled()) s_logger.debug("Sending MIGRATE_COPY request to node " + ep);
answer = ep.sendMessage(command);
if (s_logger.isDebugEnabled()) s_logger.debug("Received MIGRATE_COPY response from node with answer: " + answer);
}

if (answer == null || !answer.getResult()) {
throw new CloudRuntimeException("Failed to migrate volume " + volume + " to storage pool " + destPool);
} else {
// Update the volume details after migration.
if (s_logger.isDebugEnabled()) s_logger.debug("MIGRATE_COPY updating volume");

VolumeVO volumeVo = volDao.findById(volume.getId());
Long oldPoolId = volume.getPoolId();
volumeVo.setPath(((MigrateVolumeAnswer)answer).getVolumePath());
Expand All @@ -496,6 +500,8 @@ protected Answer migrateVolumeToPool(DataObject srcData, DataObject destData) {
}
volumeVo.setFolder(folder);
volDao.update(volume.getId(), volumeVo);
if (s_logger.isDebugEnabled()) s_logger.debug("MIGRATE_COPY update volume data complete");

}

return answer;
Expand All @@ -507,7 +513,7 @@ public void copyAsync(DataObject srcData, DataObject destData, Host destHost, As
Answer answer = null;
String errMsg = null;
try {
s_logger.debug("copyAsync inspecting src type " + srcData.getType().toString() + " copyAsync inspecting dest type " + destData.getType().toString());
if (s_logger.isDebugEnabled()) s_logger.debug("copyAsync inspecting src type " + srcData.getType().toString() + " copyAsync inspecting dest type " + destData.getType().toString());
if (srcData.getType() == DataObjectType.SNAPSHOT && destData.getType() == DataObjectType.VOLUME) {
answer = copyVolumeFromSnapshot(srcData, destData);
} else if (srcData.getType() == DataObjectType.SNAPSHOT && destData.getType() == DataObjectType.TEMPLATE) {
Expand All @@ -516,11 +522,16 @@ public void copyAsync(DataObject srcData, DataObject destData, Host destHost, As
answer = cloneVolume(srcData, destData);
} else if (destData.getType() == DataObjectType.VOLUME && srcData.getType() == DataObjectType.VOLUME &&
srcData.getDataStore().getRole() == DataStoreRole.Primary && destData.getDataStore().getRole() == DataStoreRole.Primary) {
if (s_logger.isDebugEnabled()) s_logger.debug("About to MIGRATE copy between datasources");
if (srcData.getId() == destData.getId()) {
// The volume has to be migrated across storage pools.
if (s_logger.isDebugEnabled()) s_logger.debug("MIGRATE copy using migrateVolumeToPool STARTING");
answer = migrateVolumeToPool(srcData, destData);
if (s_logger.isDebugEnabled()) s_logger.debug("MIGRATE copy using migrateVolumeToPool DONE: " + answer.getResult());
} else {
if (s_logger.isDebugEnabled()) s_logger.debug("MIGRATE copy using copyVolumeBetweenPools STARTING");
answer = copyVolumeBetweenPools(srcData, destData);
if (s_logger.isDebugEnabled()) s_logger.debug("MIGRATE copy using copyVolumeBetweenPools DONE: " + answer.getResult());
}
} else if (srcData.getType() == DataObjectType.SNAPSHOT && destData.getType() == DataObjectType.SNAPSHOT) {
answer = copySnapshot(srcData, destData);
Expand All @@ -532,7 +543,7 @@ public void copyAsync(DataObject srcData, DataObject destData, Host destHost, As
errMsg = answer.getDetails();
}
} catch (Exception e) {
s_logger.debug("copy failed", e);
if (s_logger.isDebugEnabled()) s_logger.debug("copy failed", e);
errMsg = e.toString();
}
CopyCommandResult result = new CopyCommandResult(null, answer);
Expand Down Expand Up @@ -627,7 +638,7 @@ protected Answer copySnapshot(DataObject srcData, DataObject destData) {
}
return answer;
} catch (Exception e) {
s_logger.debug("copy snasphot failed: ", e);
if (s_logger.isDebugEnabled()) s_logger.debug("copy snasphot failed: ", e);
if (cacheData != null) {
cacheMgr.deleteCacheObject(cacheData);
}
Expand Down
Loading