VmdkBitmap bmp = new VmdkBitmap(capacityInBytes, 1024 * 1024);
boolean isNotChangedAtAll = false;
try {
long offset = 0;
DiskChangeInfo dci = null;
do {
dci = vm.queryChangedDiskAreas
(vmSnap, vmdkInfo.key_, offset, baseChangeId);
if (offset == 0 && (dci.changedArea == null)) {
/*
ChangeId is not null and DiskChangeInfo.changedArea is null,
then the disk is not changed at all.
*/
isNotChangedAtAll = true;
logger_.info("This vmdk is not changed at all " +
"from previous backup.");
break;
}
for (int j = 0; j < dci.changedArea.length; j ++) {
long start = dci.getChangedArea()[j].getStart();
long len = dci.getChangedArea()[j].getLength();
logger_.info
(String.format
("(%d,%d) %s \n", start, len,
(len % 1048576 == 0 ? "" : "not x MB")));
bmp.setRangeInBytes(start, len);
}
logger_.info
(String.format
("offset %d, length %d\n",
dci.getStartOffset(), dci.getLength()));
offset = dci.getStartOffset() + dci.getLength();
} while (offset < capacityInBytes);
} catch (Exception e) {
logger_.warning(Utility.toString(e));
return null;