use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.
the class GlusterGeoRepDaoTest method testGetGeoRepSessionBySlaveVolume.
@Test
public void testGetGeoRepSessionBySlaveVolume() {
GlusterGeoRepSession session = dao.getGeoRepSessionBySlaveVolume(FixturesTool.GLUSTER_GEOREP_SESSION_SLAVE_VOLUME_ID);
assertNotNull(session);
assertEquals(FixturesTool.GLUSTER_GEOREP_SESSION_ID, session.getId());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession 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;
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.
the class RestoreGlusterVolumeSnapshotCommand method startGeoRepSessions.
private boolean startGeoRepSessions(List<GlusterGeoRepSession> geoRepSessions) {
for (GlusterGeoRepSession session : geoRepSessions) {
try (EngineLock lock = acquireGeoRepSessionLock(session.getId())) {
ActionReturnValue retVal = runInternalAction(ActionType.StartGlusterVolumeGeoRep, new GlusterVolumeGeoRepSessionParameters(getGlusterVolumeId(), session.getId()));
if (!retVal.getSucceeded()) {
handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_START_FAILED_EXCEPTION, retVal.getExecuteFailedMessages().toString());
setSucceeded(false);
return false;
}
}
}
return true;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.
the class GetGeoRepSessionsForStorageDomainQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
StorageDomainStatic domain = storageDomainDao.get(getParameters().getId());
StorageServerConnections connection = storageServerConnectionDao.get(domain.getStorage());
getQueryReturnValue().setReturnValue(new ArrayList<GlusterGeoRepSession>());
if (connection.getStorageType() != StorageType.GLUSTERFS) {
// return empty
getQueryReturnValue().setSucceeded(false);
return;
}
Guid glusterVolumeId = connection.getGlusterVolumeId();
if (glusterVolumeId == null) {
// retrieve the gluster volume associated with path
String path = connection.getConnection();
String[] pathElements = path.split(StorageConstants.GLUSTER_VOL_SEPARATOR);
String volumeName = pathElements[1];
String hostName = pathElements[0];
List<VDS> vdsList = vdsDao.getAll();
VDS vds = vdsList.stream().filter(v -> v.getName().equals(hostName) || interfaceDao.getAllInterfacesForVds(v.getId()).stream().anyMatch(iface -> iface.getIpv4Address().equals(hostName))).findFirst().orElse(null);
if (vds == null) {
// return empty
getQueryReturnValue().setSucceeded(false);
return;
}
GlusterVolumeEntity vol = glusterVolumeDao.getByName(vds.getClusterId(), volumeName);
if (vol == null) {
getQueryReturnValue().setSucceeded(false);
return;
}
glusterVolumeId = vol.getId();
}
getQueryReturnValue().setReturnValue(glusterGeoRepDao.getGeoRepSessions(glusterVolumeId));
getQueryReturnValue().setSucceeded(true);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession in project ovirt-engine by oVirt.
the class StartGlusterVolumeGeoRepCommand method executeCommand.
@Override
protected void executeCommand() {
GlusterGeoRepSession session = getGeoRepSession();
VDSReturnValue returnValue = runVdsCommand(VDSCommandType.StartGlusterVolumeGeoRep, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), getGlusterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), session.getUserName(), getParameters().isForce()));
setSucceeded(returnValue.getSucceeded());
if (getSucceeded()) {
session.setStatus(GeoRepSessionStatus.INITIALIZING);
glusterGeoRepDao.updateSession(session);
} else {
handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_START_FAILED_EXCEPTION, returnValue.getVdsError().getMessage());
return;
}
}
Aggregations