Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ServiceFabric/ServiceFabric/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Removed `ReimageByName`, `ReimageById`, and `ReimageByObj` parameter sets from `Set-AzServiceFabricManagedNodeType`.
* Added parameters `-EnableAutoOsUpgrade` and `-AllowRdpAccess` to `New-AzServiceFabricManagedCluster` and `Set-AzServiceFabricManagedCluster`.
* Added parameters `-ZoneBalance`, `-AllowOverProvisioning`, and `-Zone` to `New-AzServiceFabricManagedNodeType` and `Set-AzServiceFabricManagedNodeType`.
* Added preannoucement for removing Reimage parameters from `Set-AzServiceFabricManagedNodeType`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ namespace Microsoft.Azure.Commands.ServiceFabric.Commands
[Cmdlet(VerbsCommon.Set, ResourceManager.Common.AzureRMConstants.AzurePrefix + Constants.ServiceFabricPrefix + "ManagedNodeType", DefaultParameterSetName = ByObj, SupportsShouldProcess = true), OutputType(new Type[] { typeof(bool), typeof(PSManagedNodeType) })]
public class SetAzServiceFabricManagedNodeType : ServiceFabricManagedCmdletBase
{
protected const string ReimageByName = "ReimageByName";
protected const string ReimageById = "ReimageById";
protected const string ReimageByObj = "ReimageByObj";
protected const string WithParamsByName = "WithParamsByName";
protected const string WithParamsById = "WithParamsById";
protected const string ByObj = "ByObj";
Expand All @@ -41,75 +38,34 @@ public class SetAzServiceFabricManagedNodeType : ServiceFabricManagedCmdletBase

[Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = WithParamsByName,
HelpMessage = "Specify the name of the resource group.")]
[Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = ReimageByName,
HelpMessage = "Specify the name of the resource group.")]
[ResourceGroupCompleter]
[ValidateNotNullOrEmpty()]
public string ResourceGroupName { get; set; }

[Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, ParameterSetName = WithParamsByName,
HelpMessage = "Specify the name of the cluster.")]
[Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, ParameterSetName = ReimageByName,
HelpMessage = "Specify the name of the cluster.")]
[ResourceNameCompleter(Constants.ManagedClustersFullType, nameof(ResourceGroupName))]
[ValidateNotNullOrEmpty()]
public string ClusterName { get; set; }

[Parameter(Mandatory = true, Position = 2, ValueFromPipelineByPropertyName = true, ParameterSetName = WithParamsByName,
HelpMessage = "Specify the name of the node type.")]
[Parameter(Mandatory = true, Position = 2, ValueFromPipelineByPropertyName = true, ParameterSetName = ReimageByName,
HelpMessage = "Specify the name of the node type.")]
[ValidateNotNullOrEmpty()]
[Alias("NodeTypeName")]
public string Name { get; set; }

[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ParameterSetName = WithParamsById,
HelpMessage = "Node type resource id")]
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ParameterSetName = ReimageById,
HelpMessage = "Node type resource id")]
[ValidateNotNullOrEmpty]
public string ResourceId { get; set; }

[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ParameterSetName = ByObj,
HelpMessage = "Node type resource")]
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ParameterSetName = ReimageByObj,
HelpMessage = "Node type resource")]
[ValidateNotNull]
public PSManagedNodeType InputObject { get; set; }

#endregion

#region reimage params
public const String ChangeDesc = "Parameter is being deprecated without being replaced, use Invoke-AzServiceFabricReimageManagedNodeType cmdlet instead.";
[CmdletParameterBreakingChangeWithVersion("NodeName", "15.0.0", "5.0.0", ChangeDescription = ChangeDesc)]
[Parameter(Mandatory = true, ParameterSetName = ReimageByName, HelpMessage = "List of node names for the operation.")]
[Parameter(Mandatory = true, ParameterSetName = ReimageById, HelpMessage = "List of node names for the operation.")]
[Parameter(Mandatory = true, ParameterSetName = ReimageByObj, HelpMessage = "List of node names for the operation.")]
[ValidateNotNullOrEmpty()]
public string[] NodeName { get; set; }

[CmdletParameterBreakingChangeWithVersion("Reimage", "15.0.0", "5.0.0", ChangeDescription = ChangeDesc)]
[Parameter(Mandatory = true, ParameterSetName = ReimageByName, HelpMessage = "List of node names for the operation.")]
[Parameter(Mandatory = true, ParameterSetName = ReimageById, HelpMessage = "List of node names for the operation.")]
[Parameter(Mandatory = true, ParameterSetName = ReimageByObj, HelpMessage = "List of node names for the operation.")]
public SwitchParameter Reimage { get; set; }

[CmdletParameterBreakingChangeWithVersion("ForceReimage", "15.0.0", "5.0.0", ChangeDescription = ChangeDesc)]
[Parameter(Mandatory = false, ParameterSetName = ReimageByName,
HelpMessage = "Using this flag will force the reimage even if service fabric is unable to disable the nodes. Use with caution as this might cause data loss if stateful workloads are running on the node.")]
[Parameter(Mandatory = false, ParameterSetName = ReimageById,
HelpMessage = "Using this flag will force the reimage even if service fabric is unable to disable the nodes. Use with caution as this might cause data loss if stateful workloads are running on the node.")]
[Parameter(Mandatory = false, ParameterSetName = ReimageByObj,
HelpMessage = "Using this flag will force the reimage even if service fabric is unable to disable the nodes. Use with caution as this might cause data loss if stateful workloads are running on the node.")]
public SwitchParameter ForceReimage { get; set; }

[CmdletParameterBreakingChangeWithVersion("PassThru", "15.0.0", "5.0.0", ChangeDescription = ChangeDesc)]
[Parameter(Mandatory = false, ParameterSetName = ReimageByName)]
[Parameter(Mandatory = false, ParameterSetName = ReimageById)]
[Parameter(Mandatory = false, ParameterSetName = ReimageByObj)]
public SwitchParameter PassThru { get; set; }
#endregion

#region set params

[Parameter(Mandatory = false, ParameterSetName = WithParamsByName, HelpMessage = "The number of nodes in the node type.")]
Expand Down Expand Up @@ -150,7 +106,6 @@ public class SetAzServiceFabricManagedNodeType : ServiceFabricManagedCmdletBase

#endregion


#endregion

public override void ExecuteCmdlet()
Expand All @@ -161,28 +116,6 @@ public override void ExecuteCmdlet()
NodeType updatedNodeTypeParams = null;
switch (ParameterSetName)
{
case ReimageByName:
case ReimageById:
case ReimageByObj:
if (ShouldProcess(target: this.Name, action: string.Format("Reimage node(s) {0}, from node type {1} on cluster {2}", string.Join(", ", this.NodeName), this.Name, this.ClusterName)))
{

var actionParams = new NodeTypeActionParameters(nodes: this.NodeName, force: this.ForceReimage.IsPresent);
var beginRequestResponse = this.SfrpMcClient.NodeTypes.BeginReimageWithHttpMessagesAsync(
this.ResourceGroupName,
this.ClusterName,
this.Name,
actionParams).GetAwaiter().GetResult();

this.PollLongRunningOperation(beginRequestResponse);
}

if (this.PassThru)
{
WriteObject(true);
}

return;
case WithParamsByName:
case WithParamsById:
updatedNodeTypeParams = this.GetUpdatedNodeTypeParams();
Expand Down Expand Up @@ -275,7 +208,6 @@ private void SetParams()
switch (ParameterSetName)
{
case ByObj:
case ReimageByObj:
if (string.IsNullOrEmpty(this.InputObject?.Id))
{
throw new ArgumentException("ResourceId is null.");
Expand All @@ -284,7 +216,6 @@ private void SetParams()
SetParametersByResourceId(this.InputObject.Id);
break;
case WithParamsById:
case ReimageById:
SetParametersByResourceId(this.ResourceId);
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ServiceFabric/ServiceFabric/help/Az.ServiceFabric.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Deallocate specific nodes from the node type.
Redeploy nodes from the node type.

### [Invoke-AzServiceFabricReimageManagedNodeType](Invoke-AzServiceFabricReimageManagedNodeType.md)
Reimage nodes from the node type.
Reimage nodes from the node type. On reimage operation the service fabric nodes will be disabled before reimaging the vms and enabled them back again once they come back. If this is done on primary node types it might take a while as it might not reimage all the nodes at the same time. Use -ForceReimage to force the operation even if service fabric is unable to disable the nodes but use with caution as this might cause data loss if stateful workloads are running on the node.

### [New-AzServiceFabricApplication](New-AzServiceFabricApplication.md)
Create new service fabric application under the specified resource group and cluster.
Expand Down Expand Up @@ -174,7 +174,7 @@ Update a service fabric managed application type version. This allows you to upd
Update a managed service from the cluster. Only supports ARM deployed services.

### [Set-AzServiceFabricManagedNodeType](Set-AzServiceFabricManagedNodeType.md)
Sets node type resource properties or run reimage actions on specific nodes of the node type with -Reimage parameter.
Sets node type resource properties.

### [Set-AzServiceFabricSetting](Set-AzServiceFabricSetting.md)
Add or update one or multiple Service Fabric settings to the cluster.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ schema: 2.0.0
# Invoke-AzServiceFabricReimageManagedNodeType

## SYNOPSIS
Reimage nodes from the node type.
Reimage nodes from the node type. On reimage operation the service fabric nodes will be disabled before reimaging the vms and enabled them back again once they come back. If this is done on primary node types it might take a while as it might not reimage all the nodes at the same time. Use -ForceReimage to force the operation even if service fabric is unable to disable the nodes but use with caution as this might cause data loss if stateful workloads are running on the node.

## SYNTAX

Expand All @@ -19,7 +19,7 @@ Invoke-AzServiceFabricReimageManagedNodeType [-ResourceGroupName] <String> [-Clu
```

## DESCRIPTION
Reimage nodes from the node type. The nodes will be disabled, reimaged, then renabled.
Reimage nodes from the node type. The nodes will be disabled, reimaged, then renabled. On reimage operation the service fabric nodes will be disabled before reimaging the vms and enabled them back again once they come back. If this is done on primary node types it might take a while as it might not reimage all the nodes at the same time. Use -ForceReimage to force the operation even if service fabric is unable to disable the nodes but use with caution as this might cause data loss if stateful workloads are running on the node.

## EXAMPLES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ schema: 2.0.0
# Set-AzServiceFabricManagedNodeType

## SYNOPSIS
Sets node type resource properties or run reimage actions on specific nodes of the node type with -Reimage parameter.
Sets node type resource properties.

## SYNTAX

Expand All @@ -26,39 +26,18 @@ Set-AzServiceFabricManagedNodeType [-ResourceGroupName] <String> [-ClusterName]
[-EphemeralStartPort <Int32>] [-EphemeralEndPort <Int32>] [-Capacity <Hashtable>]
[-PlacementProperty <Hashtable>] [-VmSize <String>] [-ZoneBalance <Boolean>]
[-EnableOverProvisioning <Boolean>] [-Zone <System.Collections.Generic.List`1[System.String]>] [-AsJob]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### ReimageByName
```
Set-AzServiceFabricManagedNodeType [-ResourceGroupName] <String> [-ClusterName] <String> [-Name] <String>
-NodeName <String[]> [-Reimage] [-ForceReimage] [-PassThru] [-AsJob]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

### WithParamsById
```
Set-AzServiceFabricManagedNodeType [-ResourceId] <String> [-AsJob] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

### ReimageById
```
Set-AzServiceFabricManagedNodeType [-ResourceId] <String> -NodeName <String[]> [-Reimage] [-ForceReimage]
[-PassThru] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
[-Confirm] [<CommonParameters>]
```

### ReimageByObj
```
Set-AzServiceFabricManagedNodeType [-InputObject] <PSManagedNodeType> -NodeName <String[]> [-Reimage]
[-ForceReimage] [-PassThru] [-AsJob] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Sets node type resource properties or run reimage actions on specific nodes of the node type with -Reimage parameter. On reimage operation the service fabric nodes will be disabled before reimaging the vms and enabled them back again once they come back. If this is done on primary node types it might take a while as it might not reimage all the nodes at the same time. Use -ForceReimage to force the operation even if service fabric is unable to disable the nodes but use with caution as this might cause data loss if stateful workloads are running on the node.
Sets node type resource properties.

## EXAMPLES

Expand Down Expand Up @@ -87,16 +66,6 @@ Update placement properties of the node type. This will overwrite older placemen
$rgName = "testRG"
$clusterName = "testCluster"
$NodeTypeName = "nt1"
Set-AzServiceFabricManagedNodeType -ResourceGroupName $rgName -ClusterName $clusterName -Name $NodeTypeName -Reimage -NodeName nt1_0, nt1_3
```

Reimage node 0 and 3 on the node type.

### Example 4
```powershell
$rgName = "testRG"
$clusterName = "testCluster"
$NodeTypeName = "nt1"
$nodeType = Get-AzServiceFabricManagedNodeType -ResourceGroupName $rgName -ClusterName $clusterName -Name $NodeTypeName

$nodeType.VmInstanceCount = 6
Expand All @@ -105,7 +74,7 @@ $nodeType | Set-AzServiceFabricManagedNodeType

Update the instance count of the node type, with piping.

### Example 5
### Example 4
```powershell
$rgName = "testRG"
$clusterName = "testCluster"
Expand Down Expand Up @@ -182,7 +151,7 @@ Specify the name of the cluster.

```yaml
Type: System.String
Parameter Sets: WithParamsByName, ReimageByName
Parameter Sets: WithParamsByName
Aliases:

Required: True
Expand Down Expand Up @@ -252,28 +221,12 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -ForceReimage
Using this flag will force the removal even if service fabric is unable to disable the nodes.
Use with caution as this might cause data loss if stateful workloads are running on the node.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: ReimageByName, ReimageById, ReimageByObj
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -InputObject
Node type resource

```yaml
Type: Microsoft.Azure.Commands.ServiceFabric.Models.PSManagedNodeType
Parameter Sets: ByObj, ReimageByObj
Parameter Sets: ByObj
Aliases:

Required: True
Expand Down Expand Up @@ -303,7 +256,7 @@ Specify the name of the node type.

```yaml
Type: System.String
Parameter Sets: WithParamsByName, ReimageByName
Parameter Sets: WithParamsByName
Aliases: NodeTypeName

Required: True
Expand All @@ -313,36 +266,6 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -NodeName
List of node names for the operation.

```yaml
Type: System.String[]
Parameter Sets: ReimageByName, ReimageById, ReimageByObj
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -PassThru
{{ Fill PassThru Description }}

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: ReimageByName, ReimageById, ReimageByObj
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -PlacementProperty
Placement tags applied to nodes in the node type as key/value pairs, which can be used to indicate where certain services (workload) should run. Updating this will override the current values.

Expand All @@ -358,27 +281,12 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -Reimage
Specify to reimage nodes on the node type.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: ReimageByName, ReimageById, ReimageByObj
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ResourceGroupName
Specify the name of the resource group.

```yaml
Type: System.String
Parameter Sets: WithParamsByName, ReimageByName
Parameter Sets: WithParamsByName
Aliases:

Required: True
Expand All @@ -393,7 +301,7 @@ Node type resource id

```yaml
Type: System.String
Parameter Sets: WithParamsById, ReimageById
Parameter Sets: WithParamsById
Aliases:

Required: True
Expand Down
Loading