VMware, Inc. 45
Chapter 4 Provisioning
<File size="1950489088" bytesTransferred="0" name="disk0.vmdk">
<Link rel="upload:default" href="http://vcloud.example.com/transfer/.../disk0.vmdk"/>
</File>
</Files>
</VAppTemplate>
Inthisexample,theovfDescriptorUploadedattributehasavalueoftrueandthestatusattributehasa
valueof0.Ifthedescriptorfailsvalidation,thestatusissetto‐1,andthetemplatecontainsaTaskelement
whoseErrorelementindicatesthereasonforthefailure.
EachoftheFile
elementsincludesanuploadlink(<Link rel="upload:default" ... />)andseveral
attributes:
size.Thefilesize,takenfromthesizeattributeoftheFileelementintheOVFdescriptor.
bytesTransferred.Forallfilereferencesotherthanthedescriptor,thisattributeisinitiallysettoavalueof
0indicatingthattheuploadhasnotyetbegun.IntheFilereferencetothedescriptor,thevalueofthe
bytesTransferredattributeisequaltothevalueofthesizeattribute,indicating
thatallthebytesinthe
descriptorhavebeentransferred.
name.Thefilename,takenfromthehrefattributeoftheFileelementintheOVFdescriptor.
Including a Manifest
SomeOVFpackagesincludeamanifestdocument,whichspecifiesachecksumforeachfileinthepackage.If
youareuploadingapackagethatincludesamanifestfile,addamanifestRequired="true"attributetothe
requestbody,asshowninExample 4‐5.
Example 4-5. uploadVappTemplate Request for an OVF Package That Includes a Manifest
POST http://vcloud.example.com/api/v1.0/vdc/5/action/uploadVAppTemplate
Content-Type: application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml
<UploadVAppTemplateParams name="Ubuntu Template" manifestRequired="true"
xmlns="http://www.vmware.com/vcloud/v1" >
<Description>Ubuntu vApp Template</Description>
</UploadVAppTemplateParams>
Whenyouspecifythatamanifestisrequired,thesetofFileelementsreturnedafteryouuploadtheOVF
descriptorincludesoneforthemanifestitself.Afterallthefilesareuploaded,eachfileischeckedbytheserver
toverifythatitschecksummatchestheonestatedinthemanifest.
Ifanychecksumsdonotmatch,the
template’sstatusattributeissetto‐1andthetemplatecontainsaTaskelementwhoseErrorelement
indicatesthereasonforthefailure.
Uploading the Files
Informationfromtheserver’sresponseinExample 4‐3enablestheclienttoconstructaseriesofPUTrequests,
oneforeachFileinthelist,thatuploadthefilesreferencedbythetemplate.Eachrequestspecifiesanupload
URLandacontentlengthinbytes.
Example 4‐6showsanuploadrequest
foroneofthefilesrequiredbyanOVFpackage.Theuploadrequestis
simplyafewheaderlines,followedbytheserializedfilecontent.