Architecting Multisite vCloud Director : Multisite vCloud Director v9.0 : 3.2 Site Association : 3.2.1 Site Association Process : 3.2.1.1 Site Association Workflow
   
3.2.1.1 Site Association Workflow
Site A – https://Site-A.example.com
1.
Establish the login Uniform Resource Locator (URL) for required API version.
è
GET https://Site-A.example.com/api/versions
ç
<Version>29.0</Version>
<LoginUrl>https://Site-A.example.com/api/sessions</LoginUrl>
2.
Create an authenticated login session.
è
POST https://Site-A.example.com/api/sessions
Accept: application/*;version=29.0
Authorization: Basic <administrator@system> <password>
ç
x-vcloud-authorization →460f7bbe33b2453fa93e96bc11b2ee5d
3.
Retrieve the site association URL from the Site object.
è
GET https://Site-A.example.com/api/site
Accept: application/*;version=29.0
x-vcloud-authorization: 460f7bbe33b2453fa93e96bc11b2ee5d
(these headers are present in future requests to Site-A but will be omitted for clarity)
ç
<Site
<Link
rel="down"
href="https://Site-A.example.com/api/site/associations" … />
</Site>
4.
Retrieve the site association data URL from the Site Associations object.
è
GET https://Site-A.example.com/api/site/associations
ç
<SiteAssociations
<Link
rel="down"
href="https://Site-A.example.com/api/site/associations/localAssociationData" … />
</SiteAssociations>
5.
Retrieve the site association data from the SiteAssociationMember element.
è
GET https://Site-A.example.com/api/site/associations/localAssociationData
ç
<SiteAssociationMember … >
<RestEndpoint>https://Site-A.example.com/api</RestEndpoint>
<RestEndpointCertificate>-----BEGIN CERTIFICATE-----
MIIDDjCCAfagAwIBAgIJAPVFVZ64w… -----END CERTIFICATE-----
</RestEndpointCertificate>
<SiteId>urn:vcloud:site:5e4b381d-dabb-49d9-9352-05f7ac0be7f5</SiteId>
<SiteName>5e4b381d-dabb-49d9-9352-05f7ac0be7f5</SiteName>
<PublicKey>-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhki … QIDAQAB -----END PUBLIC KEY-----
</PublicKey>
</SiteAssociationMember>
Site B – https://Site-B.example.com
6.
Repeat steps 1-3 using the Site-B URL to establish an authenticated session and retrieve the site association URL from the Site object.
7.
Retrieve the “add associations” URL from the Site Associations object.
è
GET https://Site-B.example.com/api/site/associations
Accept: application/*;version=29.0
x-vcloud-authorization: 9af7e9762efc435daceba456d28261c2
(these headers are present in future requests to Site-B but will be omitted for clarity)
ç
<SiteAssociations …>
<Link
rel="add"
href="https://Site-B.example.com/api/site/associations"
type="application/vnd.vmware.admin.siteAssociation+xml" … />
</SiteAssociations>
8.
Post the SiteAssociationMember response body received in Step 5 to the “add associations” URL from Step 7.
è
POST https://Site-B.example.com/api/site/associations
Content-type: application/vnd.vmware.admin.siteAssociation+xml
<SiteAssociationMember … >
<RestEndpoint>https://Site-A.example.com/api</RestEndpoint>
<RestEndpointCertificate>-----BEGIN CERTIFICATE-----
MIIDDjCCAfagAwIBAgIJAPVFVZ64w… -----END CERTIFICATE-----
</RestEndpointCertificate>
<SiteId>urn:vcloud:site:5e4b381d-dabb-49d9-9352-05f7ac0be7f5</SiteId>
<SiteName>5e4b381d-dabb-49d9-9352-05f7ac0be7f5</SiteName>
<PublicKey>-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhki … QIDAQAB -----END PUBLIC KEY-----
</PublicKey>
</SiteAssociationMember>
ç
<Task …
operationName="siteUpdate" >
<User
href="https://Site-B.example.com/api/admin/user/..."
name="administrator" type="application/vnd.vmware.admin.user+xml"/>
<Organization
href="https://Site-B.example.com/api/org/... "
name="System" type="application/vnd.vmware.vcloud.org+xml"/>
</Task>
 
As noted in the previous figures, this results in a Task within vCloud Director at Site B to add the association with Site A. When this process is complete, it can then be reversed, retrieving the SiteAssociationMember data from the localSiteAssociation URL of Site B and POSTing it to the “add association” URL of Site A. After both unidirectional associations are complete, the two sites are associated and the site-to-site heartbeat is established.
After sites are associated, the login request must be modified to request authorization tokens for all associated sites. This is accomplished by adding an extra parameter “multisite=global” to the Accept header of the standard login request. The modified version of the standard login request in step 2 above then becomes the following:
 
Create an authenticated multisite login session.
è
POST https://Site-A.example.com/api/sessions
Accept: application/*;version=29.0;multisite=global
Authorization: Basic <administrator@system> <password>
ç
x-vcloud-authorization →9cd477276e5d444896fca73ffb7ed5c0,2d95e0b896a9419ca7e63e19bbd0ed91