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
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,16 @@ public Property<Integer> getWorkers() {
*/
public static final Property<String> HOST_TAGS = new Property<>("host.tags", null, String.class);

/**
* Timeout (in seconds) to wait for the incremental snapshot to complete.
* */
public static final Property<Integer> INCREMENTAL_SNAPSHOT_TIMEOUT = new Property<>("incremental.snapshot.timeout", 10800);

/**
* Timeout (in seconds) to wait for the snapshot reversion to complete.
* */
public static final Property<Integer> REVERT_SNAPSHOT_TIMEOUT = new Property<>("revert.snapshot.timeout", 10800);

public static class Property <T>{
private String name;
private T defaultValue;
Expand Down
36 changes: 36 additions & 0 deletions core/src/main/java/com/cloud/agent/api/ConvertSnapshotAnswer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package com.cloud.agent.api;

import org.apache.cloudstack.storage.to.SnapshotObjectTO;

public class ConvertSnapshotAnswer extends Answer {

private SnapshotObjectTO snapshotObjectTO;

public ConvertSnapshotAnswer(SnapshotObjectTO snapshotObjectTO) {
super(null);
this.snapshotObjectTO = snapshotObjectTO;
}

public SnapshotObjectTO getSnapshotObjectTO() {
return snapshotObjectTO;
}
}
42 changes: 42 additions & 0 deletions core/src/main/java/com/cloud/agent/api/ConvertSnapshotCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package com.cloud.agent.api;

import org.apache.cloudstack.storage.to.SnapshotObjectTO;

public class ConvertSnapshotCommand extends Command {

public static final String TEMP_SNAPSHOT_NAME = "_temp";

SnapshotObjectTO snapshotObjectTO;

public SnapshotObjectTO getSnapshotObjectTO() {
return snapshotObjectTO;
}

public ConvertSnapshotCommand(SnapshotObjectTO snapshotObjectTO) {
this.snapshotObjectTO = snapshotObjectTO;
}

@Override
public boolean executeInSequence() {
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//

package com.cloud.agent.api;

import org.apache.cloudstack.storage.to.VolumeObjectTO;

import java.util.List;

public class RecreateCheckpointsCommand extends Command {

private List<VolumeObjectTO> volumes;

private String vmName;

public RecreateCheckpointsCommand(List<VolumeObjectTO> volumes, String vmName) {
this.volumes = volumes;
this.vmName = vmName;
}

public List<VolumeObjectTO> getDisks() {
return volumes;
}

public String getVmName() {
return vmName;
}

@Override
public boolean executeInSequence() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ protected Answer execute(CreateObjectCommand cmd) {
}
return new CreateObjectAnswer("not supported type");
} catch (Exception e) {
logger.debug("Failed to create object: " + data.getObjectType() + ": " + e.toString());
logger.error(String.format("Failed to create object [%s] due to [%s].", data.getObjectType(), e), e);
return new CreateObjectAnswer(e.toString());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public final class TemplateConstants {
public static final String DEFAULT_SNAPSHOT_ROOT_DIR = "snapshots";
public static final String DEFAULT_VOLUME_ROOT_DIR = "volumes";
public static final String DEFAULT_TMPLT_FIRST_LEVEL_DIR = "tmpl/";

public static final String DEFAULT_CHECKPOINT_ROOT_DIR = "checkpoints";
public static final String DEFAULT_SYSTEM_VM_TEMPLATE_PATH = "template/tmpl/1/";

public static final int DEFAULT_TMPLT_COPY_PORT = 80;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ public class SnapshotObjectTO extends DownloadableObjectTO implements DataTO {
private VolumeObjectTO volume;
private String parentSnapshotPath;
private DataStoreTO dataStore;
private DataStoreTO imageStore;
private boolean kvmIncrementalSnapshot = false;
private String vmName;
private String name;
private HypervisorType hypervisorType;
private long id;
private boolean quiescevm;
private String[] parents;
private String checkpointPath;
private Long physicalSize = (long) 0;
private long accountId;

Expand All @@ -59,22 +62,28 @@ public SnapshotObjectTO(SnapshotInfo snapshot) {
this.setVmName(vol.getAttachedVmName());
}

SnapshotInfo parentSnapshot = snapshot.getParent();
ArrayList<String> parentsArry = new ArrayList<String>();
if (parentSnapshot != null) {
this.parentSnapshotPath = parentSnapshot.getPath();
while(parentSnapshot != null) {
parentsArry.add(parentSnapshot.getPath());
parentSnapshot = parentSnapshot.getParent();
}
parents = parentsArry.toArray(new String[parentsArry.size()]);
ArrayUtils.reverse(parents);
}

this.dataStore = snapshot.getDataStore().getTO();
this.setName(snapshot.getName());
this.hypervisorType = snapshot.getHypervisorType();
this.quiescevm = false;

this.checkpointPath = snapshot.getCheckpointPath();
this.kvmIncrementalSnapshot = snapshot.isKvmIncrementalSnapshot();

SnapshotInfo parentSnapshot = snapshot.getParent();

if (parentSnapshot == null || (HypervisorType.KVM.equals(snapshot.getHypervisorType()) && !parentSnapshot.isKvmIncrementalSnapshot())) {
return;
}

ArrayList<String> parentsArray = new ArrayList<>();
this.parentSnapshotPath = parentSnapshot.getPath();
while (parentSnapshot != null) {
parentsArray.add(parentSnapshot.getPath());
parentSnapshot = parentSnapshot.getParent();
}
parents = parentsArray.toArray(new String[parentsArray.size()]);
ArrayUtils.reverse(parents);
}

@Override
Expand All @@ -91,6 +100,30 @@ public void setDataStore(DataStoreTO store) {
this.dataStore = store;
}

public DataStoreTO getImageStore() {
return imageStore;
}

public void setImageStore(DataStoreTO imageStore) {
this.imageStore = imageStore;
}

public boolean isKvmIncrementalSnapshot() {
return kvmIncrementalSnapshot;
}

public void setKvmIncrementalSnapshot(boolean kvmIncrementalSnapshot) {
this.kvmIncrementalSnapshot = kvmIncrementalSnapshot;
}

public String getCheckpointPath() {
return checkpointPath;
}

public void setCheckpointPath(String checkpointPath) {
this.checkpointPath = checkpointPath;
}

@Override
public String getPath() {
return this.path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import com.cloud.storage.Volume;

import java.util.Arrays;
import java.util.List;
import java.util.Set;

public class VolumeObjectTO extends DownloadableObjectTO implements DataTO {
private String uuid;
Expand Down Expand Up @@ -75,6 +77,8 @@ public class VolumeObjectTO extends DownloadableObjectTO implements DataTO {
@LogLevel(LogLevel.Log4jLevel.Off)
private byte[] passphrase;
private String encryptFormat;
private List<String> checkpointPaths;
private Set<String> checkpointImageStoreUrls;

public VolumeObjectTO() {

Expand Down Expand Up @@ -394,4 +398,21 @@ public void clearPassphrase() {
public boolean requiresEncryption() {
return passphrase != null && passphrase.length > 0;
}


public List<String> getCheckpointPaths() {
return checkpointPaths;
}

public void setCheckpointPaths(List<String> checkpointPaths) {
this.checkpointPaths = checkpointPaths;
}

public Set<String> getCheckpointImageStoreUrls() {
return checkpointImageStoreUrls;
}

public void setCheckpointImageStoreUrls(Set<String> checkpointImageStoreUrls) {
this.checkpointImageStoreUrls = checkpointImageStoreUrls;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Set;

import com.cloud.exception.ResourceAllocationException;
import com.cloud.utils.Pair;
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
Expand Down Expand Up @@ -179,4 +180,9 @@ DiskProfile updateImportedVolume(Type type, DiskOffering offering, VirtualMachin
* Unmanage VM volumes
*/
void unmanageVolumes(long vmId);

/**
* Retrieves the volume's checkpoints paths to be used in the KVM processor. If there are no checkpoints, it will return an empty list.
*/
Pair<List<String>, Set<String>> getVolumeCheckpointPathsAndImageStoreUrls(long volumeId, HypervisorType hypervisorType);
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public interface SnapshotInfo extends DataObject, Snapshot {

String getPath();

DataStore getImageStore();

void setImageStore(DataStore imageStore);

SnapshotInfo getChild();

List<SnapshotInfo> getChildren();
Expand All @@ -56,6 +60,14 @@ public interface SnapshotInfo extends DataObject, Snapshot {

void markBackedUp() throws CloudRuntimeException;

String getCheckpointPath();

void setCheckpointPath(String checkpointPath);

void setKvmIncrementalSnapshot(boolean isKvmIncrementalSnapshot);

boolean isKvmIncrementalSnapshot();

Snapshot getSnapshotVO();

long getAccountId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@
public interface SnapshotService {
SnapshotResult takeSnapshot(SnapshotInfo snapshot);

DataStore findSnapshotImageStore(SnapshotInfo snapshot);

SnapshotInfo backupSnapshot(SnapshotInfo snapshot);

SnapshotInfo convertSnapshot(SnapshotInfo snapshotInfo);

boolean deleteSnapshot(SnapshotInfo snapshot);

boolean revertSnapshot(SnapshotInfo snapshot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public enum StorageAction {
TAKESNAPSHOT,
BACKUPSNAPSHOT,
DELETESNAPSHOT,
CONVERTSNAPSHOT,
MIGRATEVOLUME,
DELETEVOLUME
}
Loading