Skip to content

Commit 289c8a0

Browse files
author
Likitha Shetty
committed
CLOUDSTACK-5508. Vmware - When there are multiple secondary stores, the newly added secondary store is not being selected for backing up snapshots.
If the snapshot being backed up is a a delta snapshot, pick the image store where the parent snapshot is stored. Otheriwse pick a random image store.
1 parent a9ca480 commit 289c8a0

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,12 @@ public SnapshotResult takeSnapshot(SnapshotInfo snap) {
219219
// the same store as its parent since
220220
// we are taking delta snapshot
221221
private DataStore findSnapshotImageStore(SnapshotInfo snapshot) {
222-
if (snapshot.getParent() == null) {
222+
Boolean fullSnapshot = true;
223+
Object payload = snapshot.getPayload();
224+
if (payload != null) {
225+
fullSnapshot = (Boolean)payload;
226+
}
227+
if (fullSnapshot) {
223228
return dataStoreMgr.getImageStore(snapshot.getDataCenterId());
224229
} else {
225230
SnapshotInfo parentSnapshot = snapshot.getParent();

engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
import org.springframework.stereotype.Component;
4141

4242
import com.cloud.exception.InvalidParameterValueException;
43+
import com.cloud.hypervisor.Hypervisor;
44+
import com.cloud.hypervisor.Hypervisor.HypervisorType;
4345
import com.cloud.storage.CreateSnapshotPayload;
4446
import com.cloud.storage.DataStoreRole;
4547
import com.cloud.storage.Snapshot;
@@ -108,7 +110,8 @@ public SnapshotInfo backupSnapshot(SnapshotInfo snapshot) {
108110

109111
boolean fullBackup = true;
110112
SnapshotDataStoreVO parentSnapshotOnBackupStore = snapshotStoreDao.findLatestSnapshotForVolume(snapshot.getVolumeId(), DataStoreRole.Image);
111-
if (parentSnapshotOnBackupStore != null) {
113+
HypervisorType hypervisorType = snapshot.getBaseVolume().getHypervisorType();
114+
if (parentSnapshotOnBackupStore != null && hypervisorType == Hypervisor.HypervisorType.XenServer) { // CS does incremental backup only for XenServer
112115
int _deltaSnapshotMax = NumbersUtil.parseInt(configDao.getValue("snapshot.delta.max"),
113116
SnapshotManager.DELTAMAX);
114117
int deltaSnap = _deltaSnapshotMax;

0 commit comments

Comments
 (0)