Source:
<code>private void statelessVmTreatment() { warnIfNotAllDisksPermitSnapshots(); <START> if (statelessSnapshotExistsForVm() && !isVMPartOfManualPool(getVmId())) { <END> log.errorFormat( "RunVmAsStateless - {0} - found existing vm images in stateless_vm_image_map table - skipped creating snapshots.", getVm().getName()); removeVmStatlessImages(); } else { log.infoFormat("VdcBll.RunVmCommand.RunVmAsStateless - Creating snapshot for stateless vm {0} - {1}", getVm().getName(), getVm().getId()); CreateAllSnapshotsFromVmParameters createAllSnapshotsFromVmParameters = buildCreateSnapshotParameters(); Map<String, String> values = getVmValuesForMsgResolving(); Step createSnapshotsStep = addSubStep(StepEnum.EXECUTING, StepEnum.CREATING_SNAPSHOTS, values); ExecutionContext createSnapshotsCtx = new ExecutionContext(); createSnapshotsCtx.setMonitored(true); createSnapshotsCtx.setStep(createSnapshotsStep); VdcReturnValueBase vdcReturnValue = getBackend().runInternalAction(VdcActionType.CreateAllSnapshotsFromVm, createAllSnapshotsFromVmParameters, new CommandContext(createSnapshotsCtx, getCompensationContext(), getLock())); setLock(null); setSucceeded(vdcReturnValue.getSucceeded()); if (vdcReturnValue.getSucceeded()) { getReturnValue().getTaskIdList().addAll(vdcReturnValue.getInternalTaskIdList()); VmHandler.updateDisksFromDb(getVm()); } else { if (areDisksLocked(vdcReturnValue)) { throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } getReturnValue().setFault(vdcReturnValue.getFault()); log.errorFormat("RunVmAsStateless - {0} - failed to create snapshots", getVm().getName()); } } }</code><technical_language>this is good: if i vm manual pool i run it: time - statelessSnapshotExistsForVm() false else create snapshot. time - statelessSnapshotExistsForVm() true isVMPartOfManualPool(getVmId()) true else create another snapshot? in this case need run, no</technical_language>

Target:
private void statelessVmTreatment() { warnIfNotAllDisksPermitSnapshots(); if (statelessSnapshotExistsForVm()) { log.errorFormat( "RunVmAsStateless - {0} - found existing vm images in stateless_vm_image_map table - skipped creating snapshots.", getVm().getName()); removeVmStatlessImages(); } else { log.infoFormat("VdcBll.RunVmCommand.RunVmAsStateless - Creating snapshot for stateless vm {0} - {1}", getVm().getName(), getVm().getId()); CreateAllSnapshotsFromVmParameters createAllSnapshotsFromVmParameters = buildCreateSnapshotParameters(); Map<String, String> values = getVmValuesForMsgResolving(); Step createSnapshotsStep = addSubStep(StepEnum.EXECUTING, StepEnum.CREATING_SNAPSHOTS, values); ExecutionContext createSnapshotsCtx = new ExecutionContext(); createSnapshotsCtx.setMonitored(true); createSnapshotsCtx.setStep(createSnapshotsStep); VdcReturnValueBase vdcReturnValue = getBackend().runInternalAction(VdcActionType.CreateAllSnapshotsFromVm, createAllSnapshotsFromVmParameters, new CommandContext(createSnapshotsCtx, getCompensationContext(), getLock())); setLock(null); setSucceeded(vdcReturnValue.getSucceeded()); if (vdcReturnValue.getSucceeded()) { getReturnValue().getTaskIdList().addAll(vdcReturnValue.getInternalTaskIdList()); VmHandler.updateDisksFromDb(getVm()); } else { if (areDisksLocked(vdcReturnValue)) { throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } getReturnValue().setFault(vdcReturnValue.getFault()); log.errorFormat("RunVmAsStateless - {0} - failed to create snapshots", getVm().getName()); } } }