You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/07/28 16:04:39 UTC
[27/50] git commit: updated refs/heads/4.4 to d5220a8
CLOUDSTACK-6919: don't attempt to restart user vms having no Root volume attached
(cherry picked from commit 146867eb071bae6334bb7b902a4c9319c33b5a1f)
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/388af6c3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/388af6c3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/388af6c3
Branch: refs/heads/4.4
Commit: 388af6c3491a28859c1f66e88e349de889bd23db
Parents: b85efa6
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Mon Jun 16 14:57:02 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 16:02:36 2014 +0200
----------------------------------------------------------------------
.../cloud/storage/StoragePoolAutomationImpl.java | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/388af6c3/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StoragePoolAutomationImpl.java b/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
index 8becd75..8ff759d 100644
--- a/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
+++ b/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
@@ -23,15 +23,14 @@ import java.util.List;
import javax.inject.Inject;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
import com.cloud.agent.AgentManager;
import com.cloud.agent.api.Answer;
@@ -362,10 +361,16 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
// if the instance is of type user vm, call the user vm manager
if (vmInstance.getType().equals(VirtualMachine.Type.User)) {
UserVmVO userVm = userVmDao.findById(vmInstance.getId());
-
- vmMgr.advanceStart(userVm.getUuid(), null, null); // update work queue
- work.setStartedAfterMaintenance(true);
- _storagePoolWorkDao.update(work.getId(), work);
+ // check if the vm has a root volume. If not, remove the item from the queue, the vm should be
+ // started only when it has at least one root volume attached to it
+ // don't allow to start vm that doesn't have a root volume
+ if (volumeDao.findByInstanceAndType(work.getId(), Volume.Type.ROOT).isEmpty()) {
+ _storagePoolWorkDao.remove(work.getId());
+ } else {
+ vmMgr.advanceStart(userVm.getUuid(), null, null);
+ work.setStartedAfterMaintenance(true);
+ _storagePoolWorkDao.update(work.getId(), work);
+ }
}
return true;
} catch (Exception e) {