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.
This commit is contained in:
Likitha Shetty 2013-12-24 17:22:45 +05:30
parent a9ca480354
commit 289c8a09ea
2 changed files with 10 additions and 2 deletions

View File

@ -219,7 +219,12 @@ public class SnapshotServiceImpl implements SnapshotService {
// the same store as its parent since
// we are taking delta snapshot
private DataStore findSnapshotImageStore(SnapshotInfo snapshot) {
if (snapshot.getParent() == null) {
Boolean fullSnapshot = true;
Object payload = snapshot.getPayload();
if (payload != null) {
fullSnapshot = (Boolean)payload;
}
if (fullSnapshot) {
return dataStoreMgr.getImageStore(snapshot.getDataCenterId());
} else {
SnapshotInfo parentSnapshot = snapshot.getParent();

View File

@ -40,6 +40,8 @@ import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.hypervisor.Hypervisor;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.CreateSnapshotPayload;
import com.cloud.storage.DataStoreRole;
import com.cloud.storage.Snapshot;
@ -108,7 +110,8 @@ public class XenserverSnapshotStrategy extends SnapshotStrategyBase {
boolean fullBackup = true;
SnapshotDataStoreVO parentSnapshotOnBackupStore = snapshotStoreDao.findLatestSnapshotForVolume(snapshot.getVolumeId(), DataStoreRole.Image);
if (parentSnapshotOnBackupStore != null) {
HypervisorType hypervisorType = snapshot.getBaseVolume().getHypervisorType();
if (parentSnapshotOnBackupStore != null && hypervisorType == Hypervisor.HypervisorType.XenServer) { // CS does incremental backup only for XenServer
int _deltaSnapshotMax = NumbersUtil.parseInt(configDao.getValue("snapshot.delta.max"),
SnapshotManager.DELTAMAX);
int deltaSnap = _deltaSnapshotMax;