mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-6919: don't attempt to restart user vms having no Root volume attached
This commit is contained in:
parent
04b1e31682
commit
09a97e1968
@ -23,15 +23,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import org.apache.cloudstack.context.CallContext;
|
import org.apache.cloudstack.context.CallContext;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
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.DataStoreManager;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
|
||||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
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.AgentManager;
|
||||||
import com.cloud.agent.api.Answer;
|
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 the instance is of type user vm, call the user vm manager
|
||||||
if (vmInstance.getType().equals(VirtualMachine.Type.User)) {
|
if (vmInstance.getType().equals(VirtualMachine.Type.User)) {
|
||||||
UserVmVO userVm = userVmDao.findById(vmInstance.getId());
|
UserVmVO userVm = userVmDao.findById(vmInstance.getId());
|
||||||
|
// check if the vm has a root volume. If not, remove the item from the queue, the vm should be
|
||||||
vmMgr.advanceStart(userVm.getUuid(), null, null); // update work queue
|
// started only when it has at least one root volume attached to it
|
||||||
work.setStartedAfterMaintenance(true);
|
// don't allow to start vm that doesn't have a root volume
|
||||||
_storagePoolWorkDao.update(work.getId(), work);
|
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;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user