Hey Mike,
State transition shouldn¹t be used for serialization. Our job framework
should do the same. If not, then its a bug.
Also, in this case locking on snapshot doesn't help, shouldn¹t it be on
the volume ?

Thanks,
-Nitin

On 13/01/15 12:34 PM, "Mike Tutkowski" <mike.tutkow...@solidfire.com>
wrote:

>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: mike.tutkow...@solidfire.com
>o: 303.746.7302
>Advancing the way the world uses the cloud
><http://solidfire.com/solution/overview/?video=play>**

Reply via email to