use of org.ovirt.engine.core.common.action.RemoveVdsParameters in project ovirt-engine by oVirt.
the class AddVdsCommand method removeDeprecatedOvirtEntry.
/**
* The scenario in which a host is already exists when adding new host after the validate is when the existed
* host type is oVirt and its status is 'Pending Approval'. In this case the old entry is removed from the DB, since
* the oVirt node was added again, where the new host properties might be updated (e.g. cluster adjustment, data
* center, host name, host address) and a new entry with updated properties is added.
*
* @param oVirtId
* the deprecated host entry to remove
*/
private boolean removeDeprecatedOvirtEntry(final Guid oVirtId) {
final VDS vds = vdsDao.get(oVirtId);
if (vds == null || !VdsHandler.isPendingOvirt(vds)) {
return false;
}
String vdsName = getParameters().getVdsStaticData().getName();
log.info("Host '{}', id '{}' of type '{}' is being re-registered as Host '{}'", vds.getName(), vds.getId(), vds.getVdsType().name(), vdsName);
ActionReturnValue result = TransactionSupport.executeInNewTransaction(() -> runInternalAction(ActionType.RemoveVds, new RemoveVdsParameters(oVirtId)));
if (!result.getSucceeded()) {
String errors = result.isValid() ? result.getFault().getError().name() : StringUtils.join(result.getValidationMessages(), ",");
log.warn("Failed to remove Host '{}', id '{}', re-registering it as Host '{}' fails with errors {}", vds.getName(), vds.getId(), vdsName, errors);
} else {
log.info("Host '{}' is now known as Host '{}'", vds.getName(), vdsName);
}
return result.getSucceeded();
}
use of org.ovirt.engine.core.common.action.RemoveVdsParameters in project ovirt-engine by oVirt.
the class HostListModel method onRemove.
public void onRemove() {
ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
boolean force = model.getForce().getEntity();
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VDS vds = (VDS) item;
list.add(new RemoveVdsParameters(vds.getId(), force));
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.RemoveVds, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.core.common.action.RemoveVdsParameters in project ovirt-engine by oVirt.
the class BackendHostResource method remove.
@Override
public Response remove() {
get();
boolean force = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, FORCE, true, false);
return performAction(ActionType.RemoveVds, new RemoveVdsParameters(guid, force));
}
Aggregations