From 88ff55849d493acbdcbdacc2f712567e5a811e03 Mon Sep 17 00:00:00 2001 From: anthony Date: Mon, 7 Feb 2011 17:48:39 -0800 Subject: [PATCH] for detachISO command, iso for this VM is removed in DB even if the detachISO fails. Then after stop/start VM , the iso for this VM is gone --- .../com/cloud/template/TemplateManagerImpl.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java index 54bedcb8d95..4dea6b7426c 100755 --- a/server/src/com/cloud/template/TemplateManagerImpl.java +++ b/server/src/com/cloud/template/TemplateManagerImpl.java @@ -1185,14 +1185,14 @@ public class TemplateManagerImpl implements TemplateManager, Manager, TemplateSe VMTemplateVO iso = _tmpltDao.findById(isoId); boolean success = _vmMgr.attachISOToVM(vmId, isoId, attach); - if ( success ) { - if (attach) { - vm.setIsoId(iso.getId()); - } else { - vm.setIsoId(null); - } + if ( success && attach) { + vm.setIsoId(iso.getId()); _userVmDao.update(vmId, vm); - } + } + if ( !attach ) { + vm.setIsoId(null); + _userVmDao.update(vmId, vm); + } return success; }