VMware Cloud Community
kingsdeb
Contributor
Contributor

Not able to reconfigure VM for mutiple section

I have tried to make a POST request as per the example ( https://pubs.vmware.com/vca/index.jsp#com.vmware.vcloud.api.doc_56/GUID-4759B018-86C2-4C91-8176-3EC7... ) to update multiple sections of the VM. But i always get error 415

I always get the below error even if i try to update atleast one section, like either "name and description" or just "network connection section"

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

<Error xmlns="http://www.vmware.com/vcloud/v1.5" majorErrorCode="415" message="Unsupported Media Type" minorErrorCode="UNSUPPORTED_MEDIA_TYPE" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloud-url/api/v1.5/schema/master.xsd"></Error>

Is it possible to do "reconfigureVM" action request ? and if yes, could anyone help with updating vm name and network section

Note: I can do PUT request to update each section separately.

And yes the "test_vapp1-network" in Network Section in below XML which is the vapp network name does exist.

Here is my XML:

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

<Vm xmlns="http://www.vmware.com/vcloud/v1.5"

     name="test_vm_1">

     <Description>A test VM</Description>

    <NetworkConnectionSection  

        type="application/vnd.vmware.vcloud.networkConnectionSection+xml"

        xmlns="http://www.vmware.com/vcloud/v1.5"

        xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">

        <ovf:Info>Firewall allows access to this address.</ovf:Info>

        <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>

        <NetworkConnection

            network="test_vapp1-network">

            <NetworkConnectionIndex>0</NetworkConnectionIndex>

            <IsConnected>true</IsConnected>

            <IpAddressAllocationMode>POOL</IpAddressAllocationMode>

        </NetworkConnection>

    </NetworkConnectionSection>

     <GuestCustomizationSection

      xmlns="http://www.vmware.com/vcloud/v1.5"

      xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"

      ovf:required="false">

      <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>

      <Enabled>true</Enabled>

      <ChangeSid>true</ChangeSid>

      <VirtualMachineId>hddhdhdhd</VirtualMachineId>

      <AdminPasswordEnabled>true</AdminPasswordEnabled>

      <AdminPassword>test123456</AdminPassword>

      <ResetPasswordRequired>false</ResetPasswordRequired>

      <CustomizationScript />

      <ComputerName>test_vm_1</ComputerName>

    </GuestCustomizationSection>

</Vm>

Reply
0 Kudos
1 Reply
jonathanw
Enthusiast
Enthusiast

I've often found 'Unsupported Media Type' means that you are submitting a body document without specifying the correct 'Content-Type' header in your POST request, for the example you reference this must be set to 'application/vnd.vmware.vcloud.vm+xml'.

Regards, Jon.

Reply
0 Kudos