diff options
Diffstat (limited to 'src')
7 files changed, 23 insertions, 23 deletions
diff --git a/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/VolumesClient.java b/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/VolumesClient.java index e5741151..f85afd4d 100644 --- a/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/VolumesClient.java +++ b/src/com.gluster.storage.management.client/src/com/gluster/storage/management/client/VolumesClient.java @@ -258,9 +258,10 @@ public class VolumesClient extends AbstractClient { putRequest(volumeName, form); } - public void volumeLogRotate(String volumeName, String bricks) { + public void volumeLogRotate(String volumeName, List<String> brickList) { Form form = new Form(); - form.add(RESTConstants.FORM_PARAM_OPERATION, RESTConstants.FORM_PARAM_LOG_ROTATE); + String bricks = StringUtil.collectionToString(brickList, ","); + form.add(RESTConstants.FORM_PARAM_OPERATION, RESTConstants.TASK_LOG_ROTATE); form.add(FORM_PARAM_BRICKS, bricks); putRequest(volumeName, form); } diff --git a/src/com.gluster.storage.management.console/plugin.xml b/src/com.gluster.storage.management.console/plugin.xml index abf5c33e..6983b9dd 100644 --- a/src/com.gluster.storage.management.console/plugin.xml +++ b/src/com.gluster.storage.management.console/plugin.xml @@ -526,7 +526,7 @@ label="Volume Actions" visible="false"> <action - class="VolumeLogRotateAction" + class="com.gluster.storage.management.console.actions.VolumeLogRotateAction" definitionId="com.gluster.storage.management.console.commands.LogRotate" icon="icons/tango/32x32/download-log.png" id="com.gluster.storage.management.console.actions.LogRotateAction" diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/VolumeLogRotateAction.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/VolumeLogRotateAction.java index a0c9e515..0e697b73 100644 --- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/VolumeLogRotateAction.java +++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/VolumeLogRotateAction.java @@ -1,4 +1,6 @@ package com.gluster.storage.management.console.actions; +import java.util.ArrayList; +import java.util.List; import java.util.Set; import org.eclipse.jface.action.IAction; @@ -23,30 +25,26 @@ public class VolumeLogRotateAction extends AbstractActionDelegate { @Override public void dispose() { - } @Override protected void performAction(IAction action) { final String actionDesc = action.getDescription(); - String brick; + List<String> selectedBricks = new ArrayList<String>(); boolean confirmed = showConfirmDialog(actionDesc, - "Are you sure you want to rotate log for volume [" + volume.getName() + "] ? "); + "Are you sure you want to Rotate logs for volume [" + volume.getName() + "] ? "); if (!confirmed) { return; } - if (bricks == null) { - brick = ""; - } else { - brick = StringUtil.collectionToString(GlusterCoreUtil.getQualifiedBrickList(bricks), ","); + if (bricks != null) { + selectedBricks = GlusterCoreUtil.getQualifiedBrickList(bricks); } try { - new VolumesClient().volumeLogRotate(volume.getName(), brick); - showInfoDialog(actionDesc, "Volume log for [" + volume.getName() + "] rotated successfully!"); + new VolumesClient().volumeLogRotate(volume.getName(), selectedBricks); + showInfoDialog(actionDesc, "Volume logs for [" + volume.getName() + "] rotated successfully!"); } catch (Exception e) { - showErrorDialog(actionDesc, "Volume log rotate for [" + volume.getName() - + "] could not be rotate! Error: [" + e.getMessage() + "]"); + showErrorDialog(actionDesc, "Volume [" + volume.getName() + "] log rotation failed! Error: [" + e.getMessage() + "]"); } } @@ -56,13 +54,12 @@ public class VolumeLogRotateAction extends AbstractActionDelegate { volume = (Volume) guiHelper.getSelectedEntity(window, Volume.class); if (volume != null) { - // a volume is selected on navigation tree. Let's check if the currently open view is volume disks view + // a volume is selected on navigation tree. Let's check if the currently open view is volume bricks view IWorkbenchPart view = guiHelper.getActiveView(); if (view instanceof VolumeBricksView) { - // volume disks view is open. check if any brick is selected + // volume bricks view is open. check if any brick is selected bricks = GUIHelper.getInstance().getSelectedEntities(getWindow(), Brick.class); } - } } diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java index 8addb896..22d7e3dc 100644 --- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java +++ b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java @@ -52,6 +52,7 @@ public class RESTConstants { public static final String TASK_COMMIT = "commit"; public static final String TASK_STATUS = "status"; public static final String TASK_DELETE = "delete"; + public static final String TASK_LOG_ROTATE = "logRotate"; public static final String TASK_REBALANCE_START = "rebalanceStart"; public static final String TASK_REBALANCE_STATUS = "rebalanceStatus"; public static final String TASK_REBALANCE_STOP = "rebalanceStop"; diff --git a/src/com.gluster.storage.management.gateway.scripts/src/backend/rrd_cpu.pl b/src/com.gluster.storage.management.gateway.scripts/src/backend/rrd_cpu.pl index 7b070812..30a66342 100755 --- a/src/com.gluster.storage.management.gateway.scripts/src/backend/rrd_cpu.pl +++ b/src/com.gluster.storage.management.gateway.scripts/src/backend/rrd_cpu.pl @@ -80,5 +80,5 @@ sub updatecpudata { $ERROR = RRDs::error; print "Error in RRD::update for cpu: $ERROR\n" if $ERROR; - print "N:$user:$system:$idle\n"; + #print "N:$user:$system:$idle\n"; } diff --git a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/VolumesResource.java b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/VolumesResource.java index d26f6acb..4303aa63 100644 --- a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/VolumesResource.java +++ b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/resources/v1_0/VolumesResource.java @@ -59,6 +59,7 @@ import static com.gluster.storage.management.core.constants.RESTConstants.RESOUR import static com.gluster.storage.management.core.constants.RESTConstants.RESOURCE_VOLUMES; import java.io.File; +import java.util.Arrays; import java.util.List; import javax.ws.rs.DELETE; @@ -194,7 +195,7 @@ public class VolumesResource extends AbstractResource { @FormParam(FORM_PARAM_MIGRATE_DATA) Boolean isMigrateData, @FormParam(FORM_PARAM_FORCED_DATA_MIGRATE) Boolean isForcedDataMigrate, @FormParam(FORM_PARAM_CIFS_ENABLE) Boolean enableCifs, @FormParam(FORM_PARAM_CIFS_USERS) String cifsUsers, - @FormParam(FORM_PARAM_BRICKS) String brickList) { + @FormParam(FORM_PARAM_BRICKS) String bricks) { if (clusterName == null || clusterName.isEmpty()) { throw new GlusterValidationException("Cluster name must not be empty!"); } @@ -229,7 +230,8 @@ public class VolumesResource extends AbstractResource { } volumeService.deleteCifsUsers(clusterName, volumeName); } - } else if (operation.equals(RESTConstants.FORM_PARAM_LOG_ROTATE)) { + } else if (operation.equals(RESTConstants.TASK_LOG_ROTATE)) { + List<String> brickList = Arrays.asList(bricks.split(",")); volumeService.logRotate(clusterName, volumeName, brickList); } else { volumeService.performVolumeOperation(clusterName, volumeName, operation); diff --git a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java index 6a8d75a4..eaf99c9c 100644 --- a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java +++ b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java @@ -686,9 +686,8 @@ public class VolumeService { } } - public void logRotate(String clusterName, String volumeName, String bricks) { + public void logRotate(String clusterName, String volumeName, List<String> brickList) { GlusterServer onlineServer = clusterService.getOnlineServer(clusterName); - List<String> brickList = Arrays.asList(bricks.split(",")); try { if (onlineServer == null) { throw new GlusterRuntimeException("No online servers found in cluster [" + clusterName + "]"); @@ -702,7 +701,7 @@ public class VolumeService { onlineServer = clusterService.getNewOnlineServer(clusterName); glusterUtil.logRotate(volumeName, brickList, onlineServer.getName()); } else { - throw new GlusterRuntimeException(e.getMessage()); + throw new GlusterRuntimeException("Volume [" + volumeName + "] log rotation failed!", e); } } } |