VMware Cloud Community
cvv2
Contributor
Contributor

error deploying new vm (guest os 2022) with Get-ContentLibraryItem

Any one seeing this also::

Powercli version 12.7

Delpoy new vm 

Get-ContentLibraryItem –Name WS2022 | New-VM –Name vmname -datastore datastorename -ResourcePool clustername

Fails

New-VM An error occurred while trying to retrieve the content library item VM template info. For more details check the inner exception.

Deploying (existing) 2016 an 2019 content library items) works fine.

Deploying 2022 template with/in vcenter (GUI) works fine also.

In the error you see things about the guest_os, so I changed the guest os in the 2022 template to 2019.

Deploy with powercli is now working

Did I run into a bug?

 

ErrorId : ViCore.Impl.V1.Service.VmServiceImpl.DeployContentLibraryTemplate.GetVMTemplateInfoError
ErrorCategory : NotSpecified
TargetObject :
RecommendedAction :
SessionId :
ConnectionId :
Severity : Error
TargetSite : Boolean ErrorCallback(VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.VimException)
StackTrace : at VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM.ErrorCallback(VimException error)
at VMware.VimAutomation.Sdk.Util10.ErrorHandling.CustomErrorCallback.ProcessError(VimException error)
at VMware.VimAutomation.Sdk.Impl.V1.ErrorHandling.CoreErrorServiceImpl.ProcessError(VimException ex)
at VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM.DoWork(VIAutomation client, List`1 moList)
at VMware.VimAutomation.ViCore.Util10Ps.BaseCmdlet.BaseCmdlet.DoWork(VIConnection connection, List`1 moList)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.BaseCmdlet.DoWorkEx(VIConnection connection, List`1 moList)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ConnectionDispatchHelper.ExecuteRunlist(Dictionary`2 runlist, DoWorkDelegate doWorkDelegate, UidDispatchHelper uidDispatchHelper, List`1 result)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ConnectionDispatchHelper.DispatchObjects(DoWorkDelegate doWorkDelegate, UidDispatchHelper uidDispatchHelper, IList`1 connectionList, Boolean isConnectionListExplicit, IList`1 moListFromCmdletParameter, String moListFromCmdletPara
meterName, Boolean isServerParameterObnOnly)
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.BaseCmdlet.ProcessRecordErrorHandled()
at VMware.VimAutomation.ViCore.Util10Ps.BaseCmdlet.BaseCmdlet.ProcessRecordErrorHandled()
Message : 2-9-2022 08:16:37 New-VM An error occurred while trying to retrieve the content library item VM template info. For more details check the inner exception.
Data : {IsDistributedTerminatingError, ParameterValues}
InnerException : System.AggregateException: One or more errors occurred. (com.vmware.vapi.std.errors.internal_server_error {'messages': [com.vmware.vapi.std.localizable_message {'id': vapi.bindings.typeconverter.tovalue.struct.field.missing, 'default_message': Required field 'guest_OS' of structu
re 'com.vmware.vcenter.vm_template.library_items.info' is missing, 'args': [guest_OS, com.vmware.vcenter.vm_template.library_items.info], 'params': , 'localized':}], 'data': , 'error_type': INTERNAL_SERVER_ERROR})
---> vmware.vapi.std.errors.InternalServerError: com.vmware.vapi.std.errors.internal_server_error {'messages': [com.vmware.vapi.std.localizable_message {'id': vapi.bindings.typeconverter.tovalue.struct.field.missing, 'default_message': Required field 'guest_OS' of structure 'com
.vmware.vcenter.vm_template.library_items.info' is missing, 'args': [guest_OS, com.vmware.vcenter.vm_template.library_items.info], 'params': , 'localized':}], 'data': , 'error_type': INTERNAL_SERVER_ERROR}
at vmware.vapi.bindings.Stub.InvokeMethodAsync[R](MethodIdentifier methodId, StructValueBuilder structValueBuilder, StructType inputType, IType outputType, IEnumerable`1 errorTypes, InvocationConfig invocationConfig, Action`1 progressHandle)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at vmware.vapi.bindings.Stub.InvokeMethod[R](MethodIdentifier methodId, StructValueBuilder structValueBuilder, StructType inputType, IType outputType, IEnumerable`1 errorTypes, InvocationConfig invocationConfig, Action`1 progressHandle)
at vmware.vcenter.vm_template.LibraryItemsStub.Get(String templateLibraryItem, Action`1 _progress, InvocationConfig _invocationConfig)
at vmware.vcenter.vm_template.LibraryItemsStub.Get(String templateLibraryItem)
at VMware.VimAutomation.ViCore.Impl.V1.Cis.ApiFacade.Impl.CisVMTemplateLibraryItemsService.Get(String libraryItemId)
at VMware.VimAutomation.ViCore.Impl.V1.Service.VmServiceImpl.DeployContentLibraryTemplate(ContentLibraryItemInterop template, VMHostInterop vmhost, String name, VIContainerInterop resourcePool, FolderInterop location, StorageResourceInterop datastore, StoragePolicyInterop stor
agePolicy, String notes, OSCustomizationSpecInterop osCustomizationSpec, Int32 cpuCount, Int32 coresPerSocket, Decimal memoryMB, Int64[] diskCapacities, String[] networkNames, VirtualPortGroupBaseInterop[] portgroups)
HelpLink :
Source : VMware.VimAutomation.ViCore.Cmdlets
HResult : -2146232832

Labels (1)
Reply
0 Kudos
8 Replies
LucD
Leadership
Leadership

That looks indeed like a "feature".
I would suggest opening an SR


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

cvv2
Contributor
Contributor

Did create a SR to VMware but we do not have support for powercli scripts, SDK's or API's related issues. pointed me to vmware code.

For now I resolved it to set the right guest os after new vm is deployed with the server 2022 template on guest os 2019.

But the question now is: How to report this bug? Or getting the right people to read this 🙂

 

Reply
0 Kudos
LucD
Leadership
Leadership

If GSS told you that you need a Developer Support COntract for PowerCLI, they are wrong (an error they often make).
Point them to the Help and Support for VMware PowerCLI section in the PowerCLI User's Guide

It clearly states

You can file a technical support request under the terms of a Basic or Production Suport contract with VMware. You can get support for the following types of problems.

  • Cmdlets are not working as documented.
  • Installation problems with PowerCLI.

 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

cvv2
Contributor
Contributor

VMware has confirmed that it is a bug in VMware vCenter, solved in VMware vCenter Server 7.0 Update 3e

Reply
0 Kudos
kennycomputer
Contributor
Contributor

Yep, this is a bug

Reply
0 Kudos
mathiel
Enthusiast
Enthusiast

seems the same bug as described here:

https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/get-vm-tag-tagname-no-longer-working/t...

solution worked for me:

Get the current memory allocated to the service
# cloudvm-ram-size -l | grep vmware-infraprofile

Example: vmware-infraprofile = 332

Doubling the memory should be enough to fix the issue, however in case it does not fix it you can further increase the memory.
# cloudvm-ram-size -C 664 vmware-infraprofile

Check the memory status again to confirm the change
# cloudvm-ram-size -l | grep vmware-infraprofile

Example: vmware-infraprofile = 684

Then restart the infraprofile service
# service-control --stop vmware-infraprofile && service-control --start vmware-infraprofile

Workaround
Restart the image infraprofile service may fix the issue until the service has OOM again
# service-control --stop vmware-infraprofile && service-control --start vmware-infraprofile

 

Reply
0 Kudos
LucD
Leadership
Leadership

That link is not working


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
mathiel
Enthusiast
Enthusiast

fixed it!

Reply
0 Kudos