XenserverSnapshotStrategy: check if primary is null before proceeding in backupSnapshot

In backupSnapshot, it checks for snapshot in primary but does not check in advance if
it is null.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2015-06-29 18:34:19 +02:00
parent e50547a3ea
commit ba750293cc
1 changed files with 2 additions and 1 deletions

View File

@ -111,8 +111,9 @@ public class XenserverSnapshotStrategy extends SnapshotStrategyBase {
boolean fullBackup = true;
SnapshotDataStoreVO parentSnapshotOnBackupStore = snapshotStoreDao.findLatestSnapshotForVolume(snapshot.getVolumeId(), DataStoreRole.Image);
SnapshotDataStoreVO parentSnapshotOnPrimaryStore = snapshotStoreDao.findLatestSnapshotForVolume(snapshot.getVolumeId(), DataStoreRole.Primary);
HypervisorType hypervisorType = snapshot.getBaseVolume().getHypervisorType();
if (parentSnapshotOnBackupStore != null && hypervisorType == Hypervisor.HypervisorType.XenServer) { // CS does incremental backup only for XenServer
if (parentSnapshotOnBackupStore != null && parentSnapshotOnPrimaryStore != null && hypervisorType == Hypervisor.HypervisorType.XenServer) { // CS does incremental backup only for XenServer
// In case of volume migration from one pool to other pool, CS should take full snapshot to avoid any issues with delta chain,
// to check if this is a migrated volume, compare the current pool id of volume and store_id of oldest snapshot on primary for this volume.