Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -5594,6 +5594,13 @@ public void success(DeleteSnapshotRsp returnValue) {

@Override
public void fail(ErrorCode errorCode) {
if (!msg.isGcOnFailure()) {
reply.setError(errorCode);
bus.reply(msg, reply);
completion.done();
return;
}

// ceph has trash, so children may not be deleted immediately.
DeleteVolumeSnapshotGC snapshotGC = new DeleteVolumeSnapshotGC();
snapshotGC.NAME = String.format("gc-ceph-%s-volumesnapshot-path-%s", self.getUuid(), cmd.snapshotPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ class CephGCCase extends SubCase {
} as VolumeSnapshotInventory

def deleteFailed = true
def deleteSnapshotCalled = 0
def deleteSucVol = []
env.simulator(CephPrimaryStorageBase.DELETE_SNAPSHOT_PATH) { HttpEntity<String> e, EnvSpec spec ->
deleteSnapshotCalled++
def rsp = new CephPrimaryStorageBase.DeleteSnapshotRsp()
if (deleteFailed) {
rsp.setError("it's children in trash, cannot delete")
Expand Down Expand Up @@ -207,6 +209,24 @@ class CephGCCase extends SubCase {
assert volGC.size() == 1
assert volGC[0].status != GCStatus.Done.toString()

def deleteSnapshotCalledBeforeTriggerGC = deleteSnapshotCalled
def spGCBeforeTriggerGC = queryGCJob {
conditions = ["runnerClass=${DeleteVolumeSnapshotGC.class.name}".toString(), "context~=%${sp.primaryStorageInstallPath}%".toString()]
} as List<GarbageCollectorInventory>

triggerGCJob {
uuid = spGC[0].uuid
}
assert deleteSnapshotCalled == deleteSnapshotCalledBeforeTriggerGC + 1
Comment thread
coderabbitai[bot] marked this conversation as resolved.
assert queryGCJob {
conditions = ["runnerClass=${DeleteVolumeSnapshotGC.class.name}".toString(), "context~=%${sp.primaryStorageInstallPath}%".toString()]
}.size() == spGCBeforeTriggerGC.size()
assert !retryInSecs(3) {
queryGCJob {
conditions = ["runnerClass=${DeleteVolumeSnapshotGC.class.name}".toString(), "context~=%${sp.primaryStorageInstallPath}%".toString()]
}[0].status == GCStatus.Done.toString()
}

deleteFailed = false
triggerGCJob {
uuid = spGC[0].uuid
Expand Down