From 29bfde9da41a8a854c3998eb1be75e443615b907 Mon Sep 17 00:00:00 2001 From: alena Date: Fri, 1 Apr 2011 17:53:06 -0700 Subject: [PATCH] Revert "bug 8898: allow service offering upgrade for Running vm" This reverts commit 7668e1878acea6f380e167338248f1f3f8affca0. --- server/src/com/cloud/vm/UserVmManagerImpl.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 266c29cda2f..99f16afc1ca 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -842,10 +842,10 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager throw new InvalidParameterValueException("Unable to find a service offering with id " + serviceOfferingId); } - // Check that the VM is stopped or running - if (!(vmInstance.getState().equals(State.Stopped) || vmInstance.getState().equals(State.Running))) { + // Check that the VM is stopped + if (!vmInstance.getState().equals(State.Stopped)) { s_logger.warn("Unable to upgrade virtual machine " + vmInstance.toString() + " in state " + vmInstance.getState()); - throw new InvalidParameterValueException("Unable to upgrade virtual machine " + vmInstance.toString() + " in state " + vmInstance.getState() + "; make sure the virtual machine is in Stopped or Running state before upgrading."); + throw new InvalidParameterValueException("Unable to upgrade virtual machine " + vmInstance.toString() + " in state " + vmInstance.getState() + "; make sure the virtual machine is stopped and not in an error state before upgrading."); } // Check if the service offering being upgraded to is what the VM is already running with @@ -2527,9 +2527,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager UserVO user = _userDao.findById(userId); try { - if (!_itMgr.advanceStop(vm, forced, user, caller)) { - throw new CloudRuntimeException("Unable to stop vm " + vm); - } + _itMgr.advanceStop(vm, forced, user, caller); } catch (ResourceUnavailableException e) { throw new CloudRuntimeException("Unable to contact the agent to stop the virtual machine " + vm, e); } catch (OperationTimedoutException e) {