use of org.ovirt.engine.core.common.businessentities.CommandEntity in project ovirt-engine by oVirt.
the class HostUpgradeCallback method isMaintenanceCommandExecuted.
private boolean isMaintenanceCommandExecuted(List<Guid> childCmdIds) {
Guid maintenanceCommandId = getMaintenanceCmdId(childCmdIds);
CommandEntity maintenanceCmd = commandCoordinatorUtil.getCommandEntity(maintenanceCommandId);
return maintenanceCmd != null && maintenanceCmd.isExecuted();
}
use of org.ovirt.engine.core.common.businessentities.CommandEntity in project ovirt-engine by oVirt.
the class CommandEntityDaoTest method testRemove.
@Test
public void testRemove() {
CommandEntity cmd = dbFacade.getCommandEntityDao().get(getExistingEntityId());
assertNotNull(cmd);
dbFacade.getCommandEntityDao().remove(getExistingEntityId());
CommandEntity cmdAfterRemoval = dbFacade.getCommandEntityDao().get(getExistingEntityId());
assertNull(cmdAfterRemoval);
}
use of org.ovirt.engine.core.common.businessentities.CommandEntity in project ovirt-engine by oVirt.
the class CommandEntityDaoTest method testGetAllInsertAsyncTaskEntitities.
@Test
public void testGetAllInsertAsyncTaskEntitities() {
CommandEntity cmdEntity = generateNewEntity();
dao.save(cmdEntity);
Set<CommandAssociatedEntity> cocoCmdEntities = new HashSet<>();
cocoCmdEntities.add(new CommandAssociatedEntity(cmdEntity.getId(), VdcObjectType.Storage, Guid.newGuid()));
cocoCmdEntities.add(new CommandAssociatedEntity(cmdEntity.getId(), VdcObjectType.Disk, Guid.newGuid()));
dao.insertCommandAssociatedEntities(cocoCmdEntities);
List<CommandAssociatedEntity> entities = dao.getAllCommandAssociatedEntities(cmdEntity.getId());
assertNotNull(entities);
assertEquals(2, entities.size());
assertThat(entities, hasItems(cocoCmdEntities.toArray(new CommandAssociatedEntity[cocoCmdEntities.size()])));
}
use of org.ovirt.engine.core.common.businessentities.CommandEntity in project ovirt-engine by oVirt.
the class CommandBase method setCommandExecuted.
public void setCommandExecuted() {
Transaction transaction = TransactionSupport.suspend();
try {
CommandEntity cmdEntity = commandCoordinatorUtil.getCommandEntity(getCommandId());
if (cmdEntity != null) {
CommandEntity executedCmdEntity = buildCommandEntity(cmdEntity.getRootCommandId(), cmdEntity.isCallbackEnabled());
executedCmdEntity.setWaitingForEvent(cmdEntity.isCallbackEnabled() ? callbackTriggeredByEvent() : false);
commandCoordinatorUtil.persistCommand(executedCmdEntity, getContext());
commandCoordinatorUtil.updateCommandExecuted(getCommandId());
}
} finally {
if (transaction != null) {
TransactionSupport.resume(transaction);
}
}
}
use of org.ovirt.engine.core.common.businessentities.CommandEntity in project ovirt-engine by oVirt.
the class CommandBase method persistCommand.
public void persistCommand(ActionType parentCommand, CommandContext cmdContext, boolean enableCallback, boolean callbackWaitingForEvent) {
Transaction transaction = TransactionSupport.suspend();
try {
CommandEntity commandEntity = buildCommandEntity(getParentParameters(parentCommand).getCommandId(), enableCallback);
commandEntity.setWaitingForEvent(callbackWaitingForEvent);
commandCoordinatorUtil.persistCommand(commandEntity, cmdContext);
} finally {
if (transaction != null) {
TransactionSupport.resume(transaction);
}
}
}
Aggregations