mirror of https://github.com/apache/cloudstack.git
Fix errors in bringing up user VM under new VMsync framework
This commit is contained in:
parent
03a9445fda
commit
35ea8e149d
|
|
@ -53,6 +53,7 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
|
|||
AllFieldsSearch.and("broadcastUri", AllFieldsSearch.entity().getBroadcastUri(), Op.EQ);
|
||||
AllFieldsSearch.and("secondaryip", AllFieldsSearch.entity().getSecondaryIp(), Op.EQ);
|
||||
AllFieldsSearch.and("nicid", AllFieldsSearch.entity().getId(), Op.EQ);
|
||||
AllFieldsSearch.and("strategy", AllFieldsSearch.entity().getReservationStrategy(), Op.EQ);
|
||||
AllFieldsSearch.done();
|
||||
|
||||
IpSearch = createSearchBuilder(String.class);
|
||||
|
|
|
|||
|
|
@ -141,6 +141,12 @@ public class AsyncJobMonitor extends ManagerBase {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isJobActive(long jobId) {
|
||||
synchronized(this) {
|
||||
return _activeTasks.get(jobId) != null;
|
||||
}
|
||||
}
|
||||
|
||||
public int getActivePoolThreads() {
|
||||
return _activePoolThreads;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -535,13 +535,17 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
|
|||
}
|
||||
|
||||
if((getAndResetPendingSignals(job) & AsyncJobConstants.SIGNAL_MASK_WAKEUP) != 0) {
|
||||
AsyncJobDispatcher jobDispatcher = getWakeupDispatcher(job);
|
||||
if(jobDispatcher != null) {
|
||||
jobDispatcher.runJob(job);
|
||||
} else {
|
||||
s_logger.error("Unable to find a wakeup dispatcher from the joined job. job-" + job.getId());
|
||||
if(!_jobMonitor.isJobActive(job.getId())) {
|
||||
AsyncJobDispatcher jobDispatcher = getWakeupDispatcher(job);
|
||||
if(jobDispatcher != null) {
|
||||
jobDispatcher.runJob(job);
|
||||
} else {
|
||||
s_logger.error("Unable to find a wakeup dispatcher from the joined job. job-" + job.getId());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
assert(_jobMonitor.isJobActive(job.getId()));
|
||||
|
||||
AsyncJobDispatcher jobDispatcher = getDispatcher(job.getDispatcher());
|
||||
if(jobDispatcher != null) {
|
||||
jobDispatcher.runJob(job);
|
||||
|
|
|
|||
|
|
@ -51,19 +51,23 @@ public class VmWorkStart extends VmWork {
|
|||
}
|
||||
|
||||
public DeploymentPlan getPlan() {
|
||||
// this is ugly, to work with legacy code, we need to re-construct the DeploymentPlan hard-codely
|
||||
// this has to be refactored together with migrating legacy code into the new way
|
||||
|
||||
ReservationContext context = null;
|
||||
if(reservationId != null) {
|
||||
Journal journal = new Journal.LogJournal("VmWorkStart", s_logger);
|
||||
context = new ReservationContextImpl(reservationId, journal, CallContext.current().getCallingUser(), CallContext.current().getCallingAccount());
|
||||
if(podId != null || clusterId != null || hostId != null || poolId != null || physicalNetworkId != null) {
|
||||
// this is ugly, to work with legacy code, we need to re-construct the DeploymentPlan hard-codely
|
||||
// this has to be refactored together with migrating legacy code into the new way
|
||||
ReservationContext context = null;
|
||||
if(reservationId != null) {
|
||||
Journal journal = new Journal.LogJournal("VmWorkStart", s_logger);
|
||||
context = new ReservationContextImpl(reservationId, journal, CallContext.current().getCallingUser(), CallContext.current().getCallingAccount());
|
||||
}
|
||||
|
||||
DeploymentPlan plan = new DataCenterDeployment(
|
||||
dcId, podId, clusterId, hostId, poolId, physicalNetworkId,
|
||||
context);
|
||||
return plan;
|
||||
}
|
||||
|
||||
DeploymentPlan plan = new DataCenterDeployment(
|
||||
dcId, podId, clusterId, hostId, poolId, physicalNetworkId,
|
||||
context);
|
||||
return plan;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setPlan(DeploymentPlan plan) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
package com.cloud.vm;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -165,18 +164,6 @@ public class VmWorkMockVirtualMachineManagerImpl implements VirtualMachineManage
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<VirtualMachineGuru> getRegisteredGurus() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualMachineGuru getVmGuru(VirtualMachine vm) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stateTransitTo(VMInstanceVO vm, Event e, Long hostId)
|
||||
throws NoTransitionException {
|
||||
|
|
|
|||
Loading…
Reference in New Issue