Skip to content

Commit ec43bfc

Browse files
committed
Fix false positve in coverity, simple rewrite.
1 parent f275f29 commit ec43bfc

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
import javax.inject.Inject;
2626

27+
import org.apache.log4j.Logger;
28+
2729
import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
2830
import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
2931
import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
@@ -49,7 +51,6 @@
4951
import org.apache.cloudstack.storage.to.SnapshotObjectTO;
5052
import org.apache.cloudstack.storage.to.TemplateObjectTO;
5153
import org.apache.cloudstack.storage.volume.VolumeObject;
52-
import org.apache.log4j.Logger;
5354

5455
import com.cloud.agent.api.Answer;
5556
import 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

Comments
 (0)