Arik Hadas has uploaded a new change for review.

Change subject: core: prevent running VM with cd defined without iso domain
......................................................................

core: prevent running VM with cd defined without iso domain

Change-Id: Idad3c5b812ce4744d3d610341e76af4c24ce0bae
Signed-off-by: Arik Hadas <aha...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
1 file changed, 7 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/47/17747/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
index 73d1224..ba1f41d 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
@@ -218,7 +218,6 @@
             try {
                 VmHandler.UpdateVmGuestAgentVersion(getVm());
                 incrementVdsPendingVmsCount();
-                attachCd();
                 if (connectLunDisks(getVdsId())) {
                     status = createVm();
                     ExecutionHandler.setAsyncJob(getExecutionContext(), true);
@@ -300,18 +299,6 @@
 
     private boolean isStatelessSnapshotExistsForVm() {
         return getSnapshotDao().exists(getVm().getId(), 
SnapshotType.STATELESS);
-    }
-
-    private void attachCd() {
-        // if iso domain found
-        if 
(getIsoDomainListSyncronizer().findActiveISODomain(getVm().getStoragePoolId()) 
!= null) {
-            getVm().setCdPath(cdPathWindowsToLinux(chooseCd()));
-        }
-        else if (!StringUtils.isEmpty(getVm().getIsoPath())) {
-            getVm().setCdPath("");
-            setSucceeded(false);
-            throw new 
VdcBLLException(VdcBllErrors.NO_ACTIVE_ISO_DOMAIN_IN_DATA_CENTER);
-        }
     }
 
     /**
@@ -455,6 +442,8 @@
         refreshBootParameters(getParameters());
 
         getVm().setLastStartTime(new Date());
+
+        getVm().setCdPath(cdPathWindowsToLinux(chooseCd()));
 
         if (!StringUtils.isEmpty(getParameters().getFloppyPath())) {
             
getVm().setFloppyPath(cdPathWindowsToLinux(getParameters().getFloppyPath()));
@@ -787,6 +776,11 @@
             getVm().setVmPayload(getParameters().getVmPayload());
         }
 
+        if 
(getIsoDomainListSyncronizer().findActiveISODomain(getVm().getStoragePoolId()) 
!= null
+                && !StringUtils.isEmpty(getVm().getIsoPath())) {
+            return 
failCanDoAction(VdcBllMessages.VM_CANNOT_RUN_FROM_CD_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO);
+        }
+
         return true;
     }
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idad3c5b812ce4744d3d610341e76af4c24ce0bae
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