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

xClusterNetwork: Role property never in desired state #175

Closed
claudiospizzi opened this issue Feb 16, 2018 · 2 comments · Fixed by #176
Closed

xClusterNetwork: Role property never in desired state #175

claudiospizzi opened this issue Feb 16, 2018 · 2 comments · Fixed by #176
Labels
bug The issue is a bug.

Comments

@claudiospizzi
Copy link
Contributor

Details of the scenario you tried and the problem that is occurring:
The xClusterNetwork will never be in desired state when you use the Role property. The root cause is, that at least on Windows Server 2016, the Role will be returned as string instead as integer. So instead of '3' it will return 'ClusterAndClient'. Because this is not equals, the resource will never be in desired state.

Version of the Operating System and PowerShell the DSC Target Node is running:
PowerShell 5.1

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
xFailOverCluster 1.9.0.0

@johlju johlju added bug The issue is a bug. in progress The issue is being actively worked on by someone. labels Feb 16, 2018
@johlju
Copy link
Member

johlju commented Feb 17, 2018

It seems that on Windows Server 2008 R2 and on Windows Server 2012 R2 the property Role is of type System.UInt32.

PS > (Get-ClusterNetwork).Role | gm

   TypeName: System.UInt32

Name        MemberType Definition
----        ---------- ----------
CompareTo   Method     int CompareTo(System.Object value), int CompareTo(uint32 value), int IComparable.CompareTo(Sy...
Equals      Method     bool Equals(System.Object obj), bool Equals(uint32 obj), bool IEquatable[uint32].Equals(uint3...
GetHashCode Method     int GetHashCode()
GetType     Method     type GetType()
GetTypeCode Method     System.TypeCode GetTypeCode(), System.TypeCode IConvertible.GetTypeCode()
ToBoolean   Method     bool IConvertible.ToBoolean(System.IFormatProvider provider)
ToByte      Method     byte IConvertible.ToByte(System.IFormatProvider provider)
ToChar      Method     char IConvertible.ToChar(System.IFormatProvider provider)
ToDateTime  Method     datetime IConvertible.ToDateTime(System.IFormatProvider provider)
ToDecimal   Method     decimal IConvertible.ToDecimal(System.IFormatProvider provider)
ToDouble    Method     double IConvertible.ToDouble(System.IFormatProvider provider)
ToInt16     Method     int16 IConvertible.ToInt16(System.IFormatProvider provider)
ToInt32     Method     int IConvertible.ToInt32(System.IFormatProvider provider)
ToInt64     Method     long IConvertible.ToInt64(System.IFormatProvider provider)
ToSByte     Method     sbyte IConvertible.ToSByte(System.IFormatProvider provider)
ToSingle    Method     float IConvertible.ToSingle(System.IFormatProvider provider)
ToString    Method     string ToString(), string ToString(System.IFormatProvider provider), string ToString(string f...
ToType      Method     System.Object IConvertible.ToType(type conversionType, System.IFormatProvider provider)
ToUInt16    Method     uint16 IConvertible.ToUInt16(System.IFormatProvider provider)
ToUInt32    Method     uint32 IConvertible.ToUInt32(System.IFormatProvider provider)
ToUInt64    Method     uint64 IConvertible.ToUInt64(System.IFormatProvider provider)

On Windows Server 2016 the property Role is of type Microsoft.FailoverClusters.PowerShell.ClusterNetworkRole.

PS > (Get-ClusterNetwork).Role | gm

   TypeName: Microsoft.FailoverClusters.PowerShell.ClusterNetworkRole

Name        MemberType Definition
----        ---------- ----------
CompareTo   Method     int CompareTo(System.Object target), int IComparable.CompareTo(System.Object obj)
Equals      Method     bool Equals(System.Object obj)
GetHashCode Method     int GetHashCode()
GetType     Method     type GetType()
GetTypeCode Method     System.TypeCode GetTypeCode(), System.TypeCode IConvertible.GetTypeCode()
HasFlag     Method     bool HasFlag(System.Enum flag)
ToBoolean   Method     bool IConvertible.ToBoolean(System.IFormatProvider provider)
ToByte      Method     byte IConvertible.ToByte(System.IFormatProvider provider)
ToChar      Method     char IConvertible.ToChar(System.IFormatProvider provider)
ToDateTime  Method     datetime IConvertible.ToDateTime(System.IFormatProvider provider)
ToDecimal   Method     decimal IConvertible.ToDecimal(System.IFormatProvider provider)
ToDouble    Method     double IConvertible.ToDouble(System.IFormatProvider provider)
ToInt16     Method     int16 IConvertible.ToInt16(System.IFormatProvider provider)
ToInt32     Method     int IConvertible.ToInt32(System.IFormatProvider provider)
ToInt64     Method     long IConvertible.ToInt64(System.IFormatProvider provider)
ToSByte     Method     sbyte IConvertible.ToSByte(System.IFormatProvider provider)
ToSingle    Method     float IConvertible.ToSingle(System.IFormatProvider provider)
ToString    Method     string ToString(), string ToString(string format, System.IFormatProvider provider), string To...
ToType      Method     System.Object IConvertible.ToType(type conversionType, System.IFormatProvider provider)
ToUInt16    Method     uint16 IConvertible.ToUInt16(System.IFormatProvider provider)
ToUInt32    Method     uint32 IConvertible.ToUInt32(System.IFormatProvider provider)
ToUInt64    Method     uint64 IConvertible.ToUInt64(System.IFormatProvider provider)
value__     Property   int value__ {get;set;}

And the actual value can be found in the property

PS > (Get-ClusterNetwork).Role.value__
3

So I suggest that if property Role is of type System.UInt32 then return the property .Role, if not, then return the property .Role.value__.

@claudiospizzi What do you think?

@johlju johlju changed the title xClusterNetwork with Role property never in desired state xClusterNetwork: Role property never in desired state Feb 17, 2018
@claudiospizzi
Copy link
Contributor Author

Yeah your solutions is fine for me. I've updated the PR.

johlju pushed a commit that referenced this issue Feb 17, 2018
- Changes to xClusterNetwork
  - Fix the test for the network role never in desired state (issue #175).
@johlju johlju removed the in progress The issue is being actively worked on by someone. label Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants