Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
7d638fc
KVM incremental snapshot feature
JoaoJandre Jun 17, 2024
47ab0c2
fix log
JoaoJandre Jun 19, 2024
f57b1aa
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Jun 25, 2024
6f41337
fix merge issues
JoaoJandre Jun 25, 2024
717d330
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Jul 1, 2024
6024631
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Jul 11, 2024
5b37591
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Jul 15, 2024
00d87c2
fix creation of folder
JoaoJandre Jul 23, 2024
63251da
fix snapshot update
JoaoJandre Jul 23, 2024
2baf1ed
Check for hypervisor type during parent search
JoaoJandre Jul 25, 2024
e54629d
fix some small bugs
JoaoJandre Jul 26, 2024
6125dd9
fix tests
JoaoJandre Jul 29, 2024
b10fee7
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Aug 7, 2024
0871a06
Address reviews
JoaoJandre Aug 16, 2024
fb7ff52
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Aug 21, 2024
be6b257
do not remove storPool snapshots
JoaoJandre Aug 22, 2024
2b9b2d3
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Aug 22, 2024
b088e71
add support for downloading diff snaps
JoaoJandre Aug 26, 2024
cdb11c1
Add multiple zones support
JoaoJandre Aug 27, 2024
bc8282e
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Aug 27, 2024
52697b3
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Aug 28, 2024
8982356
make copied snapshots have normal names
JoaoJandre Aug 28, 2024
eeaa85c
address reviews
JoaoJandre Sep 2, 2024
3a48f1f
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Sep 6, 2024
dff1f6d
Fix in progress
JoaoJandre Sep 10, 2024
8e26579
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Oct 18, 2024
b8b6b8c
continue fix
JoaoJandre Oct 18, 2024
3dd52c6
Fix bulk delete
JoaoJandre Oct 29, 2024
89cc8b4
change log to trace
JoaoJandre Oct 29, 2024
e3443c8
Start fix on multiple secondary storages for a single zone
JoaoJandre Nov 4, 2024
885d2a4
Fix multiple secondary storages for a single zone
JoaoJandre Nov 7, 2024
1d5eebb
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Nov 7, 2024
59dc3e7
Fix tests
JoaoJandre Nov 8, 2024
a46e6b9
fix log
JoaoJandre Nov 12, 2024
8114bac
remove bitmaps when deleting snapshots
JoaoJandre Nov 14, 2024
e63fb7a
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Nov 14, 2024
91f09c8
minor fixes
JoaoJandre Nov 28, 2024
77b034c
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Dec 5, 2024
3d657f1
update sql to new file
JoaoJandre Dec 5, 2024
c026486
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Dec 10, 2024
e951d15
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Jan 30, 2025
afab72f
Fix merge issues
JoaoJandre Jan 31, 2025
1d849d4
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Feb 3, 2025
e2bd617
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Feb 7, 2025
02fcce4
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Feb 13, 2025
add5395
Create new snap chain when changing configuration
Feb 10, 2025
7d2e48a
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Feb 28, 2025
878350e
add verification
Mar 10, 2025
7373a5c
Fix snapshot operation selector
Mar 10, 2025
4e6cacd
fix bitmap removal
Mar 11, 2025
3a9ebbf
fix chain on different storages
Mar 18, 2025
68d15b4
address reviews
JoaoJandre Mar 27, 2025
1766990
fix small issue
JoaoJandre Apr 8, 2025
1940c17
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre Apr 15, 2025
f7095c3
Merge remote-tracking branch 'origin' into differential-snapshots
JoaoJandre Apr 28, 2025
e94280f
fix test
JoaoJandre Apr 28, 2025
51d5f65
Merge remote-tracking branch 'origin/main' into differential-snapshots
JoaoJandre May 5, 2025
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
Prev Previous commit
Next Next commit
Fix in progress
  • Loading branch information
JoaoJandre committed Sep 10, 2024
commit dff1f6dbf5cd3c1538f08eba1328a6475bc93aed
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public interface SnapshotDataStoreDao extends GenericDao<SnapshotDataStoreVO, Lo

List<SnapshotDataStoreVO> listReadyByVolumeIdAndCheckpointPathNotNull(long volumeId);

SnapshotDataStoreVO findOneBySnapshotId(long snapshotId);
SnapshotDataStoreVO findOneBySnapshotId(long snapshotId, long zoneId);

List<SnapshotDataStoreVO> listBySnapshotId(long snapshotId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
private static final String KVM_CHECKPOINT_PATH = "kvm_checkpoint_path";
private static final String URL_CREATED_BEFORE = "url_created_before";
public static final String DOWNLOAD_URL = "downloadUrl";
public static final String DATA_CENTER_ID = "data_center_id";

private SearchBuilder<SnapshotDataStoreVO> searchFilteringStoreIdEqStoreRoleEqStateNeqRefCntNeq;
protected SearchBuilder<SnapshotDataStoreVO> searchFilteringStoreIdEqStateEqStoreRoleEqIdEqUpdateCountEqSnapshotIdEqVolumeIdEq;
Expand All @@ -85,6 +86,10 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
" order by created %s " +
" limit 1";

private static final String FIND_SNAPSHOT_IN_ZONE = "SELECT ssr.* FROM " +
"snapshot_store_ref ssr, snapshots s " +
"WHERE ssr.snapshot_id=? AND ssr.snapshot_id = s.id AND s.data_center_id=?;";

@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
super.configure(name, params);
Expand Down Expand Up @@ -342,10 +347,22 @@ public SnapshotDataStoreVO findBySnapshotIdAndDataStoreRoleAndState(long snapsho
}

@Override
public SnapshotDataStoreVO findOneBySnapshotId(long snapshotId) {
SearchCriteria<SnapshotDataStoreVO> sc = searchFilteringStoreIdEqStateEqStoreRoleEqIdEqUpdateCountEqSnapshotIdEqVolumeIdEq.create();
sc.setParameters(SNAPSHOT_ID, snapshotId);
return findOneBy(sc);
public SnapshotDataStoreVO findOneBySnapshotId(long snapshotId, long zoneId) {
try (TransactionLegacy transactionLegacy = TransactionLegacy.currentTxn()) {
try (PreparedStatement preparedStatement = transactionLegacy.prepareStatement(FIND_SNAPSHOT_IN_ZONE)) {
preparedStatement.setLong(1, snapshotId);
preparedStatement.setLong(2, zoneId);

try (ResultSet resultSet = preparedStatement.executeQuery()) {
if (resultSet.next()) {
return toEntityBean(resultSet, false);
}
}
}
} catch (SQLException e) {
logger.warn(String.format("Failed to find %s snapshot in zone %s due to [%s].", snapshotId, zoneId, e.getMessage()), e);
}
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import com.cloud.agent.api.to.DataStoreTO;

import com.cloud.agent.api.to.NfsTO;
import com.cloud.agent.properties.AgentProperties;
import com.cloud.agent.properties.AgentPropertiesFileHandler;
import com.cloud.hypervisor.kvm.resource.LibvirtComputingResource;
import com.cloud.hypervisor.kvm.storage.KVMStoragePool;
import com.cloud.resource.CommandWrapper;
Expand Down Expand Up @@ -65,7 +67,7 @@ public Answer execute(ConvertSnapshotCommand command, LibvirtComputingResource s

logger.debug(String.format("Converting snapshot [%s] to [%s]. The original snapshot is at [%s].", snapshotObjectTO.getId(), tempSnapshotPath, snapshotPath));

QemuImg qemuImg = new QemuImg(command.getWait());
QemuImg qemuImg = new QemuImg(AgentPropertiesFileHandler.getPropertyValue(AgentProperties.INCREMENTAL_SNAPSHOT_TIMEOUT));

QemuImgFile snapshot = new QemuImgFile(snapshotPath, QemuImg.PhysicalDiskFormat.QCOW2);
QemuImgFile tempSnapshot = new QemuImgFile(tempSnapshotPath, QemuImg.PhysicalDiskFormat.QCOW2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -740,15 +740,15 @@ private void postCreateSnapshot(Long volumeId, Long snapshotId, Long policyId, L
}

if (HypervisorType.KVM.equals(snapshot.getHypervisorType()) && kvmIncrementalSnapshot.valueIn(clusterId)) {
endChainIfNeeded(snapshotId);
endChainIfNeeded(snapshotId, snapshot.getDataCenterId());
}
}

private void endChainIfNeeded(Long snapshotId) {
SnapshotDataStoreVO snapshotDataStoreVo = _snapshotStoreDao.findOneBySnapshotId(snapshotId);
private void endChainIfNeeded(Long snapshotId, Long zoneId) {
SnapshotDataStoreVO snapshotDataStoreVo = _snapshotStoreDao.findOneBySnapshotId(snapshotId, zoneId);
int chainSize = 1;
while (snapshotDataStoreVo.getParentSnapshotId() > 0) {
snapshotDataStoreVo = _snapshotStoreDao.findOneBySnapshotId(snapshotDataStoreVo.getParentSnapshotId());
snapshotDataStoreVo = _snapshotStoreDao.findOneBySnapshotId(snapshotDataStoreVo.getParentSnapshotId(), zoneId);
chainSize++;
}
if (chainSize >= snapshotDeltaMax.value()) {
Expand Down