Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqlServerProtocol: New resource proposal #1377

Closed
johlju opened this issue Jun 17, 2019 · 2 comments · Fixed by #1511
Closed

SqlServerProtocol: New resource proposal #1377

johlju opened this issue Jun 17, 2019 · 2 comments · Fixed by #1511
Labels
resource proposal The issue is proposing a new resource in the resource module.

Comments

@johlju
Copy link
Member

johlju commented Jun 17, 2019

Description

This resource should enable, disable and manage protocol properties for each protocol 'Named Pipes', 'Shared Memory' and 'TCP/IP'.

For example this resource should manage the property ListenOnAllIPs, KeepAlive and Enabled which is protocol properties (see output below).

PS > $managedComputerObject.ServerInstances['SQL2017'].ServerProtocols

Parent              : Microsoft.SqlServer.Management.Smo.Wmi.ServerInstance
DisplayName         : Named Pipes
HasMultiIPAddresses : False
IsEnabled           : False
IPAddresses         : {}
ProtocolProperties  : {Enabled, PipeName}
Urn                 : ManagedComputer[@Name='SQLTEST']/ServerInstance[@Name='SQL2017']/ServerProtocol[@Name='Np']
Name                : Np
Properties          : {Name=DisplayName/Type=System.String/Writable=False/Value=Named Pipes, Name=HasMultiIPAddresses/T
                      ype=System.Boolean/Writable=False/Value=False, Name=IsEnabled/Type=System.Boolean/Writable=True/V
                      alue=False}
UserData            :
State               : Existing

Parent              : Microsoft.SqlServer.Management.Smo.Wmi.ServerInstance
DisplayName         : Shared Memory
HasMultiIPAddresses : False
IsEnabled           : True
IPAddresses         : {}
ProtocolProperties  : {Enabled}
Urn                 : ManagedComputer[@Name='SQLTEST']/ServerInstance[@Name='SQL2017']/ServerProtocol[@Name='Sm']
Name                : Sm
Properties          : {Name=DisplayName/Type=System.String/Writable=False/Value=Shared Memory, Name=HasMultiIPAddresses
                      /Type=System.Boolean/Writable=False/Value=False, Name=IsEnabled/Type=System.Boolean/Writable=True
                      /Value=True}
UserData            :
State               : Existing

Parent              : Microsoft.SqlServer.Management.Smo.Wmi.ServerInstance
DisplayName         : TCP/IP
HasMultiIPAddresses : True
IsEnabled           : True
IPAddresses         : {IP1, IP2, IP3, IP4...}
ProtocolProperties  : {Enabled, KeepAlive, ListenOnAllIPs}
Urn                 : ManagedComputer[@Name='SQLTEST']/ServerInstance[@Name='SQL2017']/ServerProtocol[@Name='Tcp']
Name                : Tcp
Properties          : {Name=DisplayName/Type=System.String/Writable=False/Value=TCP/IP, Name=HasMultiIPAddresses/Type=S
                      ystem.Boolean/Writable=False/Value=True, Name=IsEnabled/Type=System.Boolean/Writable=True/Value=T
                      rue}
UserData            :
State               : Existing

Proposed properties

[ClassVersion("1.0.0.0"), FriendlyName("SqlServerProtocol")]
class MSFT_SqlServerProtocol : OMI_BaseResource
{
    [Write, Description("The host name of the SQL Server to be configured. Default value is $env:COMPUTERNAME.")] String ServerName;
    [Key, Description("The name of the SQLf instance to be configured.")] String InstanceName;
    [Key, Description("The name of protocol to be configured."), ValueMap{"SharedMemory", "NamedPipes", "TcpIp"}, Values{"SharedMemory", "NamedPipes", "TcpIp"}] String ProtocolName;
    [Write, Description("Enables or disables the protocol.")] Boolean Enabled;
    [Write, Description("Specifies to listen on all IPs. Only used for the TCP/IP protocol.")] Boolean ListenOnAllIPs;
    [Write, Description("Specifies the keep alive duration. Only used for the TCP/IP protocol.")] UInt16 KeepAlive;
    [Write, Description("Specifies the named pipe name. Only used for the Named Pipes protocol.")] String PipeName;
    [Write, Description("If set to $true then SQL Server and dependent services will be restarted if a change to the configuration is made. The default value is $false.")] Boolean RestartService;
    [Write, Description("Timeout value for restarting the SQL Server services. The default value is 120 seconds.")] UInt16 RestartTimeout;
}

Special considerations or limitations

This is a redesign of the resource SqlServerNetwork and splitting it up into two new resources will simplify the code and therefore easier to maintain. This resource could be added side-by-side with SqlServerNetwork and together with SqlServerProtocolTcpIP will deprecate the resource SqlServerNetwork.
This was discussed in closed PR #1045.

@johlju johlju added help wanted The issue is up for grabs for anyone in the community. resource proposal The issue is proposing a new resource in the resource module. labels Jun 17, 2019
@johlju
Copy link
Member Author

johlju commented Jun 17, 2019

There might be some code that can be reused in the closed PR #1045.

@johlju
Copy link
Member Author

johlju commented Apr 17, 2020

Example code to verify and enable Named Pipes in this #1161 (comment).

@johlju johlju added in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Apr 22, 2020
johlju added a commit that referenced this issue May 4, 2020
- SqlServerDsc
  - Added new resource SqlServerProtocol (issue #1377).
  - When a PR is labelled with 'ready for merge' it is no longer being
    marked as stale if the PR is not merged for 30 days (for example it is
    dependent on something else) (issue #1504).
  - Updated the CI pipeline to use latest version of the module ModuleBuilder.
- SqlServerDsc.Common
  - The helper function `Restart-SqlService` was improved to handle Failover
    Clusters better. Now the SQL Server service will only be taken offline
    and back online again if the service is online to begin with.
  - The helper function `Restart-SqlServer` learned the new parameter
    `OwnerNode`. The parameter `OwnerNode` takes an array of Cluster node
    names. Using this parameter the cluster group will only be taken
    offline and back online if the cluster group owner is one specified
    in this parameter.
@johlju johlju removed the in progress The issue is being actively worked on by someone. label May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resource proposal The issue is proposing a new resource in the resource module.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant