Search in sources :

Example 1 with ResetGlusterVolumeOptionsVDSParameters

use of org.ovirt.engine.core.common.vdscommands.gluster.ResetGlusterVolumeOptionsVDSParameters in project ovirt-engine by oVirt.

the class ResetGlusterVolumeOptionsCommand method executeCommand.

@Override
protected void executeCommand() {
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ResetGlusterVolumeOptions, new ResetGlusterVolumeOptionsVDSParameters(upServer.getId(), getGlusterVolumeName(), getParameters().getVolumeOption(), getParameters().isForceAction()));
    setSucceeded(returnValue.getSucceeded());
    if (getSucceeded()) {
        if (getParameters().getVolumeOption() != null && !getParameters().getVolumeOption().getKey().isEmpty()) {
            GlusterVolumeOptionEntity entity = getGlusterVolume().getOption(getParameters().getVolumeOption().getKey());
            isResetAllOptions = false;
            if (entity != null) {
                removeOptionInDb(entity);
                String optionValue = entity.getValue();
                getParameters().getVolumeOption().setValue(optionValue != null ? optionValue : "");
                addCustomValue(GlusterConstants.OPTION_KEY, getParameters().getVolumeOption().getKey());
                addCustomValue(GlusterConstants.OPTION_VALUE, getParameters().getVolumeOption().getValue());
            }
        } else {
            for (GlusterVolumeOptionEntity option : getGlusterVolume().getOptions()) {
                removeOptionInDb(option);
            }
            isResetAllOptions = true;
        }
    } else {
        handleVdsError(AuditLogType.GLUSTER_VOLUME_OPTIONS_RESET_FAILED, returnValue.getVdsError().getMessage());
        return;
    }
}
Also used : ResetGlusterVolumeOptionsVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.ResetGlusterVolumeOptionsVDSParameters) GlusterVolumeOptionEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Aggregations

GlusterVolumeOptionEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity)1 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)1 ResetGlusterVolumeOptionsVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.ResetGlusterVolumeOptionsVDSParameters)1