Hi,
I noticed while examining the code to take a volume snapshot that
XenserverSnapshotStrategy does the following:
SnapshotVO snapshotVO = snapshotDao
.acquireInLockTable(snapshot.getId());
if (snapshotVO == null) {
throw new CloudRuntimeException("Failed to get lock on
snapshot:" + snapshot.getId());
}
try {
VolumeInfo volumeInfo = snapshot.getBaseVolume();
volumeInfo.stateTransit(Volume.Event.SnapshotRequested);
SnapshotResult result = null;
try {
result = snapshotSvr.takeSnapshot(snapshot);
if (result.isFailed()) {
s_logger.debug("Failed to take snapshot: " +
result.getResult());
throw new CloudRuntimeException(result.getResult());
}
} finally {
if (result != null && result.isSuccess()) {
volumeInfo.stateTransit(Volume.Event.OperationSucceeded
);
} else {
volumeInfo.stateTransit(Volume.Event.OperationFailed);
}
}
Is there a reason here why the code acquires a lock on the snapshot instead
of performing a state transition (say, Allocated to Creating)?
We can see in the same code block that we use a state transition to protect
the volume.
Thanks!
--
*Mike Tutkowski*
*Senior CloudStack Developer, SolidFire Inc.*
e: [email protected]
o: 303.746.7302
Advancing the way the world uses the cloud
<http://solidfire.com/solution/overview/?video=play>*™*