Allon Mureinik has uploaded a new change for review.

Change subject: core: UpdateVmDiskCommand: remove DbFacade calls
......................................................................

core: UpdateVmDiskCommand: remove DbFacade calls

Replaced DbFacade.getXXXDao() calls with getXXDao() calls for better
readability and testability.

Relates-To: https://bugzilla.redhat.com/854964
Change-Id: Id31bc1234ed109f9cb1ae658572b4b2e67c6f6ee
Signed-off-by: Allon Mureinik <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AbstractDiskVmCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java
2 files changed, 7 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/88/12888/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AbstractDiskVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AbstractDiskVmCommand.java
index 0e48e19..73b3a6c 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AbstractDiskVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AbstractDiskVmCommand.java
@@ -10,16 +10,16 @@
 import org.ovirt.engine.core.common.action.VmDiskOperationParameterBase;
 import org.ovirt.engine.core.common.businessentities.Disk;
 import org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType;
-import 
org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface;
 import org.ovirt.engine.core.common.businessentities.DiskInterface;
 import org.ovirt.engine.core.common.businessentities.LUNs;
 import org.ovirt.engine.core.common.businessentities.LunDisk;
+import org.ovirt.engine.core.common.businessentities.StorageServerConnections;
 import org.ovirt.engine.core.common.businessentities.StorageType;
 import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.businessentities.VMStatus;
 import org.ovirt.engine.core.common.businessentities.VmDevice;
 import org.ovirt.engine.core.common.businessentities.VolumeFormat;
-import org.ovirt.engine.core.common.businessentities.StorageServerConnections;
+import 
org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface;
 import org.ovirt.engine.core.common.config.Config;
 import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.common.errors.VdcBLLException;
@@ -30,7 +30,7 @@
 import org.ovirt.engine.core.dal.VdcBllMessages;
 import org.ovirt.engine.core.dal.dbbroker.auditloghandling.CustomLogField;
 import org.ovirt.engine.core.dal.dbbroker.auditloghandling.CustomLogFields;
-import org.ovirt.engine.core.dao.DiskDao;
+import org.ovirt.engine.core.dao.BaseDiskDao;
 import org.ovirt.engine.core.dao.ImageDao;
 import org.ovirt.engine.core.dao.SnapshotDao;
 import org.ovirt.engine.core.dao.StoragePoolIsoMapDAO;
@@ -189,8 +189,8 @@
         return getDbFacade().getImageDao();
     }
 
-    protected DiskDao getDiskDao() {
-        return getDbFacade().getDiskDao();
+    protected BaseDiskDao getBaseDiskDao() {
+        return getDbFacade().getBaseDiskDao();
     }
 
     protected SnapshotDao getSnapshotDao() {
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java
index b047262..5de04f5 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java
@@ -108,8 +108,7 @@
 
     private boolean checkCanPerformRegularUpdate() {
         if (oldDisk.getDiskInterface() != newDisk.getDiskInterface()) {
-            List<VmNetworkInterface> allVmInterfaces = DbFacade.getInstance()
-                    .getVmNetworkInterfaceDao().getAllForVm(getVmId());
+            List<VmNetworkInterface> allVmInterfaces = 
getVmNetworkInterfaceDao().getAllForVm(getVmId());
 
             List<Disk> allVmDisks = new LinkedList<Disk>(getOtherVmDisks());
             allVmDisks.add(newDisk);
@@ -203,8 +202,7 @@
             }
 
             // If disk is not floating, then update its vm snapshot id to the 
active VM snapshot.
-            ((DiskImage) oldDisk).setVmSnapshotId(DbFacade.getInstance()
-                    .getSnapshotDao()
+            ((DiskImage) oldDisk).setVmSnapshotId(getSnapshotDao()
                     .getId(getVmId(), SnapshotType.ACTIVE)
                     .getValue());
 


--
To view, visit http://gerrit.ovirt.org/12888
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id31bc1234ed109f9cb1ae658572b4b2e67c6f6ee
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to