use of org.ovirt.engine.core.common.action.ActivateDeactivateVmNicParameters in project ovirt-engine by oVirt.
the class AbstractVmInterfaceCommand method activateOrDeactivateNic.
protected boolean activateOrDeactivateNic(VmNic nic, PlugAction plugAction, boolean newNic) {
ActivateDeactivateVmNicParameters parameters = new ActivateDeactivateVmNicParameters(nic, plugAction, newNic);
parameters.setVmId(getParameters().getVmId());
ActionReturnValue returnValue = runInternalAction(ActionType.ActivateDeactivateVmNic, parameters, cloneContextAndDetachFromParent());
if (!returnValue.getSucceeded()) {
propagateFailure(returnValue);
}
return returnValue.getSucceeded();
}
use of org.ovirt.engine.core.common.action.ActivateDeactivateVmNicParameters in project ovirt-engine by oVirt.
the class MigrateVmCommand method unplugPassthroughNics.
/**
* When unplugging fails for any nic, we stop immediately. In that case we won't proceed with migration, and thus
* it makes sense to stop asap to create minimum problems which needs to be fixed manually.
*
* @return false if unplugging failed.
*/
private boolean unplugPassthroughNics() {
if (passthroughNicsUnplugged) {
// no need to unplug more than once
return true;
}
List<ActivateDeactivateVmNicParameters> parametersList = createActivateDeactivateVmNicParameters(getAllVmPassthroughNics(), PlugAction.UNPLUG);
log.debug("About to call {} with parameters: {}", ActionType.ActivateDeactivateVmNic, Arrays.toString(parametersList.toArray()));
for (ActivateDeactivateVmNicParameters parameter : parametersList) {
ActionReturnValue returnValue = runInternalAction(ActionType.ActivateDeactivateVmNic, parameter);
if (!returnValue.getSucceeded()) {
returnValue.getValidationMessages().forEach(this::addValidationMessage);
return false;
}
}
passthroughNicsUnplugged = true;
return true;
}
use of org.ovirt.engine.core.common.action.ActivateDeactivateVmNicParameters in project ovirt-engine by oVirt.
the class MigrateVmCommand method createActivateDeactivateVmNicParameters.
private ActivateDeactivateVmNicParameters createActivateDeactivateVmNicParameters(VmNic nic, PlugAction plugAction) {
ActivateDeactivateVmNicParameters parameters = new ActivateDeactivateVmNicParameters(nic, plugAction, false);
parameters.setVmId(getParameters().getVmId());
return parameters;
}
use of org.ovirt.engine.core.common.action.ActivateDeactivateVmNicParameters in project ovirt-engine by oVirt.
the class MigrateVmCommand method replugNics.
private List<VmNic> replugNics(List<ActivateDeactivateVmNicParameters> parametersList) {
log.debug("About to call {} with parameters: {}", ActionType.ActivateDeactivateVmNic, Arrays.toString(parametersList.toArray()));
List<VmNic> notRepluggedNics = new ArrayList<>();
for (ActivateDeactivateVmNicParameters parameter : parametersList) {
ActionReturnValue returnValue = runInternalAction(ActionType.ActivateDeactivateVmNic, parameter);
boolean nicPlugSucceeded = returnValue.getSucceeded();
if (!nicPlugSucceeded) {
notRepluggedNics.add(parameter.getNic());
}
}
return notRepluggedNics;
}
Aggregations