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 b544669a84
commit e659751a8a
2 changed files with 10 additions and 2 deletions

View File

@ -216,7 +216,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

@ -39,6 +39,8 @@ import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
import org.apache.cloudstack.storage.to.SnapshotObjectTO;
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;
@ -106,7 +108,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;