cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nitin Mehta <Nitin.Me...@citrix.com>
Subject Re: [QUESTION] Locking versus State Transitioning
Date Tue, 13 Jan 2015 21:21:45 GMT
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.tutkowski@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.tutkowski@solidfire.com
>o: 303.746.7302
>Advancing the way the world uses the cloud
><http://solidfire.com/solution/overview/?video=play>**


Mime
View raw message