2424
2525import javax .inject .Inject ;
2626
27+ import org .apache .log4j .Logger ;
28+
2729import org .apache .cloudstack .engine .subsystem .api .storage .ChapInfo ;
2830import org .apache .cloudstack .engine .subsystem .api .storage .CopyCommandResult ;
2931import org .apache .cloudstack .engine .subsystem .api .storage .CreateCmdResult ;
4951import org .apache .cloudstack .storage .to .SnapshotObjectTO ;
5052import org .apache .cloudstack .storage .to .TemplateObjectTO ;
5153import org .apache .cloudstack .storage .volume .VolumeObject ;
52- import org .apache .log4j .Logger ;
5354
5455import com .cloud .agent .api .Answer ;
5556import com .cloud .agent .api .storage .ResizeVolumeAnswer ;
@@ -258,13 +259,11 @@ public void copyAsync(DataObject srcdata, DataObject destData, AsyncCompletionCa
258259 public boolean canCopy (DataObject srcData , DataObject destData ) {
259260 //BUG fix for CLOUDSTACK-4618
260261 DataStore store = destData .getDataStore ();
261- if (store .getRole () == DataStoreRole .Primary ) {
262- if ((srcData .getType () == DataObjectType .TEMPLATE && destData .getType () == DataObjectType .TEMPLATE ) ||
263- (srcData .getType () == DataObjectType .TEMPLATE && destData .getType () == DataObjectType .VOLUME )) {
264- StoragePoolVO storagePoolVO = primaryStoreDao .findById (store .getId ());
265- if (storagePoolVO != null && storagePoolVO .getPoolType () == Storage .StoragePoolType .CLVM ) {
266- return true ;
267- }
262+ if (store .getRole () == DataStoreRole .Primary && srcData .getType () == DataObjectType .TEMPLATE
263+ && (destData .getType () == DataObjectType .TEMPLATE || destData .getType () == DataObjectType .VOLUME )) {
264+ StoragePoolVO storagePoolVO = primaryStoreDao .findById (store .getId ());
265+ if (storagePoolVO != null && storagePoolVO .getPoolType () == Storage .StoragePoolType .CLVM ) {
266+ return true ;
268267 }
269268 }
270269 return false ;
@@ -282,7 +281,7 @@ public void takeSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback<CreateCm
282281 }
283282
284283 CreateObjectCommand cmd = new CreateObjectCommand (snapshotTO );
285- EndPoint ep = this . epSelector .select (snapshot , StorageAction .TAKESNAPSHOT );
284+ EndPoint ep = epSelector .select (snapshot , StorageAction .TAKESNAPSHOT );
286285 Answer answer = null ;
287286
288287 if (ep == null ) {
0 commit comments