dsccommunity / iSCSIDsc

DSC resources for configuring Windows iSCSI targets and initiators.
https://dsccommunity.org
MIT License
7 stars 10 forks source link

iSCSIInitiator TargetPortalAddress should be a key property #59

Open nyanhp opened 4 years ago

nyanhp commented 4 years ago

Details of the scenario you tried and the problem that is occurring

My customer is trying to connect two target portals on their NetApp from one initiator address. Since the TargetPortalAddress is not a key property, this is not possible.

Verbose logs showing the problem

MOF creation already fails due to duplicate key constraints (Same NodeAddress, different TargetPortalAddress)

Test-ConflictingResources : A conflict was detected between resources '[iSCSIInitiator]i1 (::5::5::iSCSIInitiator)' and '[iSCSIInitiator]i2 (::11::5::iSCSIInitiator)' in node 'localhost'. Resources have 
identical key properties but there are differences in the following non-key properties: 'TargetPortalAddress'. Values '10.1.1.10' don't match values '10.1.129.10'. Please update these property values so 
that they are identical in both cases.
At line:289 char:9
+         Test-ConflictingResources $keywordName $canonicalizedValue $k ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], InvalidOperationException
    + FullyQualifiedErrorId : ConflictingDuplicateResource,Test-ConflictingResources
Compilation errors occurred while processing configuration 'co'. Please review the errors reported in error stream and modify your configuration code appropriately.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:3917 char:5
+     throw $ErrorRecord
+     ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (co:String) [], InvalidOperationException
    + FullyQualifiedErrorId : FailToProcessConfiguration

Suggested solution to the issue

Make TargetPortalAddress a key property. I'd be happy to do it if you think it makes sense.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

configuration co
{
    Import-DscResource -ModuleName iscsidsc

    iSCSIInitiator i1
    {
        NodeAddress = '192.168.2.12'
        TargetPortalAddress = '10.1.1.10'
    }

    iSCSIInitiator i2
    {
        NodeAddress = '192.168.2.12'
        TargetPortalAddress = '10.1.129.10'
    }
}
co -Verbose

The operating system the target node is running

OsName               : Microsoft Windows 10 Pro
OsOperatingSystemSKU : 48
OsArchitecture       : 64-bit
WindowsVersion       : 1909
WindowsBuildLabEx    : 18362.1.amd64fre.19h1_release.190318-1202
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

Name                           Value                                                                                                                                                                        
----                           -----                                                                                                                                                                        
PSVersion                      5.1.18362.752                                                                                                                                                                
PSEdition                      Desktop                                                                                                                                                                      
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                      
BuildVersion                   10.0.18362.752                                                                                                                                                               
CLRVersion                     4.0.30319.42000                                                                                                                                                              
WSManStackVersion              3.0                                                                                                                                                                          
PSRemotingProtocolVersion      2.3                                                                                                                                                                          
SerializationVersion           1.1.0.1 

Version of the DSC module that was used ('dev' if using current dev branch)

1.5.0.41