Hello,
Every day we continue to explore and use the Vcloud API and the SDK php. And I would like to share with you our experience and problems about the Vcloud Api.
We are creating a web application which use the sdk php of the vcloud API.
1.5 month ago we wanted to provide to a user the possibility to deploy a vapp from a vappTemplate. This vappTemplate can be in a private catalog or a Public catalog.
To do that we needed to modify the NetworkConfigSection of the vapp and the networkConnectionSection of each vm.
We decided to use the following function from the sdk :
instantiateVAppTemplate from VMware_VCloud_SDK_Vdc object Class.
To use this function we needed before to create a VMware_VCloud_API_InstantiateVAppTemplateParamsType object and a VMware_VCloud_API_VAppCreationParamsType object. The last one must contain a NetworkConfigSection object (with nat and fw rules, list of networks ...).
the instantiation worked. the vapp deployment worked. We found all data put in the networkCOnfigSection in the new vapp.
But after that we needed to modify the NetworkConnectionSections of the vm in the vapp. The vms were still configured to be connected to the former network. So, we needed to use the following functions:
modifyNetworkConnectionSettings from the VMware_VCloud_SDK_Vm object class.
but when executed we got an error message which said that some networks didn't exist and it can't do the modification.
The non-existing networks were the former networks of the vapptemplate from which the vapp was deployed. To permit the modification the way we found was to re-create the former network and after that the modification worked.
This method was not very good, so we think a bout something else. We decide to deploy the vappTemplate without modification (except the name) , and after that the goal was to modify the vapp newly created step by step.
You can see bellow the method followed :
1) instantiate the vapp
2) disconnect VMs from former networks (NetworkConnectionSettings modification)
3) delete former networks (NetworkConfigSection modification)
4) create new networks (NetworkConfigSection modification)
5) reconnect vms to the new networks (NetworkCnnectionSettings modification)
5.1) if a vm network card is connected to nothing, recreate the network Card. (RasdItemsListTYpe modification)
6) add nat and fw Rules (NetworkConfigSection modification)
you can see 2 stranges operations.
In 4) and 6) we operate two networkConfigSection Modifications. Normally, it would have been a good idea to do that in one time. But in all our attempts to disconnect the vms from the networks we lost the NatRules ( and only Nat rules, FW rules were still there and we are sure that NAt Rules were in the vapp configuration before the disconnection).
The only way to keep the Nat rules was to put them aftern the vms reconnections. So, at the end, we choose to configuration NaT rules and FW rules in the last step.
and
In 5.1) we operate a re-creation of vms network cards if they are not connected to a network, because when we disconnect vms from networks (we erase networConfig parameter in NetworkCOnfigSettings) the corresponding RasdItems are deleted in the VirtualHardWare Section ( in vcloud API language a vm connected to nothing is in reality a vm connected to network with the name 'none').
Before trying ro re-create the nework card, I tried to create a connection woth a none network, but the result was a message error explaining that there is non "none" network. But it's strange because when you create a vm network card connected to nothing from the Vcloud Director IHM it create a connection to a "none" network. (we can see that with the getVapp() function from the sdk).
Does anyone have the same problems ?... now it's not really a problem because we found a corkAround but i'm sure it's not the good method.
Is there another method ?
Regards,
Yann CONAN