Search in sources :

Example 1 with GlusterVolumeGeoRepConfigVdsParameters

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

the class SetGeoRepConfigCommand method executeCommand.

@Override
protected void executeCommand() {
    GlusterGeoRepSession session = getGeoRepSession();
    String configKey = getParameters().getConfigKey();
    String configValue = getParameters().getConfigValue();
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.SetGlusterVolumeGeoRepConfig, new GlusterVolumeGeoRepConfigVdsParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), configKey, configValue, session.getUserName()));
    boolean succeeded = returnValue.getSucceeded();
    if (succeeded && configKey.equals("use_meta_volume")) {
        // Not handling failures as there's no way to figure out if the error is that the option is already set.
        runVdsCommand(VDSCommandType.SetGlusterVolumeOption, new GlusterVolumeOptionVDSParameters(upServer.getId(), "all", new GlusterVolumeOptionEntity(getGeoRepSession().getMasterVolumeId(), "cluster.enable-shared-storage", "enable")));
    }
    setSucceeded(succeeded);
    if (getSucceeded()) {
        GlusterGeoRepSessionConfiguration geoRepSessionConfig = new GlusterGeoRepSessionConfiguration();
        geoRepSessionConfig.setValue(configValue);
        geoRepSessionConfig.setKey(configKey);
        geoRepSessionConfig.setId(session.getId());
        if (glusterGeoRepDao.getGeoRepSessionConfigByKey(session.getId(), configKey) == null) {
            glusterGeoRepDao.saveConfig(geoRepSessionConfig);
        } else {
            glusterGeoRepDao.updateConfig(geoRepSessionConfig);
        }
    } else {
        handleVdsError(AuditLogType.GLUSTER_GEOREP_CONFIG_SET_FAILED, returnValue.getVdsError().getMessage());
        return;
    }
}
Also used : GlusterGeoRepSessionConfiguration(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionConfiguration) GlusterVolumeOptionVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeOptionVDSParameters) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) GlusterVolumeOptionEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) GlusterVolumeGeoRepConfigVdsParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepConfigVdsParameters)

Example 2 with GlusterVolumeGeoRepConfigVdsParameters

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

the class ResetDefaultGeoRepConfigCommand method executeCommand.

@Override
protected void executeCommand() {
    GlusterGeoRepSession session = getGeoRepSession();
    VDSReturnValue returnValue = runVdsCommand(VDSCommandType.SetGlusterVolumeGeoRepConfigDefault, new GlusterVolumeGeoRepConfigVdsParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), getParameters().getConfigKey(), null, session.getUserName()));
    glusterGeoRepSyncJob.updateDiscoveredSessionConfig(getCluster(), session);
    setSucceeded(returnValue.getSucceeded());
    if (!getSucceeded()) {
        handleVdsError(AuditLogType.GLUSTER_GEOREP_CONFIG_SET_DEFAULT_FAILED, returnValue.getVdsError().getMessage());
        return;
    }
}
Also used : GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) GlusterVolumeGeoRepConfigVdsParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepConfigVdsParameters)

Aggregations

GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)2 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)2 GlusterVolumeGeoRepConfigVdsParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepConfigVdsParameters)2 GlusterGeoRepSessionConfiguration (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionConfiguration)1 GlusterVolumeOptionEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity)1 GlusterVolumeOptionVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeOptionVDSParameters)1