5 Replies Latest reply on Nov 23, 2016 8:34 AM by pirhovi

    PowerCLI error reporting is broken when working with vCloud Director

    pirhovi Lurker

      It seems that PowerCLI Cmdlets error reporting for vCloud Director cmdlets is broken.

       

      For example:

      When creating new vapp from template with New-CIVapp and it fails (due storage quota exceeded) powercli returns error:

      New-CIVApp    The server returned 'Bad Request' with the status code 400 - BadRequest.

       

      Its impossible to know the real reason, because in exception or "innerexception" there is no data about the real error message which is returned by vcloud:

      <Error xmlns="http://www.vmware.com/vcloud/v1.5" stackTrace="com.vmware.vcloud.api.presentation.service.StorageQuotaExceededException: The requested operation will exceed the VDC's storage quota: storage policy &quot;Basic Storage Policy&quot; has 17,766 MB remaining, requested 22,528 MB

      .........long stacktrace.......

      majorErrorCode="400" message="[ 88254ce9-1ced-428d-902c-d591e2bfb52c ] The requested operation will exceed the VDC's storage quota: storage policy &quot;Basic Storage Policy&quot; has 17,766 MB remaining, requested 22,528 MB" minorErrorCode="STORAGE_QUOTA_EXCEEDED" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://x.x.x.x/api/v1.5/schema/master.xsd"></Error>

       

      If you dig around you can see that exception is coming from HttpClientErrorException from the Spring.Rest.Client.HttpResponseException.

      That exception class has property "Response", which has "Headers", "StatusCode" and "StatusDescription" and "Body". It would be REALLY nice if the Body would have that Error-xml which is being sent by vcloud director and that "message" attribute would be in the Exception class in "VMware.VimAutomation.Cloud.Types.V1.CIException" as property.

       

      Is there currently any method to get the "real" error message?