Invalid requests and error responses

This section illustrates the XML format for an error request and response.

The following figure shows a sample invalid request for the Find Virtual Machine Details operation when the name of virtual machine specified does not match the specified globally unique identifier (GUID):

Sample invalid request example one

 Click here to expand...


<ms-hyperv-request>
    <operation-name>find-virtual-machine-details</operation-name>
    <arguments>
      <name>VM1</name>
      <guid>1CCBFE38-FF20-424F-9FE2-713293C7105F</guid>
    </arguments>
  </ms-hyperv-request> 


The following figure shows a sample error response for the preceding error request:

Sample error response for invalid request example one
 Click here to expand...


<ms-hyperv-response>
  <metadata>
    <response-count>1</response-count>
    <status>success</status>
  </metadata>
  <responses>
    <FindVirtualMachineDetailsResponse>
      <metadata>
        <target>10.128.8.172</target>
        <status>error</status>
        <count>0</count>
      </metadata>
      <error>
         An error occurred. No matching virtual machine(s) found
      </error>
    </FindVirtualMachineDetailsResponse>
  </responses>
</ms-hyperv-response> 


The following figure shows a sample invalid request for the Update Virtual Machine Processors operation when you provide a value is greater than the maximum valid value (100) for <reservation>:

Sample invalid request example two
 Click here to expand...


<ms-hyperv-request>
    <operation-name>update-vm-processors</operation-name>
    <arguments>
      <vm>VM1</vm>
      <cpu-count />
      <weight />
      <limit />
      <reservation>101</reservation>
    </arguments>
</ms-hyperv-request> 


The following figure shows a sample error response for the preceding error request:

Sample error response for invalid request example two
 Click here to expand...


<ms-hyperv-response>
  <metadata>
    <response-count>1</response-count>
    <status>success</status>
  </metadata>
  <responses>
    <UpdateVirtualMachineProcessorsResponse>
      <metadata>
        <target>10.128.8.172</target>
        <status>error</status>
        <count>0</count>
      </metadata>
      <error>Invalid value provided for reservation. Valid value: Number less than equal to 100</error>
    </UpdateVirtualMachineProcessorsResponse>
  </responses>
</ms-hyperv-response> 


The following figure shows a sample invalid request for the Set Virtual Machine State operation when there are duplicate virtual machines and the operation is application to only a single virtual machine:

Sample invalid request example three
 Click here to expand...


<ms-hyperv-request>
    <operation-name>set-virtual-machine-state</operation-name>
    <arguments>
      <vm>VM1</vm>
      <state>stopped</state>
    </arguments>
  </ms-hyperv-request> 


The following figure shows a sample error response for the preceding error request:

Sample error response for invalid request example three
 Click here to expand...


<ms-hyperv-response>
  <metadata>
    <status>success</status>
    <response-count>1</response-count>
  </metadata>
  <responses>
    <SetVirtualMachineStateResponse>
      <metadata>
        <target>10.128.8.172</target>
        <status>error</status>
        <count>2</count>
      </metadata>
      <items>
        <item>
          <error>Failed to change state of VM VM1 to: Stopped.InvalidStateForOperation</error>
        </item>
        <item>
          <vm-element-name>VM1</vm-element-name>
          <genus>2</genus>
          <class>Msvm_ComputerSystem</class>
          <superclass>CIM_ComputerSystem</superclass>
          <dynasty>CIM_ManagedElement</dynasty>
          <relpath>Msvm_ComputerSystem.CreationClassName="Msvm_ComputerSystem",Name="C7E3C0D2-2925-4796-8513-E4A2FFB13168"</relpath>
          <property-count>29</property-count>
          <derivation>{CIM_ComputerSystem, CIM_System, CIM_EnabledLogicalElement, CIM_LogicalElement...}</derivation>
          <server>PW-PUN-RDS-DV01</server>
          <namespace>root\virtualization</namespace>
          <path>\\PW-PUN-RDS-DV01\root\virtualization:Msvm_ComputerSystem.CreationClassName="Msvm_ComputerSystem",Name="C7E3C0D2-2925-4796-8513-E4A2FFB13168"</path>
          <assigned-numa-node-list>{0}</assigned-numa-node-list>
          <caption>Virtual Machine</caption>
          <creation-class-name>Msvm_ComputerSystem</creation-class-name>
          <dedicated></dedicated>
          <description>Microsoft Virtual Machine</description>
          <element-name>VM1</element-name>
          <enabled-default>2</enabled-default>
          <state>Running</state>
          <health-state>5</health-state>
          <identifying-descriptions></identifying-descriptions>
          <install-date>20120309105133.000000-000</install-date>
          <name>C7E3C0D2-2925-4796-8513-E4A2FFB13168</name>
          <name-format></name-format>
          <on-time-in-milliseconds>1799197</on-time-in-milliseconds>
          <operational-status>{2}</operational-status>
          <other-dedicated-descriptions></other-dedicated-descriptions>
          <other-enabled-state></other-enabled-state>
          <other-identifying-info></other-identifying-info>
          <power-management-capabilities></power-management-capabilities>
          <primary-owner-contact></primary-owner-contact>
          <primary-owner-name></primary-owner-name>
          <process-i-d>5660</process-i-d>
          <requested-state>Not Applicable</requested-state>
          <reset-capability>1</reset-capability>
          <roles></roles>
          <status></status>
          <status-descriptions>{Operating normally}</status-descriptions>
          <time-of-last-configuration-change>20120320100342.536968-000</time-of-last-configuration-change>
          <time-of-last-state-change>20120320100342.000000-000</time-of-last-state-change>
        </item>
      </items>
    </SetVirtualMachineStateResponse>
  </responses>
</ms-hyperv-response> 

Was this page helpful? Yes No Submitting... Thank you

Comments