VmdkInfo vmdkInfo,
boolean isSan)
{
boolean ret = false;
ProfileGeneration profGen = vmArcMgr.getTargetGeneration();
int diskId = profGen.getDiskIdWithUuid(vmdkInfo.uuid_);
/* Check available backup mode. */
boolean isDiff = vmArcMgr.canExecDiffBackup(vmdkInfo.uuid_);
boolean isInc = vmArcMgr.canExecIncrBackup(vmdkInfo.uuid_);
profGen.setIsChanged(diskId, true);
/* Get changed block info and save if required. */
if (isInc) {
/* profGen.setIsChange(diskId, false)
may be called inside it. */
isInc = getAndSaveChangedBlocksOfDisk
(snap, vmArcMgr, vmdkInfo, diskId);
}
/* Dump archives with vmdkbkp tool. */
BackupMode mode = BackupMode.FULL;
if (isInc) { mode = BackupMode.INCR; }
else if (isDiff) { mode = BackupMode.DIFF; }
else { mode = BackupMode.FULL; }
profGen.setBackupMode(diskId, mode);
logger_.info("isInc: " + isInc +
" isDiff: " + isDiff +
" mode: " + mode.toString()); /* debug */
profGen.setDumpBeginTimestamp(diskId);
if (mode == BackupMode.INCR &&
profGen.isChanged(diskId) == false) {
logger_.info("The vmdk is not changed at all.");
vmArcMgr.registerLazyTaskMovePrevDumpAndDigest(diskId);
ret = true;
} else {
/* Soap connection is not required during running vmdkbkp.
It may take a long time and soap timeout will occur,
therefore we disconnect and re-connect
after vmdkbkp has done.
VirtualMachineManger and SnapshotManager must be reload. */
gm_.disconnect();
ret = VmdkBkp.doDump
(mode, vmm.getMoref(), vmArcMgr, diskId, isSan);
}
profGen.setDumpEndTimestamp(diskId);
profGen.setVmdkdumpResult(diskId, ret);
if (profGen.isVmdkdumpSucceeded(diskId) &&
(mode == BackupMode.DIFF ||
(mode == BackupMode.INCR && profGen.isChanged(diskId)))) {
vmArcMgr.registerLazyTaskDelPrevDump(diskId);
}
return ret;