#region Copyright /* * Copyright © 2014-2016 NetApp, Inc. All Rights Reserved. * * CONFIDENTIALITY NOTICE: THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION OF * NETAPP, INC. USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED WITHOUT THE PRIOR * EXPRESS WRITTEN PERMISSION OF NETAPP, INC. */ #endregion #region Using Directives using System.ComponentModel; using System.Management.Automation; using SolidFire.Core; using SolidFire.Element.Api; using System.Linq; #endregion namespace SolidFire.Cluster.Set { /// /// Set-SFClusterFullThreshold is used to change the level at which an event is generated when the storage cluster approaches the capacity utilization requested. /// The number entered in this setting is used to indicate the number of node failures the system is required to recover from. /// For example, on a 10 node cluster, if you want to be alerted when the system cannot recover from 3 nodes failures, enter the value of \"3\". /// When this number is reached, a message alert is sent to the Event Log in the Cluster Management Console. /// [Cmdlet(VerbsCommon.Set, "SFClusterFullThreshold", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.High)] public class SetSFClusterFullThreshold : SFCmdlet { #region Private Data private long? _stage2AwareThreshold; private long? _stage3BlockThresholdPercent; private long? _maxMetadataOverProvisionFactor; #endregion #region Parameters [Parameter(Position = 0, Mandatory = false, ParameterSetName ="Stage2AwareThreshold", HelpMessage = "Number of nodes worth of capacity remaining on the cluster that triggers a notification. For version Nitrogen (7.0) or lower.")] public long Stage2AwareThreshold { get { return _stage2AwareThreshold.HasValue ? _stage2AwareThreshold.Value : 0; } set { _stage2AwareThreshold = value; } } [Parameter(Position = 0, Mandatory = false, ParameterSetName ="Stage3BlockThresholdPercent", HelpMessage = "The percent value set for stage3. At this percent full, a warning will be posted in the Alerts log. For version Oxygen (8.0) or higher.")] public long Stage3BlockThresholdPercent { get { return _stage3BlockThresholdPercent.HasValue ? _stage3BlockThresholdPercent.Value : 0; } set { _stage3BlockThresholdPercent = value; } } [Parameter(Position = 1, Mandatory = true, HelpMessage = "A value representative of the number of times metadata space can be over provisioned relative to the amount of space available.")] public long MaxMetadataOverProvisionFactor { get { return _maxMetadataOverProvisionFactor.HasValue ? _maxMetadataOverProvisionFactor.Value : 0; } set { _maxMetadataOverProvisionFactor = value; } } #endregion #region Cmdlet Overrides protected override void BeginProcessing() { base.BeginProcessing(); CheckConnection(); } protected override void ProcessRecord() { base.ProcessRecord(); var request = new ModifyClusterFullThresholdRequest() { Stage2AwareThreshold = _stage2AwareThreshold, Stage3BlockThresholdPercent = _stage3BlockThresholdPercent, MaxMetadataOverProvisionFactor = _maxMetadataOverProvisionFactor }; var objsFromApi = SendRequest("ModifyClusterFullThreshold", request); WriteObject(objsFromApi.Select(obj => obj.Result)); } #endregion } }