HewlettPackard / POSH-HPEOneView

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

PoSH Update-OVServerProfile Staging Updates - Error #662

Open ChrisLynchHPE opened 1 year ago

ChrisLynchHPE commented 1 year ago

Discussed in https://github.com/HewlettPackard/POSH-HPEOneView/discussions/661

Originally posted by **KeithS011** November 3, 2023 ### Expected Behavior Update-OVServerProfile -ServerName "Server" -Stage -Confirm:$false should stage updates that require reboot, as of 8.30.3660.2366 update. Such as Firmware baseline when reapplying from the ServerProfileTemplate, and apply them when the server is next powered down via HPEOV. ### Actual Behavior ```json errorCode":"ServerNotOffWithCauseForNoServerChange","errorSource":null,"message":"The requested changes cannot be applied because {\"name\":\"Redacted, bay 12\", \"uri\":\"/rest/server-hardware/Redacted\"} is powered on and the changes made to the following sections can only be applied when the power is off: \n* Firmware","nestedErrors":[],"recommendedActions":["Power off the server or adjust the settings and retry. {\"name\":\"Learn more\", \"uri\":\"/doc#/cic/profiles/edit\"}"]}],"taskOutput":[],"taskState":"Error","taskStatus":"Unable to edit server profile: Redacted." ``` ### Steps to reproduce ```PowerShell Update-OVServerProfile -ServerName "Server" -Stage -Confirm:$false ``` [Get-OVCommandTrace-log.txt](https://github.com/HewlettPackard/POSH-HPEOneView/files/13257588/Get-OVCommandTrace-log.txt) ### Version Information HPE OneView PowerShell Library Version (`Get-HPOVVersion` or `$PSLibraryVersion`): ApplianceVersion: 8.30.01.482646.00 8.30.3660.2366 C:\Program Files\WindowsPowerShell\Modules\HPEOneView.830\8.30.3660.2366 ```PowerShell Name Value ---- ----- PSVersion 7.2.6 PSEdition Core GitCommitId 7.2.6 OS Microsoft Windows 10.0.14393 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0 ``` Log has been sanitized.
ChrisLynchHPE commented 1 year ago

I found and have resolved the issue. It was a logic validation issue. Here is what the experience will look like:

[PS] C:\Users\user> Get-OVServerProfile -name prf1

Name Status  Compliance   Template Server Hardware Server Hardware Type Enclosure Group Affinity
---- ------  ----------   -------- --------------- -------------------- --------------- --------
prf1 Warning NotCompliant spt1     172.18.31.1     DL380 Gen10

[PS] C:\Users\user> Get-OVServerProfile -name prf1 | Update-OVServerProfile -stage

Confirm
Are you sure you want to perform this action?
Performing the operation "Update Server Profile configuration. WARNING: Depending on this action, there might be a
brief outage." on target "prf1".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):

Appliance             Name                 Owner         Created              Duration TaskState PercentComplete
---------             ----                 -----         -------              -------- --------- ---------------
OV5.doctors-lab.local Update from template Administrator 11/8/2023 5:40:59 PM 00:00:01 Completed 100

[PS] C:\Users\user> Get-OVServerProfile -name prf1

Name Status  Compliance        Template Server Hardware Server Hardware Type Enclosure Group Affinity
---- ------  ----------        -------- --------------- -------------------- --------------- --------
prf1 Warning PendingCompliance spt1     172.18.31.1     DL380 Gen10
KeithS011 commented 11 months ago

was this not updated in the 8.30 module download ? I grabbed it again today, and still getting the same error as before.

$stage = Get-OVServerProfile -Name $SP | Update-OVServerProfile -stage

$stage.taskErrors

data : details : errorCode : ServerNotOffWithCauseForNoServerChange errorSource : message : The requested changes cannot be applied because {"name":"redacted, bay 1", "uri":"/rest/server-hardware/redacted"} is powered on and the changes made to the following sections can only be applied when the power is off:

ChrisLynchHPE commented 1 month ago

This was resolved in the recently released 8.60, 9.00 and 9.10 PowerShell libraries.