HewlettPackard / POSH-HPEOneView

PowerShell language bindings library for HPE OneView.
http://hewlettpackard.github.io/POSH-HPEOneView/
125 stars 52 forks source link

OVPS 5.20 Get-HPOVServerProfile | ConvertTo-HPOVPowerShellScript Fails #514

Closed ericholton closed 3 years ago

ericholton commented 4 years ago

Expected Behavior

I was hoping to capture the powershell equivalent of a server profile to make generating a new profile easier.

Actual Behavior

The function fails.

Steps to reproduce

Get-HPOVServerProfile | ConvertTo-HPOVPowerShellScript

# 1. Capture verbose output using the Get-HPOVCommandTrace for HPOneView.310 or newer, or append the -Verbose switch to your Cmdlet call.
# 2. Put your code and/or captured output here.

See the attached output file. convert-output.txt

Version Information

HPE OneView PowerShell Library Version (Get-HPOVVersion or $PSLibraryVersion): HPE OneView Appliance Version (Get-HPOVVersion -ApplianceVer):
Output from $PSVersionTable on your Windows Host:

PS C:\Users\Administrator\Desktop> Get-HPOVVersion

synergy.hpe.local                   LibraryVersion Path
-----------------                   -------------- ----
ApplianceVersion: 5.20.01.420365.00 5.20.2561.3357 C:\Program Files\WindowsPowerShell\Modules\HPOneView.520\5.20.256...

PS C:\Users\Administrator\Desktop> Get-HPOVVersion -ApplianceVer

synergy.hpe.local                   LibraryVersion Path
-----------------                   -------------- ----
ApplianceVersion: 5.20.01.420365.00 5.20.2561.3357 C:\Program Files\WindowsPowerShell\Modules\HPOneView.520\5.20.256...

# Output from $PSVersionTable
PS C:\Users\Administrator\Desktop> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.14409.1005
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14409.1005
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
ChrisLynchHPE commented 4 years ago

Sorry, but the log file you provided does not contain any helpful indication to what your issue is. Can you please be specific in what commands you are trying to execute, and what exact error message you are getting? Please try to copy and paste text and not create screenshots, as they tend to be blurry and hard to read in most cases.

ericholton commented 4 years ago

I don't understand Chris. I only attached text files. No screen shots. This is the command that isn't working:

Get-HPOVServerProfile | ConvertTo-HPOVPowerShellScript

The verbose output of the command is attached in the original issue.

Thanks, Eric

ChrisLynchHPE commented 4 years ago

But without the error message captured, I have nothing to go on to identify what the issue is. And simply providing the Cmdlet used here unforatunately is not enough. There is something specific about the server profile that is probably causing the issue that I otherwise cannot reproduce.

One other way to help here is to provide the generated JSON file in the following:

Get-HPOVServerProfile | ConvertTo-Json -Depth 99 | Out-File $env:Temp\server-profiles.json

I could then attempt to figure out what is causing the issue with the ConvertTo-HPOVPowerShellScript Cmdlet.

ericholton commented 4 years ago

Here you go. Thanks! server-profile.txt

ericholton commented 4 years ago

Sorry, I didn't notice the slight difference between the requested command for this issue and the other one. Here is the requested output. Thanks! server-profiles.txt

ChrisLynchHPE commented 4 years ago

I'm not finding anything particularly wrong here. I still cannot identify where the issue is. Can you try capture this again using the following:

$ScriptBlock = { Get-HPOVServerProfile | ConvertTo-HPOVPowerShellScript }
Get-HPOVCommandTrace -ScriptBlock $ScriptBlock

Then attach the file created.

ericholton commented 4 years ago

Here you go. Thanks! 2010301923_HPOV_transcript.log

ChrisLynchHPE commented 4 years ago

Thanks. And one more, which should help me stitch together the pieces:

$Error | fl * -force | clip

Then paste your clipboard.

ericholton commented 4 years ago

Here you go. Thanks! error.log

ChrisLynchHPE commented 4 years ago

I see what the problem is. There are profiles where the connection contains unassigned connections. Is that intentional? The Cmdlet doesn't support that today, as its use case is very specific and not very broad. Can you remove that connection, or assign it a network?

For instance, server profile HA-DRS-Cluster-Node1 connection ID 4 is not assigned to a network (the networkUri property is null):

{
  "id": 4,
  "name": "Management-B",
  "functionType": "Ethernet",
  "networkUri": null,
  "portId": "Mezz 3:2-a",
  "requestedVFs": "0",
  "allocatedVFs": 0,
  "interconnectUri": "/rest/interconnects/45457745-744b-4394-b2bc-dd771845bf1f",
  "macType": "Physical",
  "wwpnType": "Physical",
  "mac": "94:40:C9:6B:BF:2D",
  "wwnn": null,
  "wwpn": null,
  "requestedMbps": "0",
  "allocatedMbps": 0,
  "maximumMbps": 0,
  "ipv4": null,
  "boot": {
    "priority": "NotBootable"
  },
  "state": "Reserved",
  "status": "Disabled",
  "managed": true,
  "networkName": null,
  "lagName": null,
  "interconnectPort": 4,
  "isolatedTrunk": false,
  "privateVlanPortType": "None"
}
ericholton commented 4 years ago

I just checked and all connections do have an assigned network. However, the get-hpovserverprofile -name HA-DRS-Cluster-Node1 | ConvertTo-HPOVPowerShellScript now works. I am assuming someone changed the config.

I am very sorry to have wasted your time on this one but thank you very much for your help!

ChrisLynchHPE commented 4 years ago

Well, it was because there were connections without networks assigned, which is allowed. But the library just didn't handle that correctly. I'm adding support for it, which in the future shouldn't cause this again.

ChrisLynchHPE commented 3 years ago

This is now addressed in the following releases:

Closing.