VMware Cloud Community
markajohnson
Contributor
Contributor

Can't modify network card type. API PUT virtualHardwareSecion/networkCards FAILS

I'm trying to modify the network interface card type using the API call and I'm getting an error.

First, here's the call to retrieve the current information:

GET: https://192.168.30.25/api/vApp/vm-1d6fa955-cbd8-438f-bee0-11fc99526f47/virtualHardwareSection/networ...

<?xml version="1.0" encoding="UTF-8"?>

<RasdItemsList xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://192.168.30.25/api/vApp/vm-1d6fa955-cbd8-438f-bee0-11fc99526f47/virtualHardwareSection/networ..." xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://192.168.30.25/api/v1.5/schema/master.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd">

    <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://192.168.30.25/api/vApp/vm-1d6fa955-cbd8-438f-bee0-11fc99526f47/virtualHardwareSection/networ..."/>

    <Item>

        <rasd:Address>00:50:56:01:03:d0</rasd:Address>

        <rasd:AddressOnParent>0</rasd:AddressOnParent>

        <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>

        <rasd:Connection xmlns:ns12="http://www.vmware.com/vcloud/v1.5" ns12:ipAddress="192.168.34.43" ns12:primaryNetworkConnection="true" ns12:ipAddressingMode="MANUAL">Dev vCloud - Direct</rasd:Connection>

        <rasd:Description>PCNet32 ethernet adapter on "Dev vCloud - Direct"</rasd:Description>

        <rasd:ElementName>Network adapter 0</rasd:ElementName>

        <rasd:InstanceID>1</rasd:InstanceID>

        <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>

        <rasd:ResourceType>10</rasd:ResourceType>

    </Item>

</RasdItemsList>

Now I change the ResourceSubType and send this:

PUT: https://192.168.30.25/api/vApp/vm-1d6fa955-cbd8-438f-bee0-11fc99526f47/virtualHardwareSection/networ...

Content-Type: application/vnd.vmware.vcloud.rasdItemsList+xml

<?xml version="1.0" encoding="UTF-8"?>

<RasdItemsList xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">

<Item>

<rasd:Address>00:50:56:01:03:d0</rasd:Address>

<rasd:AddressOnParent>0</rasd:AddressOnParent>

<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>

<rasd:Connection ipAddress="192.168.34.43" primaryNetworkConnection="true" ipAddressingMode="MANUAL" >Dev vCloud - Direct</rasd:Connection>

<rasd:Description>PCNet32 ethernet adapter on "Dev vCloud - Direct"</rasd:Description>

<rasd:ElementName>Network adapter 0</rasd:ElementName>

<rasd:InstanceID>1</rasd:InstanceID>

<rasd:ResourceSubType>VMXNET3</rasd:ResourceSubType>

<rasd:ResourceType>10</rasd:ResourceType>

</Item>

</RasdItemsList>

And I get this error:

<?xml version="1.0" encoding="UTF-8"?>

<Error xmlns="http://www.vmware.com/vcloud/v1.5" stackTrace="com.vmware.vcloud.api.rest.handlers.exceptions.BadRequestRestApiException: ipAddressingMode attribute expected for Connection element for rasd item with InstanceID=1

        at com.vmware.vcloud.api.rest.handlers.utils.ovfhandlers.VirtualHardwareSectionHandler.createNetworkConnectionPair(VirtualHardwareSectionHandler.java:424)

        at com.vmware.vcloud.api.rest.handlers.utils.ovfhandlers.VirtualHardwareSectionHandler.fillVmSpecFromOvfSection(VirtualHardwareSectionHandler.java:118)

        at com.vmware.vcloud.api.rest.handlers.utils.ovfhandlers.VirtualHardwareSectionHandler.fillVmSpecFromOvfSection(VirtualHardwareSectionHandler.java:63)

        at com.vmware.vcloud.api.rest.handlers.AbstractVmSectionSubHandler.updateOvfSectionInternal(AbstractVmSectionSubHandler.java:198)

        at com.vmware.vcloud.api.rest.handlers.AbstractVmSectionSubHandler.updateOvfSection(AbstractVmSectionSubHandler.java:191)

        at com.vmware.vcloud.api.rest.handlers.VirtualHardwareSectionSubHandler.updateRasdItems(VirtualHardwareSectionSubHandler.java:359)

It appears to want the attribute "ipAddressingMode" in the Connection element but my XML does have that.  I've also tried putting ipAddressingMode as the first attribute but that didn't help.

Any ideas?

Thanks in advance.

0 Kudos
0 Replies