Add Virtual NIC operation
The Add Virtual NIC operation adds a virtual network interface controller (NIC) to the specified virtual machine (VM). This topic illustrates the actor adapter request and response and describes the elements used in the request.
Warning
The Add Virtual NIC operation works only when the state of the VM is "Stopped".
The following table describes the elements for the adapter request:
Adapter request elements for the Add Virtual NIC operation
The following figure shows a sample <items> XML element for the Add Virtual NIC operation.
Sample <items> XML element for the Add Virtual NIC operation
<items>
<item>
<target>
<host>10.111.8.222</host>
<user-name>administrator</user-name>
<password encryption-type="Base64">pwd</password>
<timeout-secs>120</timeout-secs>
</target>
<vm>RHEL5</vm>
<virtual-switch>Local Area Connection - Virtual Network</virtual-switch>
<mac>00111D08AC01</mac>
<guid>b552e85f-94d5-4271-bcdd-cab044692e00</guid>
<legacy>true</legacy>
</item>
<item>
<vm>VM5</vm>
<virtual-switch>Local Area Connection - Virtual Network</virtual-switch>
<mac>00111D08BC00</mac>
<guid>b552e85f-94d5-4271-bfdd-cab055692e09</guid>
<legacy>false</legacy>
</item>
<item>
<target>Config1</target>
<vm>VM6</vm>
<virtual-switch></virtual-switch>
<mac></mac>
<guid></guid>
<legacy>true</legacy>
</item>
</items>
The following figure shows a sample adapter request for the Add Virtual NIC operation:
Sample adapter request for the Add Virtual NIC operation
<ms-hyperv-request>
<operation-name>add-virtual-nic</operation-name>
<arguments>
<target>
<host>10.111.8.222</host>
<user-name>administrator</user-name>
<password encryption-type="Base64">pwd</password>
<timeout-secs>120</timeout-secs>
</target>
<vm>RHEL5</vm>
<virtual-switch>Local Area Connection - Virtual Network</virtual-switch>
<mac>00155D08AC01</mac>
<guid>b552e85f-94d5-4271-bcdd-cab044692e00</guid>
<legacy>true</legacy>
</arguments>
<arguments>
<vm>VM5</vm>
<virtual-switch>Local Area Connection - Virtual Network</virtual-switch>
<mac>00155D08BC01</mac>
<guid>b552e85f-94d5-4271-bfdd-cab055692e09</guid>
<legacy>false</legacy>
</arguments>
<arguments>
<target>Config1</target>
<vm>VM6</vm>
<virtual-switch />
<mac />
<guid />
<legacy>true</legacy>
</arguments>
</ms-hyperv-request>
The following figure shows a sample adapter response for the Add Virtual NIC operation:
Sample adapter response for the Add Virtual NIC operation
<ms-hyperv-response>
<metadata>
<status>success</status>
<response-count>3</response-count>
</metadata>
<responses>
<AddVirtualNICResponse>
<metadata>
<target>10.111.8.222</target>
<status>success</status>
<count>1</count>
</metadata>
<items>
<item>
<vm-element-name>RHEL5</vm-element-name>
<genus>2</genus>
<class>Msvm_EmulatedEthernetPortSettingData</class>
<superclass>CIM_ResourceAllocationSettingData</superclass>
<dynasty>CIM_ManagedElement</dynasty>
<relpath>Msvm_EmulatedEthernetPortSettingData.InstanceID="Micros</relpath>
<oft>9C4BE436-1EAE-4210-AD25-EB94E14E1377\\718032DA-6EFB</oft>
<property-count>22</property-count>
<derivation>{CIM_ResourceAllocationSettingData, CIM_SettingData, CI</derivation>
<server>PW-PUN-RDS-DV01</server>
<namespace>root\virtualization</namespace>
<path>\\PW-PUN-RDS-DV01\root\virtualization:Msvm_EmulatedEthe</path>
<mac>00155D08AC01</mac>
<allocation-units>Ports</allocation-units>
<automatic-allocation>True</automatic-allocation>
<automatic-deallocation>True</automatic-deallocation>
<caption>Ethernet Port</caption>
<connection>{}</connection>
<consumer-visibility>3</consumer-visibility>
<description>Settings for the Microsoft Emulated Ethernet Port.</description>
<element-name>Legacy Network Adapter</element-name>
<host-resource></host-resource>
<instance-i-d>Microsoft:9C4BE436-1EAE-4210-AD25-EB94E14E1377\718032DA</instance-i-d>
<limit>1</limit>
<mapping-behavior></mapping-behavior>
<other-resource-type></other-resource-type>
<parent></parent>
<pool-i-d>Microsoft:4EA4F71F-16E6-4250-99A8-A2315332CC64\Root</pool-i-d>
<reservation>1</reservation>
<resource-sub-type>Microsoft Emulated Ethernet Port</resource-sub-type>
<resource-type>10</resource-type>
<static-mac-address>True</static-mac-address>
<virtual-quantity>1</virtual-quantity>
<weight>0</weight>
</item>
</items>
</AddVirtualNICResponse>
<AddVirtualNICResponse>
<metadata>
<target>10.111.8.222</target>
<status>success</status>
<count>1</count>
</metadata>
<items>
<item>
<vm-element-name>VM5</vm-element-name>
<genus>2</genus>
<class>Msvm_SyntheticEthernetPortSettingData</class>
<superclass>CIM_ResourceAllocationSettingData</superclass>
<dynasty>CIM_ManagedElement</dynasty>
<relpath>Msvm_SyntheticEthernetPortSettingData.InstanceID="Mi</relpath>
<crosoft>26D3A022-D84E-4F2B-842B-8C173EFFD865\\CAABA6</crosoft>
<property-count>23</property-count>
<derivation>{CIM_ResourceAllocationSettingData, CIM_SettingData,</derivation>
<server>PW-PUN-RDS-DV01</server>
<namespace>root\virtualization</namespace>
<path>\\PW-PUN-RDS-DV01\root\virtualization:Msvm_Synthetic</path>
<mac>00155D08BC01</mac>
<allocation-units>Ports</allocation-units>
<automatic-allocation>True</automatic-allocation>
<automatic-deallocation>True</automatic-deallocation>
<caption>Ethernet Port</caption>
<connection>{}</connection>
<consumer-visibility>3</consumer-visibility>
<description>Settings for the Microsoft Synthetic Ethernet Port.</description>
<element-name>Network Adapter</element-name>
<host-resource></host-resource>
<instance-i-d>Microsoft:26D3A022-D84E-4F2B-842B-8C173EFFD865\CAABA</instance-i-d>
<limit>1</limit>
<mapping-behavior></mapping-behavior>
<other-resource-type></other-resource-type>
<parent></parent>
<pool-i-d>Microsoft:6A45335D-4C3A-44b7-B61F-C9808BBDF8ED\Root</pool-i-d>
<reservation>1</reservation>
<resource-sub-type>Microsoft Synthetic Ethernet Port</resource-sub-type>
<resource-type>10</resource-type>
<static-mac-address>True</static-mac-address>
<virtual-quantity>1</virtual-quantity>
<virtual-system-identifiers>{{b552e85f-94d5-4271-bfdd-cab055692e09}}</virtual-system-identifiers>
<weight>0</weight>
</item>
</items>
</AddVirtualNICResponse>
<AddVirtualNICResponse>
<metadata>
<target>pw-pun-rds-dv01</target>
<status>success</status>
<count>1</count>
</metadata>
<items>
<item>
<vm-element-name>VM6</vm-element-name>
<genus>2</genus>
<class>Msvm_EmulatedEthernetPortSettingData</class>
<superclass>CIM_ResourceAllocationSettingData</superclass>
<dynasty>CIM_ManagedElement</dynasty>
<relpath>Msvm_EmulatedEthernetPortSettingData.InstanceID="Micros</relpath>
<oft>37D53DC3-FF03-49DA-A973-B5EDE7A90F44\\718032DA-6EFB</oft>
<property-count>22</property-count>
<derivation>{CIM_ResourceAllocationSettingData, CIM_SettingData, CI</derivation>
<server>PW-PUN-RDS-DV01</server>
<namespace>root\virtualization</namespace>
<path>\\PW-PUN-RDS-DV01\root\virtualization:Msvm_EmulatedEthe</path>
<mac>000000000000</mac>
<allocation-units>Ports</allocation-units>
<automatic-allocation>True</automatic-allocation>
<automatic-deallocation>True</automatic-deallocation>
<caption>Ethernet Port</caption>
<connection>{}</connection>
<consumer-visibility>3</consumer-visibility>
<description>Settings for the Microsoft Emulated Ethernet Port.</description>
<element-name>Legacy Network Adapter</element-name>
<host-resource></host-resource>
<instance-i-d>Microsoft:37D53DC3-FF03-49DA-A973-B5EDE7A90F44\718032DA</instance-i-d>
<limit>1</limit>
<mapping-behavior></mapping-behavior>
<other-resource-type></other-resource-type>
<parent></parent>
<pool-i-d>Microsoft:4EA4F71F-16E6-4250-99A8-A2315332CC64\Root</pool-i-d>
<reservation>1</reservation>
<resource-sub-type>Microsoft Emulated Ethernet Port</resource-sub-type>
<resource-type>10</resource-type>
<static-mac-address>False</static-mac-address>
<virtual-quantity>1</virtual-quantity>
<weight>0</weight>
</item>
</items>
</AddVirtualNICResponse>
</responses>
</ms-hyperv-response>