VCloud: create and configure vm in vApp

I am trying to deploy VMs from template to vApp using vcloud rest API. I feel like there must be a way to set up the vm as I am creating it (since the UI seems to be doing this) but haven't found a way.

I focused my efforts on reformulating the vApp to add vm to it. The example below will add the vm, but I didn't decide to configure the vm until after it was created. Specifically, I want to set the VM name, hostname and IP settings of the vm.

<?xml version="1.0" encoding="UTF-8"?>
<RecomposeVAppParams
   xmlns="http://www.vmware.com/vcloud/v1.5"
   xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">
   <SourcedItem sourceDelete="false">
       <Source href="templateUri" />
   </SourcedItem>
   <AllEULAsAccepted>true</AllEULAsAccepted>
</RecomposeVAppParams>

      

After creating the vm, I can reconfigure it, but neither the network settings nor the hostname have changed. The VCLoud Director UI tells me they have changed, but looking at the guest OS shows that the settings have not changed.

Change example hostname (doesn't work):

<vcloud:GuestCustomizationSection
   xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
   xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"
   href="vmUri/guestCustomizationSection/"
   ovf:required="false"
   type="application/vnd.vmware.vcloud.guestCustomizationSection+xml">
       <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
       <vcloud:ComputerName>newName</vcloud:ComputerName>
</vcloud:GuestCustomizationSection>

      

Has anyone been able to configure the virtual machine when deploying it. If not, does anyone know how to effectively tune the settings for a virtual machine after deploying it. Working XML examples would be awesome, but I still appreciate help with other forms.

+3


source to share


2 answers


The closest I came to is deploying a vApp from a directory somewhat configuring it in the process. This is not exactly what you asked, but I hope it helps.



<?xml version="1.0" encoding="UTF-8"?>
<InstantiateVAppTemplateParams
   xmlns="http://www.vmware.com/vcloud/v1.5"
   xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
   name="<MyVappName"
   deploy="false"
   powerOn="false">
   <Description>vApp I deployed through REST API...</Description>
   <InstantiationParams>
   <NetworkConfigSection>
    <ovf:Info>Configuration parameters for logical networks</ovf:Info>
    <NetworkConfig networkName="App-Network-1">
     <Configuration>
      <ParentNetwork href="https://vcd-url/api/network/331a8ee3-33fd-4e4a-878e-1a6dce772fea" />
      <FenceMode>bridged</FenceMode>
     </Configuration>
    </NetworkConfig>
   </NetworkConfigSection>
   </InstantiationParams>
   <Source
      href="https://vcd-url/api/vAppTemplate/vappTemplate-d11de298-3041-2ae2-5e81-3ac2b4255423" />
</InstantiateVAppTemplateParams>

      

0


source


Just use the SDK for this task. Download the example and library. Add library to proj and call function from there. The SDK already has a Utility library that handles http communication with vcloud, making requests and serving responses using serialization. If you really want to execute the request yourself, you just run the example in the SDK to put Fiddler to spy on the message and get the exact request and reproduce it. I know because the first time I started making an http request using the documentation and got into trouble.



0


source







All Articles