Skip to content

Get-IscsiSession seems to lowercase the TargetNodeAddress attribute which causes issues for piping the object etc #17306

@travisghansen

Description

@travisghansen

Prerequisites

Steps to reproduce

Initially discussed on the kubernetes slack in the csi-windows channel.

Observe the below:

Get-IscsiTarget | ConvertTo-Json
{
    "CimInstanceProperties":  [
                                  {
                                      "Name":  "NodeAddress",
                                      "Value":  "iqn.2000-01.com.synology:XpenoDsm62x.csi-pvc-111-clustera",
                                      "CimType":  14,
                                      "Flags":  "Property, Key, NotModified",
                                      "IsValueModified":  false
                                  }
                              ],
    "NodeAddress":  "iqn.2000-01.com.synology:XpenoDsm62x.csi-pvc-111-clustera",
}


Get-IscsiSession | ConvertTo-Json
{
    "CimInstanceProperties":  [
                                  {
                                      "Name":  "TargetNodeAddress",
                                      "Value":  "iqn.2000-01.com.synology:xpenodsm62x.csi-pvc-111-clustera",
                                      "CimType":  14,
                                      "Flags":  "Property, NotModified",
                                      "IsValueModified":  false
                                  },
                              ],
    "TargetNodeAddress":  "iqn.2000-01.com.synology:xpenodsm62x.csi-pvc-111-clustera",
}

# difference
iqn.2000-01.com.synology:XpenoDsm62x.csi-pvc-111-clustera
iqn.2000-01.com.synology:xpenodsm62x.csi-pvc-111-clustera

# makes these fail
Disconnect-IscsiTarget -NodeAddress $iqn -Confirm:$false
Get-iSCSISession -IscsiTarget $t

Expected behavior

I can use the referenced target to delete a session, or disconnect a target via `NodeAddress` property.

Actual behavior

It depends on the particular use-case:

- `Disconnect-IscsiTarget -NodeAddress $iqn -Confirm:$false` - noop
- `Get-iSCSISession -IscsiTarget $t` - error below
- I'm sure there are other relevant scenarios where things fail due to the discrepancy

Error details

Get-iSCSISession -IscsiTarget $t
Get-iSCSISession : No matching MSFT_iSCSISession objects found by CIM query for enumerating instances of the ROOT/Microsoft/Windows/Storage/MSFT_iSCSISession class on the  CIM server, that are associated with the following instance: MSFT_iSCSITarget (NodeAddress =
"iqn.2000-01.com.synology:SynologyDSM7.d...). Verify query parameters and retry.
At line:1 char:1
+ Get-iSCSISession -IscsiTarget $t
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (MSFT_iSCSISession:String) [Get-IscsiSession], CimJobException
    + FullyQualifiedErrorId : CmdletizationQuery_NotFound,Get-IscsiSession

PS C:\Users\Administrator\Projects\democratic-csi> Get-Error
Get-Error : The term 'Get-Error' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-Error
+ ~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-Error:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


### Environment data

```powershell
$PSVersionTable

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


### Visuals

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.Resolution-ExternalThe issue is caused by external component(s).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions