Arik Hadas has uploaded a new change for review.

Change subject: core: change import vm to be VmCommand - part 2
......................................................................

core: change import vm to be VmCommand - part 2

Inline checkStoragePool method call and moved fillMacAddress method, to
reduce the coupling between ImportVmCommand and
MoveOrCopyTemplateCommand.

Change-Id: Ie7063d22fbe4bd81de24f050660e35b3ea7b96cd
Signed-off-by: Arik Hadas <aha...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyTemplateCommand.java
2 files changed, 9 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/34986/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
index 473e09a..84faa23 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
@@ -256,8 +256,8 @@
             setDescription(getVmName());
         }
 
-        if (!checkStoragePool()) {
-            return false;
+        if (getStoragePool() == null) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST);
         }
 
         Set<Guid> destGuids = new 
HashSet<Guid>(imageToDestinationDomainMap.values());
@@ -1164,6 +1164,13 @@
         iface.setVmId(getVmId());
     }
 
+    protected void fillMacAddressIfMissing(VmNic iface) {
+        if (StringUtils.isEmpty(iface.getMacAddress())
+                && getMacPool().getAvailableMacsCount() > 0) {
+            iface.setMacAddress(getMacPool().allocateNewMac());
+        }
+    }
+
     private void addVmDynamic() {
         VmDynamic tempVar = new VmDynamic();
         tempVar.setId(getVmId());
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyTemplateCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyTemplateCommand.java
index 1759cc3..64678fc 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyTemplateCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MoveOrCopyTemplateCommand.java
@@ -409,13 +409,6 @@
         return permissionCheckSubject;
     }
 
-    protected void fillMacAddressIfMissing(VmNic iface) {
-        if (StringUtils.isEmpty(iface.getMacAddress())
-                && (getMacPool().getAvailableMacsCount() >= 1)) {
-            iface.setMacAddress(getMacPool().allocateNewMac());
-        }
-    }
-
     protected boolean validateMacAddress(List<VmNic> ifaces) {
         int freeMacs = 0;
         for (VmNic iface : ifaces) {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie7063d22fbe4bd81de24f050660e35b3ea7b96cd
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <aha...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to