anmolbabu has uploaded a new change for review. Change subject: engine : VdsCommand for geo-rep status detail query ......................................................................
engine : VdsCommand for geo-rep status detail query VdsCommand for Gluster geo-rep status detail query Change-Id: I1b8236e7e516eba46d183c3f83a973175edba90f Signed-off-by: Anmol Babu <[email protected]> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/gluster/GlusterVolumeGeoRepSessionDetailsVDSParameters.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterDBUtils.java M backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/AbstractGlusterBrokerCommand.java A backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GetGlusterVolumeGeoRepStatusDetail.java A backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/GlusterVolumeGeoRepStatusDetailForXmlRpc.java M frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java 9 files changed, 172 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/72/30472/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java index 32758a5..6cb3f61 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllErrors.java @@ -399,6 +399,7 @@ GlfsStatvfsException(4571), GlfsInitException(4572), GlfsFiniException(4573), + GlusterVolumeGeoRepStatusDetailFailed(4574), UnicodeArgumentException(4900), diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java index 0b68804..b210255 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java @@ -158,6 +158,7 @@ GetDiskAlignment("org.ovirt.engine.core.vdsbroker.vdsbroker"), GlusterTasksList("org.ovirt.engine.core.vdsbroker.gluster"), GetGlusterVolumeRemoveBricksStatus("org.ovirt.engine.core.vdsbroker.gluster"), + GetGlusterVolumeGeoRepSessionStatusDetail("org.ovirt.engine.core.vdsbroker.gluster"), SetNumberOfCpus("org.ovirt.engine.core.vdsbroker"), List("org.ovirt.engine.core.vdsbroker.vdsbroker"), // get a list of VMs with status only GetVmStats("org.ovirt.engine.core.vdsbroker.vdsbroker"), // get a VM with full data and statistics diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/gluster/GlusterVolumeGeoRepSessionDetailsVDSParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/gluster/GlusterVolumeGeoRepSessionDetailsVDSParameters.java new file mode 100644 index 0000000..624c09e --- /dev/null +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/gluster/GlusterVolumeGeoRepSessionDetailsVDSParameters.java @@ -0,0 +1,35 @@ +package org.ovirt.engine.core.common.vdscommands.gluster; + +import org.ovirt.engine.core.compat.Guid; + +public class GlusterVolumeGeoRepSessionDetailsVDSParameters extends GlusterVolumeVDSParameters { + + String slaveHost; + String slaveVolume; + + public GlusterVolumeGeoRepSessionDetailsVDSParameters() { + + } + + public GlusterVolumeGeoRepSessionDetailsVDSParameters(Guid serverId, String volumeName, String slaveHost, String slaveVolume) { + super(serverId, volumeName); + this.slaveHost = slaveHost; + this.slaveVolume = slaveVolume; + } + + public String getSlaveHost() { + return slaveHost; + } + + public void setSlaveHost(String slaveHost) { + this.slaveHost = slaveHost; + } + + public String getSlaveVolume() { + return slaveVolume; + } + + public void setSlaveVolume(String slaveVolume) { + this.slaveVolume = slaveVolume; + } +} diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterDBUtils.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterDBUtils.java index 855a30f..5f27950 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterDBUtils.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterDBUtils.java @@ -43,6 +43,16 @@ return (getGlusterBrickDao().getGlusterVolumeBricksByServerId(serverId).size() > 0); } + public GlusterBrickEntity getGlusterBrickByServerUuidAndBrickDir(Guid serverId, String brickDir) { + return getGlusterBrickDao().getBrickByServerIdAndDirectory(serverId, brickDir); + } + + public GlusterVolumeEntity getVolumeByNameAndHostId(String volumeName, Guid hostUuid) { + VdsStatic vds = getVdsStaticDao().get(hostUuid); + Guid vdsGroupId = vds.getVdsGroupId(); + return getGlusterVolumeDao().getByName(vdsGroupId, volumeName); + } + /** * Update status of all bricks of the given volume to the new status */ diff --git a/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties b/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties index f98da09..28f73c3 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/VdsmErrors.properties @@ -368,6 +368,7 @@ GlusterServiceActionNotSupported=Gluster service action not supported GlusterVolumeStatusAllFailedException=Failed to get gluster tasks list GlusterVolumeRebalanceStatusFailedException=Failed to get gluster volume rebalance status +GlusterVolumeGeoRepStatusDetailFailedException=Failed to get gluster volume geo rep status detail GlusterLibgfapiException=Command failed due to gluster libgfapi exception GlfsStatvfsException=Failed to get gluster volume size info GlfsInitException=Command failed while mounting gluster volume diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/AbstractGlusterBrokerCommand.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/AbstractGlusterBrokerCommand.java index 2b2d573..942b3a5 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/AbstractGlusterBrokerCommand.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/AbstractGlusterBrokerCommand.java @@ -66,6 +66,7 @@ case GlusterVolumeRemoveBricksStopFailed: case GlusterVolumeRemoveBrickStatusFailed: case GlusterVolumeRemoveBricksCommitFailed: + case GlusterVolumeGeoRepStatusDetailFailed: case GlusterLibgfapiException: case GlfsStatvfsException: case GlfsInitException: diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GetGlusterVolumeGeoRepStatusDetail.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GetGlusterVolumeGeoRepStatusDetail.java new file mode 100644 index 0000000..07ac2eb --- /dev/null +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GetGlusterVolumeGeoRepStatusDetail.java @@ -0,0 +1,16 @@ +package org.ovirt.engine.core.vdsbroker.gluster; + +import org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeVDSParameters; + +public class GetGlusterVolumeGeoRepStatusDetail<P extends GlusterVolumeVDSParameters> extends AbstractGlusterBrokerCommand<P> { + + public GetGlusterVolumeGeoRepStatusDetail(P parameters) { + super(parameters); + } + + @Override + protected void executeVdsBrokerCommand() { + + } + +} diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/GlusterVolumeGeoRepStatusDetailForXmlRpc.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/GlusterVolumeGeoRepStatusDetailForXmlRpc.java new file mode 100644 index 0000000..01db4a9 --- /dev/null +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/GlusterVolumeGeoRepStatusDetailForXmlRpc.java @@ -0,0 +1,104 @@ +package org.ovirt.engine.core.vdsbroker.irsbroker; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.ovirt.engine.core.common.businessentities.gluster.GeoRepCrawlStatus; +import org.ovirt.engine.core.common.businessentities.gluster.GeoRepSessionStatus; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails; +import org.ovirt.engine.core.compat.Guid; +import org.ovirt.engine.core.dao.gluster.GlusterDBUtils; + +public class GlusterVolumeGeoRepStatusDetailForXmlRpc extends StatusReturnForXmlRpc{ + + private static final String VOLUME_NAME = "volumeName"; + private static final String SESSION_ID = "sessionSlave"; + private static final String MASTER_NODE_UUID = "masterNodeUuid"; + private static final String MASTER_BRICK = "masterBrick"; + private static final String SLAVE = "slave"; + private static final String STATUS ="status"; + private static final String CHECKPOINT_STATUS = "checkpointStatus"; + private static final String CRAWL_STATUS = "crawlStatus"; + private static final String FILES_SYNCED = "filesSyncd"; + private static final String FILES_PENDING = "filesPending"; + private static final String BYTES_PENDING = "bytesPending"; + private static final String DELETES_PENDING = "deletesPending"; + private static final String FILES_SKIPPED = "filesSkipped"; + private static final String GEO_REP_PAIRS = "pairs"; + + private final List<GlusterGeoRepSessionDetails> geoRepDetails = new ArrayList<GlusterGeoRepSessionDetails>(); + private final List<GlusterGeoRepSession> geoRepSessions = new ArrayList<GlusterGeoRepSession>(); + + private GlusterGeoRepSessionDetails details; + private GlusterGeoRepSession session; + private String masterVolumeName; + private String sessionKey; + + private void populatePairDetails(Map<String, Object> innerMap) { + GlusterDBUtils dbUtils = GlusterDBUtils.getInstance(); + details = new GlusterGeoRepSessionDetails(); + session = new GlusterGeoRepSession(); + Guid masterNodeId = new Guid((innerMap.containsKey(MASTER_NODE_UUID)) ? innerMap.get(MASTER_NODE_UUID).toString() : null); + String masterBrick = (innerMap.containsKey(MASTER_BRICK)) ? innerMap.get(MASTER_BRICK).toString() : null; + String slave = innerMap.containsKey(SLAVE) ? innerMap.get(SLAVE).toString() : null; + String statusString = innerMap.containsKey(STATUS) ? innerMap.get(STATUS).toString() : null; + String checkPointStatusString = innerMap.containsKey(CHECKPOINT_STATUS) ? innerMap.get(CHECKPOINT_STATUS).toString() : null; + String crawlStatusString = innerMap.containsKey(CRAWL_STATUS) ? innerMap.get(CRAWL_STATUS).toString() : null; + Long filesSynced = innerMap.containsKey(FILES_SYNCED) ? Long.parseLong(innerMap.get(FILES_SYNCED).toString()) : null; + Long filesPending = innerMap.containsKey(FILES_PENDING) ? Long.parseLong(innerMap.get(FILES_PENDING).toString()) : null; + Long bytesPending = innerMap.containsKey(BYTES_PENDING) ? Long.parseLong(innerMap.get(BYTES_PENDING).toString()) : null; + Long deletesPending = innerMap.containsKey(DELETES_PENDING) ? Long.parseLong(innerMap.get(DELETES_PENDING).toString()) : null; + Long filesSkipped = innerMap.containsKey(FILES_SKIPPED) ? Long.parseLong(innerMap.get(FILES_SKIPPED).toString()) : null; + + String slaveHost = slave.subSequence(0, slave.indexOf(':')).toString(); + String slaveVolume = slave.substring(slave.lastIndexOf(':')); + GeoRepSessionStatus statusEnum = GeoRepSessionStatus.getEnumFromString(statusString); + GeoRepCrawlStatus crawlStatus = GeoRepCrawlStatus.getEnumFromString(crawlStatusString); + + details.setMasterBrickId(dbUtils.getGlusterBrickByServerUuidAndBrickDir(masterNodeId, masterBrick).getId()); + details.setSlaveNodeHostName(slaveHost); + details.setStatus(statusEnum); + details.setFilesPending(filesPending); + details.setFilesSkipped(filesSkipped); + details.setFilesSynced(filesSynced); + details.setCheckPointStatus(checkPointStatusString); + details.setBytesPending(bytesPending); + details.setCrawlStatus(crawlStatus); + details.setDeletesPending(deletesPending); + details.setSessionId(sessionKey); + + session.setMasterVolumeId(dbUtils.getVolumeByNameAndHostId(masterVolumeName, masterNodeId).getId()); + session.setSlaveNodeHostName(slaveHost); + session.setSlaveVolumeName(slaveVolume); + session.setSessionKey(sessionKey); + } + + @SuppressWarnings("unchecked") + private void populateSessionDetails(Map<String, Object> innerMap) { + masterVolumeName = innerMap.containsKey(VOLUME_NAME) ? innerMap.get(VOLUME_NAME).toString() : null; + sessionKey = innerMap.containsKey(SESSION_ID) ? innerMap.get(SESSION_ID).toString() : null; + + if(innerMap.containsKey(GEO_REP_PAIRS)) { + for(Object sessionPair : (Object[]) innerMap.get(GEO_REP_PAIRS)) { + populatePairDetails((Map<String, Object>) sessionPair); + geoRepDetails.add(details); + geoRepSessions.add(session); + } + } + } + + public GlusterVolumeGeoRepStatusDetailForXmlRpc(Map<String, Object> innerMap) { + super(innerMap); + populateSessionDetails(innerMap); + } + + public List<GlusterGeoRepSessionDetails> getGeoRepDetails() { + return geoRepDetails; + } + + public List<GlusterGeoRepSession> getGeoRepSessions() { + return geoRepSessions; + } +} diff --git a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java index 04cc904..faf2944 100644 --- a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java +++ b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/VdsmErrors.java @@ -796,6 +796,9 @@ @DefaultStringValue("Failed to get gluster volume rebalance status") String GlusterVolumeRebalanceStatusFailedException(); + @DefaultStringValue("Failed to get gluster volume geo rep status detail") + String GlusterVolumeGeoRepStatusDetailFailed(); + @DefaultStringValue("Failed to get status of gluster volume remove bricks") String GlusterVolumeRemoveBrickStatusFailed(); -- To view, visit http://gerrit.ovirt.org/30472 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1b8236e7e516eba46d183c3f83a973175edba90f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: anmolbabu <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
