Create Virtual Machine operation

The Create Virtual Machine operation creates a new virtual machine (VM) on the Microsoft Hyper-V server. This topic illustrates the actor adapter request and response and describes the elements used in the request.

The following table describes the elements for the adapter request:

Adapter request elements for the Create Virtual Machine operation

Element

Description

Required

<operation-name>

Specifies the name of the operation: create-virtual-machine

Yes

<arguments>

Contains the elements that specify the details for the VM to be created

Yes

<target>

Contains a dynamic target configuration or uses a predefined target configuration of the Hyper-V server on which the request is executed

Note

If you do not specify a dynamic target in the adapter request, the default adapter configuration is used.

The <target> element contains the following elements:

  • <host>
  • <user-name>
  • <password>
  • <timeout-secs>

Conditional; required if a target is referenced or defined in the request

<host>

Specifies the host name or the IP address of the Hyper-V server

The <host> element applies to a dynamic target.

Conditional; required when defining a dynamic target

<user-name>

Specifies the user name to be used to connect to the Hyper-V server

The <user-name> element applies to a dynamic target.

Conditional; required when defining a dynamic target

<password>

Specifies the password that corresponds to the <user-name> provided

The <password> element applies to a dynamic target.

The <password> element can contain an encryption-type attribute that indicates whether the password specified is encrypted.

Valid values for encryption-type: base64, plain (default)

Conditional; required if <user-name> is provided

<timeout-secs>

Specifies the time, in seconds, after which the attempt to connect to the Hyper-V server fails

Default value: 60

No

<name>

Specifies the name of the VM to be created

Yes

<path>

Specifies the location for saving the VM files, including the snapshots

The Hyper-V server has a default location that is used if no path is specified.

No

The following figure shows a sample <items> XML element for the Create Virtual Machine operation.

 Sample



<items>
        <item>
          <target>
            <host>10.128.8.172</host>
            <user-name>administrator</user-name>
            <password   encryption-type="Base64">pwd</password>   
            <timeout-secs>120</timeout-secs>
          </target>
          <name>VM1</name>
          <path>D:\Virtual Machines\</path>
        </item>
        <item>
          <target>
            <host>pw-pun-rds-dv01</host>
            <user-name>administrator</user-name>
            <password>pwd</password>   
          </target>
          <name>VM2</name>
        </item>
        <item>
          <target>Config1</target>
          <name>VM3</name>
          <path>D:\Virtual Machines\</path>        
        </item>
</items>

The following figure shows a sample adapter request for the Create Virtual Machine operation:

 Sample adapter request for the Create Virtual Machine operation



<ms-hyperv-request>
    <operation-name>create-virtual-machine</operation-name>
    <arguments>
      <target>
        <host>10.128.8.172</host>
        <user-name>administrator</user-name>
        <password encryption-type="Base64">pwd</password>
        <timeout-secs>120</timeout-secs>
      </target>
      <name>VM1</name>
      <path>D:\Virtual Machines\</path>
    </arguments>
    <arguments>
      <target>
        <host>pw-pun-rds-dv01</host>
        <user-name>administrator</user-name>
        <password>pwd</password>
      </target>
      <name>VM2</name>
    </arguments>
    <arguments>
      <target>Config1</target>
      <name>VM3</name>
      <path>D:\Virtual Machines\</path>
    </arguments>
</ms-hyperv-request>

The following figure shows a sample adapter response for the Create Virtual Machine operation:

 Sample adapter response for the Create Virtual Machine operation



<ms-hyperv-response>
  <metadata>
    <status>success</status>
    <response-count>1</response-count>
  </metadata>
  <responses>
    <CreateVirtualMachineResponse>
      <metadata>
        <target>10.128.8.172</target>
        <status>success</status>
        <count>1</count>
      </metadata>
      <items>
        <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_Com</relpath>
          <property-count>29</property-count>
          <derivation>{CIM_ComputerSystem, CIM_System, CIM_EnabledLog</derivation>
          <server>PW-PUN-RDS-DV01</server>
          <namespace>root\virtualization</namespace>
          <path>\\PW-PUN-RDS-DV01\root\virtualization:Msvm_Comp</path>
          <assigned-numa-node-list>{}</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>Stopped</state>
          <health-state>5</health-state>
          <identifying-descriptions></identifying-descriptions>
          <install-date>20120307044614.000000-000</install-date>
          <guid>EDEF3C27-A88A-4069-B365-98346E4C291E</guid>
          <name-format></name-format>
          <on-time-in-milliseconds>0</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>0</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>20120307044614.003574-000 begin_of_the_skype_highlighting            003574-000      end_of_the_skype_highlighting</time-of-last-configuration-change>
          <time-of-last-state-change>16010101000000.000000-000</time-of-last-state-change>
        </item>
      </items>
    </CreateVirtualMachineResponse>
  </responses>
</ms-hyperv-response> 

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

Comments