VMware {code} Community
mrudloff
Enthusiast
Enthusiast

Create a new VM within a vApp

I can find anything in the documentation about creating a new VM within an existing vApp or creating a new vApp and a new VM within it ..

Is this at all possible ? 

Reply
0 Kudos
6 Replies
anniyan
Contributor
Contributor

Yes, you can create new VM within a vApp.

<vCloudAPIDoc>

Recompose a vApp to Add or Remove Virtual Machines
The vCloud API supports recomposition of a vApp to add or remove virtual machines

(Vm elements). To recompose a vApp, a client makes a recomposeVApp request,

supplying a RecomposeVAppParams element as the request body. The

RecomposeVAppParams element allows an arbitrary number of DeleteItem elements,
but is otherwise identical to ComposeVAppParams. This means that in addition to

adding or removing virtual machines, a recomposeVApp request can also change the

name and description of the vApp, and can supply new InstantiationParams to change

various sections of the composed vApp or any of the added virtual machines.

</vCloudAPIDoc>

Specify you VM attributes in RecomposeVAppParams->Item->InstantiationParams and call something similar to:

POST http://vcloud.example.com/api/v1.0/vApp/vapp-33/action/recomposeVApp

Reply
0 Kudos
Windspirit
Hot Shot
Hot Shot

Code Example

<RecomposeVAppParams xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:environment_1="http://schemas.dmtf.org/ovf/environment/1">
    <SourcedItem sourceDelete="false">
<Source href="https://10.75.119.142/api/vAppTemplate/vm-6c9b3bf8-00c2-48ec-9825-9198d50d0812" name="test2"/>
<InstantiationParams>
<NetworkConnectionSection ovf:required="false">
<ovf:Info>Specifies the available VM network connections</ovf:Info>
<NetworkConnection network="ONet_OSS" needsCustomization="true">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IpAddress>192.168.0.23</IpAddress>
<IsConnected>false</IsConnected>
<IpAddressAllocationMode>MANUAL</IpAddressAllocationMode>
</NetworkConnection>
</NetworkConnectionSection>
</InstantiationParams>
<NetworkAssignment innerNetwork="PXE BOOT" containerNetwork="ONet_OSS"/>
   </SourcedItem>
</RecomposeVAppParams>

Reply
0 Kudos
Todor_Todorov
Hot Shot
Hot Shot

Please note that the Recompose vApp operation allows you to add existing VMs to the vApp, i.e. VMs from other vApps or vApp templates are copied/moved to the target vApp. With the current version of the vCD REST API it's not possible to add a new blank VM to a vApp which is possible through the vCD UI.

Regards,

Todor Todorov

Reply
0 Kudos
tejit2004
Contributor
Contributor

Hi,

Currently I am using vmware API vesion 5.1.

I have already composed a vApp (Not Instantiated) and Now I want to update the vApp by creating Virtual Machines, Document doesn't have proper XML. It's bits and pieces and I am not able to understand.

Is it possible to create new VMs in the app? If yes then Can you please provide me the entire XML for that? My requirement is to create VMs.

Thanks,

Tejas Trivedi.

Reply
0 Kudos
JigneshKakadiya
Contributor
Contributor

Todor,

I am not able to use the same VM(source) template to create multiple VMs in same vApp simultaneously. It give me error "The entity SOURCE_VM_TEMPLATE is busy completing an operation.

Can you please give me the idea how can I achieve this since I have only one source VM and cloning multiple times same time in a vApp?

Thanks,

Jignesh

Reply
0 Kudos
VivekShabadi
Contributor
Contributor

Hi All,

I have the following questions regarding the "Recompose a vApp to Add, Remove, or Reconfigure Virtual Machines".

I was searching for an example or sample xml for add/creating a vm in the vapp. The api documentation about "RecomposeVAppParams" doesnt clearly explain creating/adding a new vm to the vapp. Also, what is the purpose of "SourceItem" tag in "RecomposeVAppParams"? Does it act as template for creating new vm? Will the new VM be automatically cloned and added to the vApp? Could you please provide an example for the same?

I am referring to the documentation: http://pubs.vmware.com/vcd-810/index.jsp?topic=%2Fcom.vmware.vcloud.api.sp.doc_20_0%2FGUID-4D27F630-...

Thanks,

Vivek Shabadi.

Reply
0 Kudos