Fixed a bunch of asserts

This commit is contained in:
ahuang 2013-07-17 16:20:53 -07:00
parent 541f9d7f9c
commit ee4d067c12
7 changed files with 31 additions and 30 deletions

View File

@ -100,7 +100,7 @@ public class EngineClusterVO implements EngineCluster, Identity {
@Enumerated(value=EnumType.STRING)
@StateMachine(state=State.class, event=Event.class)
@Column(name="engine_state", updatable=true, nullable=false, length=32)
protected State engineState = null;
protected State state = null;
public EngineClusterVO() {
@ -108,7 +108,7 @@ public class EngineClusterVO implements EngineCluster, Identity {
allocationState = Grouping.AllocationState.Enabled;
this.uuid = UUID.randomUUID().toString();
this.engineState = State.Disabled;
this.state = State.Disabled;
}
public EngineClusterVO(long dataCenterId, long podId, String name) {
@ -119,7 +119,7 @@ public class EngineClusterVO implements EngineCluster, Identity {
this.allocationState = Grouping.AllocationState.Enabled;
this.managedState = ManagedState.Managed;
this.uuid = UUID.randomUUID().toString();
this.engineState = State.Disabled;
this.state = State.Disabled;
}
@Override
@ -238,6 +238,6 @@ public class EngineClusterVO implements EngineCluster, Identity {
}
public State getState() {
return engineState;
return state;
}
}

View File

@ -158,7 +158,7 @@ public class EngineDataCenterVO implements EngineDataCenter, Identity {
@Enumerated(value=EnumType.STRING)
@StateMachine(state=State.class, event=Event.class)
@Column(name="engine_state", updatable=true, nullable=false, length=32)
protected State engineState = null;
protected State state = null;
@Override
@ -246,7 +246,7 @@ public class EngineDataCenterVO implements EngineDataCenter, Identity {
this.zoneToken = zoneToken;
this.domain = domainSuffix;
this.uuid = UUID.randomUUID().toString();
this.engineState = State.Disabled;
this.state = State.Disabled;
}
@Override
@ -481,7 +481,7 @@ public class EngineDataCenterVO implements EngineDataCenter, Identity {
}
public State getState() {
return engineState;
return state;
}
@Override

View File

@ -92,7 +92,7 @@ public class EngineHostPodVO implements EnginePod, Identity {
@Enumerated(value=EnumType.STRING)
@StateMachine(state=State.class, event=Event.class)
@Column(name="engine_state", updatable=true, nullable=false, length=32)
protected State engineState = null;
protected State state = null;
public EngineHostPodVO(String name, long dcId, String gateway, String cidrAddress, int cidrSize, String description) {
this.name = name;
@ -104,7 +104,7 @@ public class EngineHostPodVO implements EnginePod, Identity {
this.allocationState = Grouping.AllocationState.Enabled;
this.externalDhcp = false;
this.uuid = UUID.randomUUID().toString();
this.engineState = State.Disabled;
this.state = State.Disabled;
}
/*
@ -240,6 +240,6 @@ public class EngineHostPodVO implements EnginePod, Identity {
}
public State getState() {
return engineState;
return state;
}
}

View File

@ -383,7 +383,7 @@ public class EngineHostVO implements EngineHost, Identity {
@Enumerated(value=EnumType.STRING)
@StateMachine(state=State.class, event=Event.class)
@Column(name="engine_state", updatable=true, nullable=false, length=32)
protected State engineState = null;
protected State orchestrationState = null;
public EngineHostVO(String guid) {
@ -393,12 +393,12 @@ public class EngineHostVO implements EngineHost, Identity {
this.dom0MinMemory = 0;
this.resourceState = ResourceState.Creating;
this.uuid = UUID.randomUUID().toString();
this.engineState = State.Disabled;
this.orchestrationState = State.Disabled;
}
protected EngineHostVO() {
this.uuid = UUID.randomUUID().toString();
this.engineState = State.Disabled;
this.orchestrationState = State.Disabled;
}
public EngineHostVO(long id,
@ -433,7 +433,7 @@ public class EngineHostVO implements EngineHost, Identity {
this.totalSize = totalSize;
this.fsType = fsType;
this.uuid = UUID.randomUUID().toString();
this.engineState = State.Disabled;
this.orchestrationState = State.Disabled;
}
public EngineHostVO(long id,
@ -492,7 +492,7 @@ public class EngineHostVO implements EngineHost, Identity {
this.dom0MinMemory = dom0MinMemory;
this.storageUrl = url;
this.uuid = UUID.randomUUID().toString();
this.engineState = State.Disabled;
this.orchestrationState = State.Disabled;
}
public void setPodId(Long podId) {
@ -773,6 +773,6 @@ public class EngineHostVO implements EngineHost, Identity {
}
public State getOrchestrationState() {
return engineState;
return orchestrationState;
}
}

View File

@ -29,11 +29,12 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.persistence.TableGenerator;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity;
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State;
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.host.Host;
import com.cloud.host.Host.Type;
@ -311,7 +312,7 @@ public class EngineHostDaoImpl extends GenericDaoBase<EngineHostVO, Long> implem
StateChangeSearch = createSearchBuilder();
StateChangeSearch.and("id", StateChangeSearch.entity().getId(), SearchCriteria.Op.EQ);
StateChangeSearch.and("state", StateChangeSearch.entity().getState(), SearchCriteria.Op.EQ);
StateChangeSearch.and("state", StateChangeSearch.entity().getStatus(), SearchCriteria.Op.EQ);
StateChangeSearch.done();
}
@ -336,7 +337,7 @@ public class EngineHostDaoImpl extends GenericDaoBase<EngineHostVO, Long> implem
@Override @DB
public List<EngineHostVO> findAndUpdateDirectAgentToLoad(long lastPingSecondsAfter, Long limit, long managementServerId) {
Transaction txn = Transaction.currentTxn();
txn.start();
txn.start();
SearchCriteria<EngineHostVO> sc = UnmanagedDirectConnectSearch.create();
sc.setParameters("lastPinged", lastPingSecondsAfter);
//sc.setParameters("resourceStates", ResourceState.ErrorInMaintenance, ResourceState.Maintenance, ResourceState.PrepareForMaintenance, ResourceState.Disabled);

View File

@ -44,7 +44,7 @@ public class UploadVO implements Upload {
private String uuid;
@Column(name = "host_id")
private long storeId;
private long dataStoreId;
@Column(name = "type_id")
private long typeId;
@ -85,11 +85,11 @@ public class UploadVO implements Upload {
@Override
public long getDataStoreId() {
return storeId;
return dataStoreId;
}
public void setDataStoreId(long hostId) {
this.storeId = hostId;
this.dataStoreId = hostId;
}
@Override
@ -118,7 +118,7 @@ public class UploadVO implements Upload {
public UploadVO(long hostId, long templateId) {
super();
this.storeId = hostId;
this.dataStoreId = hostId;
this.typeId = templateId;
this.uuid = UUID.randomUUID().toString();
}
@ -126,7 +126,7 @@ public class UploadVO implements Upload {
public UploadVO(long hostId, long typeId, Date lastUpdated, Status uploadState, Type type, String uploadUrl,
Mode mode) {
super();
this.storeId = hostId;
this.dataStoreId = hostId;
this.typeId = typeId;
this.lastUpdated = lastUpdated;
this.uploadState = uploadState;
@ -139,7 +139,7 @@ public class UploadVO implements Upload {
public UploadVO(long hostId, long typeId, Date lastUpdated, Status uploadState, int uploadPercent, Type type,
Mode mode) {
super();
this.storeId = hostId;
this.dataStoreId = hostId;
this.typeId = typeId;
this.lastUpdated = lastUpdated;
this.uploadState = uploadState;
@ -179,7 +179,7 @@ public class UploadVO implements Upload {
public boolean equals(Object obj) {
if (obj instanceof UploadVO) {
UploadVO other = (UploadVO) obj;
return (this.typeId == other.getTypeId() && this.storeId == other.getDataStoreId() && this.type == other
return (this.typeId == other.getTypeId() && this.dataStoreId == other.getDataStoreId() && this.type == other
.getType());
}
return false;

View File

@ -32,7 +32,7 @@ public class SspCredentialVO {
private long id;
@Column(name="data_center_id")
private long dataCenterId; // Actually, this is zoneId
private long zoneId; // Actually, this is zoneId
// XXX: We might want to restrict access to this by cloudstack privileges.
@Column(name="username")
@ -42,11 +42,11 @@ public class SspCredentialVO {
private String password;
public long getZoneId() {
return dataCenterId;
return zoneId;
}
public void setZoneId(long zoneId) {
this.dataCenterId = zoneId;
this.zoneId = zoneId;
}
public String getUsername() {