Arik Hadas has uploaded a new change for review. Change subject: temp ......................................................................
temp Change-Id: I395e71d95a2642c4ea652ee6a62f494ea97bf96d 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, 23 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/41/22641/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 b42f6f5..b72ed5f 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 @@ -89,6 +89,7 @@ REMOVE_STATELESS_IMAGES; } + private boolean disksFetched; private Flow cachedFlow; /** Note: this field should not be used directly, use {@link #isVmRunningStateless()} instead */ private Boolean cachedVmIsRunningStateless; @@ -282,6 +283,7 @@ } if (Boolean.TRUE.equals(getParameters().getRunAsStateless())) { + fetchVmDisksFromDb(); if (getVm().getDiskList().isEmpty()) { // If there are no snappable disks, there is no meaning for // running as stateless, log a warning and run normally @@ -378,7 +380,7 @@ getReturnValue().getVdsmTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); // save RunVmParams so we'll know how to run // the stateless VM in the endAction part. - VmHandler.updateDisksFromDb(getVm()); + fetchVmDisksFromDb(true); } else { if (areDisksLocked(vdcReturnValue)) { throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); @@ -566,11 +568,15 @@ } protected void initVm() { + if (getFlow() != Flow.RUN) { + return; + } + // Before running the VM we update its devices, as they may // need to be changed due to configuration option change VmDeviceUtils.updateVmDevices(getVm().getStaticData()); - VmHandler.updateDisksFromDb(getVm()); + fetchVmDisksFromDb(); getVm().setKvmEnable(getParameters().getKvmEnable()); getVm().setRunAndPause(getParameters().getRunAndPause() == null ? getVm().isRunAndPause() : getParameters().getRunAndPause()); getVm().setAcpiEnable(getParameters().getAcpiEnable()); @@ -624,6 +630,21 @@ } } + private void fetchVmDisksFromDb() { + if (disksFetched) { + return; + } + VmHandler.updateDisksFromDb(getVm()); + disksFetched = true; + } + + private void fetchVmDisksFromDb(boolean refresh) { + if (refresh) { + disksFetched = false; + } + fetchVmDisksFromDb(); + } + protected Guid initVds() { Guid selectedVdsId = getFlow() == Flow.RESUME ? getVm().getRunOnVds() : schedule(); initVds(selectedVdsId); -- To view, visit http://gerrit.ovirt.org/22641 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I395e71d95a2642c4ea652ee6a62f494ea97bf96d 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