2. VMware vCloud Director Server Resource Kit : 2.2 vCloud Provisioner : 2.2.4 Advanced Use of vCloud Provisioner
2.2.4 Advanced Use of vCloud Provisioner
Advanced use includes cleaning, comparing two instances of the CloudProvisionData container, appending, and modifying. Cleaning
You can clean up all entities that were flushed to the vCloud using the following method:
CloudProvisionData.cleanUp(boolean onlyOwnedEntities);
Use the onlyOwnedEntities argument if only the entities that were created from this CloudProvisionData should be cleaned.
// Provision some networks and vApps
CloudProvisionData pdNewEntities = CloudProvisionData.fromXml("network-new.xml", restServiceBundle);
try {
// Verify it works OK
} finally {
} Comparing Two Instances of the CloudProvisionDataContainer
Comparing two instances is useful for tests that need to verify the state of the two vCloud instances, such as before and after an upgrade.
CloudProvisionData pdBefore = CloudProvisionData.fromXml("network-prequisities.xml", restServiceBundle);
CloudProvisionData pdAfter = CloudProvisionData.fromCloud(restServiceBundle);
if (pdAfter.equals(pdBefore) {
// Success
} else {
} Appending Entities
You can append the entities from one CloudProvisionData container to another and then operate on the latter.
pdFirst.append(pdSecond); Modifying Entities
You can modify existing entities by using the modify()method of individual entities, or the modify() method of the CloudProvisionData container.