Search in sources :

Example 1 with RemoveVdsParameters

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();
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) RemoveVdsParameters(org.ovirt.engine.core.common.action.RemoveVdsParameters)

Example 2 with RemoveVdsParameters

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);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) ArrayList(java.util.ArrayList) JsSingleValueStringObject(org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) HostMaintenanceConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel) RemoveVdsParameters(org.ovirt.engine.core.common.action.RemoveVdsParameters) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 3 with RemoveVdsParameters

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));
}
Also used : RemoveVdsParameters(org.ovirt.engine.core.common.action.RemoveVdsParameters)

Aggregations

RemoveVdsParameters (org.ovirt.engine.core.common.action.RemoveVdsParameters)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 ArrayList (java.util.ArrayList)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 JsSingleValueStringObject (org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1 HostMaintenanceConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel)1