vmware / powerclicore

PowerCLI Core Dockerfile
Apache License 2.0
97 stars 48 forks source link

Latest (12.2) docker image fails to export VMs #53

Closed muppet3000 closed 3 years ago

muppet3000 commented 3 years ago

When using the following command:

Get-VM -Name $vmForExport | Export-VApp -Destination $exportPath -Format OVA

(vmForExport and exportPath are sensible strings)

The command fails with the following output:

Export-VApp: /opt/export_vm.ps1:32
Line |
  32 |  … -Name $vmForExport | Export-VApp -Destination $exportPath -Format OVA
     |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | 03/04/2021 10:58:11 Export-VApp  The operation is not supported on the object.

If this is a change to the functionality of the Export-VApp command please let me know and I will update our scripts (I'm unable to find any changelogs for the latest version of PowerCLI). Currently I've had to revert back to the Ubuntu 16.04 docker image.

dmilov commented 3 years ago

It's sounds like an Export-vApp failure, not the container itself. Can you grab the error details to understand more

$error[0] | select * $error[0].Exception | select *

muppet3000 commented 3 years ago

@dmilov I've added those lines after the export line and this is the output. (I've redacted the VIServer)


Exception             : VMware.VimAutomation.ViCore.Types.V1.ErrorHandling.NotSupported: 03/05/2021 08:11:41    Export-VApp             The operation is not supported on
                        the object.
                         ---> VMware.Vim.VimException: The operation is not supported on the object.
                         ---> System.ServiceModel.FaultException: The operation is not supported on the object.
                           at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
                           at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins,
                         Object[] outs, TimeSpan timeout)
                           at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins,
                         Object[] outs)
                           at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(MethodCall methodCall, ProxyOperationRuntime operation)
                           at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(MethodInfo targetMethod, Object[] args)
                        --- End of stack trace from previous location ---
                           at System.Reflection.DispatchProxyGenerator.Invoke(Object[] args)
                           at generatedProxy_1.HttpNfcLeaseSetManifestChecksumType(HttpNfcLeaseSetManifestChecksumTypeRequest )
                           at VMware.Vim.HttpNfcLease.HttpNfcLeaseSetManifestChecksumType(KeyValue[] deviceUrlsToChecksumTypes)
                           --- End of inner exception stack trace ---
                           at VMware.Vim.HttpNfcLease.HttpNfcLeaseSetManifestChecksumType(KeyValue[] deviceUrlsToChecksumTypes)
                           at VMware.VimAutomation.ViCore.Impl.V1.Service.VappServiceImpl.ExportLeaseTaskToContainer(NfcLease lease, ManagedObjectReference
                        nfcLeaseReference, String exportName, VimClient vimClient, String description, ManagedObjectReference vappReference, ExportContainer
                         exportContainer, ClientSideTask task, SHAAlgorithm shaAlgorithm)
                           at VMware.VimAutomation.ViCore.Impl.V1.Service.VappServiceImpl.<>c__DisplayClass12_2.<ExportVAppToContainer>b__1(NfcLease lease)
                           at VMware.VimAutomation.ViCore.Impl.V1.Host.Storage.NfcLease.RunNfcLeaseTask(NfcLeaseTask leaseTask)
                           --- End of inner exception stack trace ---
                           at VMware.VimAutomation.ViCore.Impl.V1.Host.Storage.NfcLease.RunNfcLeaseTask(NfcLeaseTask leaseTask)
                           at VMware.VimAutomation.ViCore.Impl.V1.Service.VappServiceImpl.<>c__DisplayClass12_0.<ExportVAppToContainer>b__0(ClientSideTask t
                        ask, Object taskResult)
                           at VMware.VimAutomation.Sdk.Util10.Task.ClientSideTaskImpl.ThreadProc(Object obj)
TargetObject          :
CategoryInfo          : NotSpecified: (:) [Export-VApp], NotSupported
FullyQualifiedErrorId : Client20_NfcLease_RunNfcTask_Error,VMware.VimAutomation.ViCore.Cmdlets.Commands.ExportVApp
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, /opt/deployment/packaging/export_vm.ps1: line 32
PipelineIterationInfo : {0, 1, 1}

DynamicType             :
DynamicPropertyInternal :
FaultCause              :
FaultMessage            :
ErrorId                 : Client20_NfcLease_RunNfcTask_Error
ErrorCategory           : NotSpecified
TargetObject            :
RecommendedAction       :
SessionId               :
ConnectionId            : /VIServer=REDACTED
Severity                : Error
TargetSite              : Void RunNfcLeaseTask(VMware.VimAutomation.ViCore.Impl.V1.Host.Storage.NfcLeaseTask)
StackTrace              :    at VMware.VimAutomation.ViCore.Impl.V1.Host.Storage.NfcLease.RunNfcLeaseTask(NfcLeaseTask leaseTask)
                             at VMware.VimAutomation.ViCore.Impl.V1.Service.VappServiceImpl.<>c__DisplayClass12_0.<ExportVAppToContainer>b__0(ClientSideTask
                           task, Object taskResult)
                             at VMware.VimAutomation.Sdk.Util10.Task.ClientSideTaskImpl.ThreadProc(Object obj)
Message                 : 03/05/2021 08:11:41   Export-VApp             The operation is not supported on the object.
Data                    : {ParameterValues}
InnerException          : VMware.Vim.VimException: The operation is not supported on the object.
                           ---> System.ServiceModel.FaultException: The operation is not supported on the object.
                             at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
                             at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] in
                          s, Object[] outs, TimeSpan timeout)
                             at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] in
                          s, Object[] outs)
                             at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(MethodCall methodCall, ProxyOperationRuntime operation)
                             at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(MethodInfo targetMethod, Object[] args)
                          --- End of stack trace from previous location ---
                             at System.Reflection.DispatchProxyGenerator.Invoke(Object[] args)
                             at generatedProxy_1.HttpNfcLeaseSetManifestChecksumType(HttpNfcLeaseSetManifestChecksumTypeRequest )
                             at VMware.Vim.HttpNfcLease.HttpNfcLeaseSetManifestChecksumType(KeyValue[] deviceUrlsToChecksumTypes)
                             --- End of inner exception stack trace ---
                             at VMware.Vim.HttpNfcLease.HttpNfcLeaseSetManifestChecksumType(KeyValue[] deviceUrlsToChecksumTypes)
                             at VMware.VimAutomation.ViCore.Impl.V1.Service.VappServiceImpl.ExportLeaseTaskToContainer(NfcLease lease, ManagedObjectReferenc
                          e nfcLeaseReference, String exportName, VimClient vimClient, String description, ManagedObjectReference vappReference, ExportConta
                          iner exportContainer, ClientSideTask task, SHAAlgorithm shaAlgorithm)
                             at VMware.VimAutomation.ViCore.Impl.V1.Service.VappServiceImpl.<>c__DisplayClass12_2.<ExportVAppToContainer>b__1(NfcLease lease
                          )
                             at VMware.VimAutomation.ViCore.Impl.V1.Host.Storage.NfcLease.RunNfcLeaseTask(NfcLeaseTask leaseTask)
HelpLink                :
Source                  : VMware.VimAutomation.ViCore.Impl
HResult                 : -2146232832
dmilov commented 3 years ago

Yes, there is Export-VApp change in PowerCLI 12.2. There is a new parameter -SHAAlgorithm which sets the default to SHA256. In the previous version the param was missing but the default was SHA1. It is a breaking change but the decision was motivated with compliance to the latest security standards.

Can you try to update your script to pass -SHAAlgorithm SHA1 to the Export-vApp?

muppet3000 commented 3 years ago

Thanks, that's fixed it.

Out of interested what is the "proper" way of fixing this on the VCenter environment? I'd like to feed this back to our internal infrastructure team who maintain the system.

dmilov commented 3 years ago

Thanks, that's fixed it.

Out of interested what is the "proper" way of fixing this on the VCenter environment? I'd like to feed this back to our internal infrastructure team who maintain the system.

Unfortunately, I can't help with that...