Details of the scenario you tried and the problem that is occurring
I connect to get the target portal to get the target nodes. When running the DSC script the first time, it connects to the target and get's the current targets. No issues here. I now go back and add a new target and I want to initiate that new target. iSCSIInitiator resource can't find the new target because the connection hasn't been updated to reflect that.
Verbose logs showing the problem
VERBOSE: [DEV-TEST-DELETE]: [[iSCSIInitiator]iSCSIInitiator-tgt1] Set-TargetResource: Ensuring iSCSI Target 'iqn.2010-06.com.nutanix:dev-test-vg-delete-63dc3822-a5a1-4ad8-b8b2-db6bd27addff-
tgt1' is connected.
VERBOSE: [DEV-TEST-DELETE]: LCM: [ End Set ] [[iSCSIInitiator]iSCSIInitiator-tgt1] in 0.0620 seconds.
PowerShell DSC resource DSR_iSCSIInitiator failed to execute Set-TargetResource functionality with error message: The running command stopped because the preference variable "ErrorActionPreference" or common
parameter is set to Stop: The target name is not found or is marked as hidden from login.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : DEV-TEST-DELETE
Running Update-IscsiTarget to refresh the targets and then running the config again works fine.
Another option would be to check if target exists and if doesn't then run Update-IscsiTargetPortal. If after this it fails, then it really should be an error.
You can run Update-IscsiTarget, but it does take much longer than Update-IscsiTargetPortal and it appears to list the target as it should.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
Details of the scenario you tried and the problem that is occurring
I connect to get the target portal to get the target nodes. When running the DSC script the first time, it connects to the target and get's the current targets. No issues here. I now go back and add a new target and I want to initiate that new target. iSCSIInitiator resource can't find the new target because the connection hasn't been updated to reflect that.
Verbose logs showing the problem
Running
Update-IscsiTarget
to refresh the targets and then running the config again works fine.Suggested solution to the issue
A few possible solutions.
Add a new parameter to force refresh of target.
Another option would be to check if target exists and if doesn't then run
Update-IscsiTargetPortal
. If after this it fails, then it really should be an error.You can run
Update-IscsiTarget
, but it does take much longer than Update-IscsiTargetPortal and it appears to list the target as it should.The DSC configuration that is used to reproduce the issue (as detailed as possible)