Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions plugins/storage/volume/linstor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to Linstor CloudStack plugin will be documented in this file
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2025-02-21]

### Fixed

- Always try to delete cs-...-rst resource before doing a snapshot backup

## [2025-01-27]

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,8 @@
String snapshotName,
String restoredName) throws ApiException {
final String rscGrp = getRscGrp(storagePoolVO);
// try to delete -rst resource, could happen if the copy failed and noone deleted it.
deleteResourceDefinition(storagePoolVO, restoredName);

Check warning on line 1121 in plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java

View check run for this annotation

Codecov / codecov/patch

plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java#L1121

Added line #L1121 was not covered by tests
ResourceDefinitionCreate rdc = createResourceDefinitionCreate(restoredName, rscGrp);
api.resourceDefinitionCreate(rdc);

Expand Down Expand Up @@ -1259,19 +1261,22 @@
throws ApiException {
Answer answer;
String restoreName = rscName + "-rst";
String devName = restoreResourceFromSnapshot(api, pool, rscName, snapshotName, restoreName);

Optional<RemoteHostEndPoint> optEPAny = getLinstorEP(api, restoreName);
if (optEPAny.isPresent()) {
// patch the src device path to the temporary linstor resource
snapshotObject.setPath(devName);
origCmd.setSrcTO(snapshotObject.getTO());
answer = optEPAny.get().sendMessage(origCmd);
} else{
answer = new Answer(origCmd, false, "Unable to get matching Linstor endpoint.");
try {
String devName = restoreResourceFromSnapshot(api, pool, rscName, snapshotName, restoreName);

Check warning on line 1265 in plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java

View check run for this annotation

Codecov / codecov/patch

plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java#L1264-L1265

Added lines #L1264 - L1265 were not covered by tests

Optional<RemoteHostEndPoint> optEPAny = getLinstorEP(api, restoreName);

Check warning on line 1267 in plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java

View check run for this annotation

Codecov / codecov/patch

plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java#L1267

Added line #L1267 was not covered by tests
if (optEPAny.isPresent()) {
// patch the src device path to the temporary linstor resource
snapshotObject.setPath(devName);
origCmd.setSrcTO(snapshotObject.getTO());
answer = optEPAny.get().sendMessage(origCmd);

Check warning on line 1272 in plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java

View check run for this annotation

Codecov / codecov/patch

plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java#L1270-L1272

Added lines #L1270 - L1272 were not covered by tests
} else{
answer = new Answer(origCmd, false, "Unable to get matching Linstor endpoint.");

Check warning on line 1274 in plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java

View check run for this annotation

Codecov / codecov/patch

plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java#L1274

Added line #L1274 was not covered by tests
}
} finally {
// delete the temporary resource, noop if already gone
api.resourceDefinitionDelete(restoreName);

Check warning on line 1278 in plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java

View check run for this annotation

Codecov / codecov/patch

plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java#L1278

Added line #L1278 was not covered by tests
}
// delete the temporary resource, noop if already gone
api.resourceDefinitionDelete(restoreName);
return answer;
}

Expand Down