VMware VCLOUD SDK 1.0 - FOR NET DEVELOPERS GUIDE Manual page 15

Vcloud sdk for .net developer’s guide
Hide thumbs Also See for VCLOUD SDK 1.0 - FOR NET DEVELOPERS GUIDE:
Table of Contents

Advertisement

1
The client POSTs an initial request that specifies a name for the template, a transfer format for the data, 
and an optional description.
2
The server returns an unresolved (status="0") vAppTemplate document that includes an upload URL 
for the OVF package.
3
The client uses an HTTP PUT request to upload the OVF descriptor to the upload URL. 
4
The server reads the descriptor and constructs a vAppTemplate object that includes an upload URL for 
each file listed in the References section of the descriptor. While the server is constructing this document, 
the client makes periodic requests for it and examines the response for additional upload URLs. When the 
response contains any upload URLs other than the one returned in Step
5
The client uses HTTP PUT requests to upload each of the files.
6
If the OVF package includes a manifest file, the entire upload is validated against the contents of the 
manifest file.
After all the files are uploaded, and validated if a manifest is present, the server processes the uploads. When 
processing is complete, the server sets the value of the template's status attribute to 8, indicating that the 
template is ready for use. This status value indicates that all of the virtual machines in the template are 
powered off. For more information, see the vCloud API Programming Guide.
Example 3-2. Upload an OVF Package to Create a vApp Template
public static ReferenceType CreateUploadvAppTemplate(Vdc vdc, string ovfFileLocation, string
{
try
{
...
// create an UploadVappTemplateParams request body and fill in the name and description for the
UploadVAppTemplateParamsType vappTemplParams = new UploadVAppTemplateParamsType();
vappTemplParams.Description = "HellovCloudvAppTemplate Description";
vappTemplParams.name = "HellovCloudvAppTemplate";
...
// make the request to the vDC's uploadVappTemplate URL
VappTemplate vappTemplate = vdc.CreateVappTemplate(vappTemplParams);
...
// get the upload:default URL and PUT the descriptor
FileStream ovfFileInputStream = File.OpenRead(ovfFileLocation);
vappTemplate.UploadOVFFile(ovfFileInputStream, ovfFileInputStream.Length);
vappTemplate = VappTemplate.GetVappTemplateByReference(client, vappTemplate.Reference);
...
// periodically check the vAppTemplate URL, looking for ovfDescriptorUploaded="true"
while (!vappTemplate.Resource.ovfDescriptorUploaded)
{
System.Threading.Thread.Sleep(5000);
vappTemplate = VappTemplate.GetVappTemplateByReference(client, vappTemplate.Reference);
}
...
// when the descriptor has been uploaded, upload the VMDK file
...
FileStream vmdkFileInputStream = File.OpenRead(vmdkFileLocation);
vappTemplate.UploadFile(vmdkFileName, vmdkFileInputStream, vmdkFileInputStream.Length);
vappTemplate = VappTemplate.GetVappTemplateByReference(client, vappTemplate.Reference);
while (vappTemplate.Resource.status != 8)
...
VMware, Inc.
vmdkFileLocation, string vmdkFileName)
vAppTemplate
Chapter 3 Hello vCloud: A Structured Workflow Example
2, the template is complete.
15

Advertisement

Table of Contents
loading

This manual is also suitable for:

Vcloud sdk 1.0

Table of Contents