use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.
the class PersistentHostSetupNetworksCommand method executeCommand.
@Override
protected void executeCommand() {
if (getParameters().getShouldBeLogged()) {
auditLogDirector.log(this, AuditLogType.PERSIST_HOST_SETUP_NETWORK_ON_HOST);
}
ActionReturnValue returnValue = runInternalAction(ActionType.HostSetupNetworks, getParameters(), cloneContextAndDetachFromParent());
if (returnValue.getSucceeded()) {
boolean changesDetected = checkForChanges();
if (changesDetected) {
VdsActionParameters parameters = new VdsActionParameters(getParameters().getVdsId());
parameters.setShouldBeLogged(false);
parameters.setCorrelationId(getCorrelationId());
returnValue = runInternalAction(ActionType.CommitNetworkChanges, parameters, cloneContextAndDetachFromParent());
}
}
if (!returnValue.getSucceeded()) {
propagateFailure(returnValue);
}
setSucceeded(returnValue.getSucceeded());
}
use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.
the class RefreshHostCommand method executeCommand.
@Override
protected void executeCommand() {
VdsActionParameters parameters = new VdsActionParameters(getVdsId());
parameters.setLockProperties(LockProperties.create(LockProperties.Scope.Execution).withWait(isInternalExecution()));
ActionReturnValue returnValue = runInternalAction(ActionType.RefreshHostCapabilities, parameters);
if (!returnValue.getSucceeded()) {
return;
}
returnValue = runInternalAction(ActionType.RefreshHostDevices, parameters);
if (!returnValue.getSucceeded()) {
return;
}
setSucceeded(true);
}
use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.
the class AddStorageDomainRM method prepare1.
public void prepare1() {
EnlistmentContext enlistmentContext = (EnlistmentContext) context.enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
final VDS host = model.getSelectedItem();
VdsActionParameters parameters = new VdsActionParameters(host.getId());
parameters.setCorrelationId(getCorrelationId());
Frontend.getInstance().runAction(ActionType.ActivateVds, parameters, result -> {
ActionReturnValue returnValue = result.getReturnValue();
context.activateVdsReturnValue = returnValue;
prepare2();
});
}
use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.
the class InitVdsOnUpCommand method refreshHostDeviceList.
private void refreshHostDeviceList() {
try {
CommandContext ctx = cloneContext();
ctx.getExecutionContext().setJobRequired(false);
runInternalAction(ActionType.RefreshHostDevices, new VdsActionParameters(getVdsId()), ctx);
} catch (EngineException e) {
log.error("Could not refresh host devices for host '{}'", getVds().getName());
}
}
use of org.ovirt.engine.core.common.action.VdsActionParameters in project ovirt-engine by oVirt.
the class ChangeVDSClusterCommand method executeCommand.
@Override
protected void executeCommand() {
final Guid targetClusterId = getParameters().getClusterId();
if (getSourceCluster().getId().equals(targetClusterId)) {
setSucceeded(true);
return;
}
// save the new cluster id
TransactionSupport.executeInNewTransaction(() -> {
VdsStatic staticData = getVds().getStaticData();
getCompensationContext().snapshotEntity(staticData);
// of the host is needed to reconfigure the firewall.
if (targetCluster.getFirewallType() != getSourceCluster().getFirewallType()) {
staticData.setReinstallRequired(true);
}
staticData.setClusterId(targetClusterId);
vdsStaticDao.update(staticData);
getCompensationContext().stateChanged();
// remove the server from resource manager and add it back
initializeVds();
return null;
});
if (targetStoragePool != null && (getSourceCluster().getStoragePoolId() == null || !targetStoragePool.getId().equals(getSourceCluster().getStoragePoolId()))) {
VdsActionParameters addVdsSpmIdParams = new VdsActionParameters(getVdsIdRef());
addVdsSpmIdParams.setSessionId(getParameters().getSessionId());
addVdsSpmIdParams.setCompensationEnabled(true);
ActionReturnValue addVdsSpmIdReturn = runInternalAction(ActionType.AddVdsSpmId, addVdsSpmIdParams, cloneContext().withoutLock().withoutExecutionContext());
if (!addVdsSpmIdReturn.getSucceeded()) {
setSucceeded(false);
getReturnValue().setFault(addVdsSpmIdReturn.getFault());
return;
}
}
if (getSourceCluster().supportsGlusterService() && clusterUtils.hasServers(getSourceCluster().getId())) {
if (!glusterHostRemove(getSourceCluster().getId())) {
setSucceeded(false);
return;
}
}
if (getTargetCluster().supportsGlusterService() && clusterUtils.hasMultipleServers(getTargetCluster().getId())) {
if (!glusterHostAdd(getTargetCluster().getId())) {
setSucceeded(false);
return;
}
}
if (getSourceCluster().getStoragePoolId() != null && (targetStoragePool == null || !getSourceCluster().getStoragePoolId().equals(targetStoragePool.getId()))) {
vdsSpmIdMapDao.removeByVdsAndStoragePool(getVds().getId(), getSourceCluster().getStoragePoolId());
}
HostNetworkAttachmentsPersister persister = new HostNetworkAttachmentsPersister(this.networkAttachmentDao, getVdsId(), interfaceDao.getAllInterfacesForVds(getVdsId()), Collections.emptyList(), getTargetClusterNetworks());
persister.persistNetworkAttachments();
if (VDSStatus.PendingApproval != getVds().getStatus()) {
configureNetworks();
}
setSucceeded(true);
}
Aggregations