mirror of https://github.com/apache/jclouds.git
Issue 112: terremark now supports clone
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2622 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
b9de6558d5
commit
480fc9b31a
|
@ -96,7 +96,7 @@ public class TerremarkVAppHandler extends ParseSax.HandlerWithResult<TerremarkVA
|
||||||
size = Integer.parseInt(attributes.getValue(attributes.getIndex("size")));
|
size = Integer.parseInt(attributes.getValue(attributes.getIndex("size")));
|
||||||
} else if (qName.equals("OperatingSystemSection")) {
|
} else if (qName.equals("OperatingSystemSection")) {
|
||||||
inOs = true;
|
inOs = true;
|
||||||
} else if (qName.equals("q1:NetworkConnection")) {
|
} else if (qName.equals("NetworkConnection")) {
|
||||||
networkName = attributes.getValue(attributes.getIndex("Network"));
|
networkName = attributes.getValue(attributes.getIndex("Network"));
|
||||||
} else {
|
} else {
|
||||||
systemHandler.startElement(uri, localName, qName, attributes);
|
systemHandler.startElement(uri, localName, qName, attributes);
|
||||||
|
@ -111,7 +111,7 @@ public class TerremarkVAppHandler extends ParseSax.HandlerWithResult<TerremarkVA
|
||||||
inOs = false;
|
inOs = false;
|
||||||
} else if (inOs && qName.equals("Description")) {
|
} else if (inOs && qName.equals("Description")) {
|
||||||
operatingSystemDescription = currentText.toString().trim();
|
operatingSystemDescription = currentText.toString().trim();
|
||||||
} else if (qName.equals("q1:IpAddress")) {
|
} else if (qName.equals("IpAddress")) {
|
||||||
networkToAddresses.put(networkName, parseInetAddress(currentText.toString().trim()));
|
networkToAddresses.put(networkName, parseInetAddress(currentText.toString().trim()));
|
||||||
} else if (qName.equals("System")) {
|
} else if (qName.equals("System")) {
|
||||||
systemHandler.endElement(uri, localName, qName);
|
systemHandler.endElement(uri, localName, qName);
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
|
||||||
vApp = tmClient.instantiateVAppTemplateInVDC(vDCId, serverName, vAppTemplateId,
|
vApp = tmClient.instantiateVAppTemplateInVDC(vDCId, serverName, vAppTemplateId,
|
||||||
instantiateOptions);
|
instantiateOptions);
|
||||||
|
|
||||||
assertEquals(vApp.getStatus(), VAppStatus.UNRESOLVED);
|
assertEquals(vApp.getStatus(), VAppStatus.RESOLVED);
|
||||||
|
|
||||||
// in terremark, this should be a no-op, as it should simply return the above task, which is
|
// in terremark, this should be a no-op, as it should simply return the above task, which is
|
||||||
// already deploying
|
// already deploying
|
||||||
|
@ -203,7 +203,7 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
|
||||||
|
|
||||||
vApp = tmClient.getVApp(vApp.getId());
|
vApp = tmClient.getVApp(vApp.getId());
|
||||||
|
|
||||||
assertEquals(vApp.getStatus(), VAppStatus.UNRESOLVED);
|
assertEquals(vApp.getStatus(), VAppStatus.RESOLVED);
|
||||||
|
|
||||||
try {// per docs, this is not supported
|
try {// per docs, this is not supported
|
||||||
tmClient.cancelTask(deployTask.getId());
|
tmClient.cancelTask(deployTask.getId());
|
||||||
|
@ -250,9 +250,11 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
|
||||||
assertEquals(is.getDescription(), "holy cow");
|
assertEquals(is.getDescription(), "holy cow");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 500 errors
|
@Test(dependsOnMethods = { "testInstantiateAndPowerOn" })
|
||||||
@Test(dependsOnMethods = { "testInstantiateAndPowerOn" }, expectedExceptions = HttpResponseException.class)
|
|
||||||
public void testCloneVApp() {
|
public void testCloneVApp() {
|
||||||
|
assert successTester.apply(tmClient.powerOffVApp(vApp.getId()).getId());
|
||||||
|
System.out.printf("%d: done powering off vApp%n", System.currentTimeMillis());
|
||||||
|
|
||||||
// lookup the id of the datacenter you are deploying into
|
// lookup the id of the datacenter you are deploying into
|
||||||
String vDCId = tmClient.getDefaultVDC().getId();
|
String vDCId = tmClient.getDefaultVDC().getId();
|
||||||
|
|
||||||
|
@ -270,6 +272,9 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
|
||||||
assert successTester.apply(task.getId());
|
assert successTester.apply(task.getId());
|
||||||
System.out.printf("%d: done cloning vApp%n", System.currentTimeMillis());
|
System.out.printf("%d: done cloning vApp%n", System.currentTimeMillis());
|
||||||
|
|
||||||
|
assert successTester.apply(tmClient.powerOnVApp(vApp.getId()).getId());
|
||||||
|
System.out.printf("%d: done powering on vApp%n", System.currentTimeMillis());
|
||||||
|
|
||||||
// refresh task to get the new vApp location
|
// refresh task to get the new vApp location
|
||||||
task = tmClient.getTask(task.getId());
|
task = tmClient.getTask(task.getId());
|
||||||
|
|
||||||
|
@ -352,11 +357,12 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
|
||||||
assertEquals(vApp.getResourceAllocationByType().get(ResourceType.DISK_DRIVE).size(), 2);
|
assertEquals(vApp.getResourceAllocationByType().get(ResourceType.DISK_DRIVE).size(), 2);
|
||||||
|
|
||||||
// extract the disks on the vApp sorted by addressOnParent
|
// extract the disks on the vApp sorted by addressOnParent
|
||||||
List<ResourceAllocation> disks = Lists.newArrayList(vApp.getResourceAllocationByType()
|
List<ResourceAllocation> disks = Lists.newArrayList(vApp.getResourceAllocationByType().get(
|
||||||
.get(ResourceType.DISK_DRIVE));
|
ResourceType.DISK_DRIVE));
|
||||||
|
|
||||||
// delete the second disk
|
// delete the second disk
|
||||||
task = tmClient.configureVApp(vApp, deleteDiskWithAddressOnParent(disks.get(1).getAddressOnParent()));
|
task = tmClient.configureVApp(vApp, deleteDiskWithAddressOnParent(disks.get(1)
|
||||||
|
.getAddressOnParent()));
|
||||||
|
|
||||||
assert successTester.apply(task.getId());
|
assert successTester.apply(task.getId());
|
||||||
|
|
||||||
|
@ -420,7 +426,6 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
|
||||||
}
|
}
|
||||||
tmClient.deleteVApp(vApp.getId());
|
tmClient.deleteVApp(vApp.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clone != null) {
|
if (clone != null) {
|
||||||
try {
|
try {
|
||||||
successTester.apply(tmClient.powerOffVApp(clone.getId()).getId());
|
successTester.apply(tmClient.powerOffVApp(clone.getId()).getId());
|
||||||
|
|
|
@ -101,23 +101,23 @@ public class TerremarkVAppHandlerTest extends BaseHandlerTest {
|
||||||
|
|
||||||
TerremarkVApp result = (TerremarkVApp) factory.create(
|
TerremarkVApp result = (TerremarkVApp) factory.create(
|
||||||
injector.getInstance(TerremarkVAppHandler.class)).parse(is);
|
injector.getInstance(TerremarkVAppHandler.class)).parse(is);
|
||||||
assertEquals(result.getId(), 16161 + "");
|
assertEquals(result.getId(), 16238 + "");
|
||||||
|
|
||||||
assertEquals(result.getName(), "centos-53");
|
assertEquals(result.getName(), "centos-53");
|
||||||
assertEquals(result.getStatus(), VAppStatus.ON);
|
assertEquals(result.getStatus(), VAppStatus.OFF);
|
||||||
|
|
||||||
assertEquals(result.getSize().longValue(), 10485760);
|
assertEquals(result.getSize().longValue(), 10485760);
|
||||||
assertEquals(result.getOperatingSystemDescription(), "Red Hat Enterprise Linux 5 (64-bit)");
|
assertEquals(result.getOperatingSystemDescription(), "Red Hat Enterprise Linux 5 (64-bit)");
|
||||||
|
|
||||||
assertEquals(result.getLocation(), URI
|
assertEquals(result.getLocation(), URI
|
||||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/16161"));
|
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/16238"));
|
||||||
assertEquals(result.getVDC(), new NamedResourceImpl("32", null, VCloudMediaType.VDC_XML, URI
|
assertEquals(result.getVDC(), new NamedResourceImpl("32", null, VCloudMediaType.VDC_XML, URI
|
||||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32")));
|
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32")));
|
||||||
|
|
||||||
assertEquals(result.getSystem(), new TerremarkVirtualSystem(null, null, null, null, null,
|
assertEquals(result.getSystem(), new TerremarkVirtualSystem(null, null, null, null, null,
|
||||||
null, null, null, null, null, null, "Virtual Hardware Family", 0, null, null, null,
|
null, null, null, null, null, null, "Virtual Hardware Family", 0, null, null, null,
|
||||||
null, null, "centos-53", "vmx-07"));
|
null, null, "centos-53", "vmx-07"));
|
||||||
assertEquals(result.getNetworkToAddresses().get("Internal"), ImmutableList.<InetAddress>of());
|
assertEquals(result.getNetworkToAddresses().get("Internal"), ImmutableList.<InetAddress>of(InetAddress.getByName("10.114.34.132")));
|
||||||
|
|
||||||
ResourceAllocation cpu = new ResourceAllocation(1, "1 virtual CPU(s)",
|
ResourceAllocation cpu = new ResourceAllocation(1, "1 virtual CPU(s)",
|
||||||
"Number of Virtual CPUs", ResourceType.PROCESSOR, null, null, null, null, null,
|
"Number of Virtual CPUs", ResourceType.PROCESSOR, null, null, null, null, null,
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
<VApp href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/16161"
|
<VApp href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/16238"
|
||||||
type="application/vnd.vmware.vcloud.vApp+xml" name="centos-53"
|
type="application/vnd.vmware.vcloud.vApp+xml" name="centos-53"
|
||||||
status="4" size="10485760" xmlns="http://www.vmware.com/vcloud/v0.8"
|
status="2" size="10485760" xmlns="http://www.vmware.com/vcloud/v0.8"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||||
<Link rel="up"
|
<Link rel="up"
|
||||||
href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"
|
href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"
|
||||||
type="application/vnd.vmware.vcloud.vdc+xml" />
|
type="application/vnd.vmware.vcloud.vdc+xml" />
|
||||||
<Link rel="down"
|
<Link rel="down"
|
||||||
href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/16161/options/compute"
|
href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/16238/options/compute"
|
||||||
type="application/xml" name="Compute Options" />
|
type="application/xml" name="Compute Options" />
|
||||||
<Link rel="down"
|
<Link rel="down"
|
||||||
href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/16161/options/customization"
|
href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/16238/options/customization"
|
||||||
type="application/xml" name="Customization Options" />
|
type="application/xml" name="Customization Options" />
|
||||||
<NetworkConnectionSection xmlns="http://schemas.dmtf.org/ovf/envelope/1">
|
<NetworkConnectionSection xmlns="http://schemas.dmtf.org/ovf/envelope/1">
|
||||||
<NetworkConnection Network="Internal"
|
<NetworkConnection Network="Internal"
|
||||||
xmlns="http://www.vmware.com/vcloud/v0.8" />
|
xmlns="http://www.vmware.com/vcloud/v0.8">
|
||||||
|
<IpAddress>10.114.34.132</IpAddress>
|
||||||
|
</NetworkConnection>
|
||||||
</NetworkConnectionSection>
|
</NetworkConnectionSection>
|
||||||
<OperatingSystemSection d2p1:id="26"
|
<OperatingSystemSection d2p1:id="26"
|
||||||
xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:d2p1="http://schemas.dmtf.org/ovf/envelope/1">
|
xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:d2p1="http://schemas.dmtf.org/ovf/envelope/1">
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
<Link rel="down"
|
<Link rel="down"
|
||||||
href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15639/options/customization"
|
href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15639/options/customization"
|
||||||
type="application/xml" name="Customization Options" />
|
type="application/xml" name="Customization Options" />
|
||||||
<Section xsi:type="q1:NetworkConnectionSectionType" xmlns="http://schemas.dmtf.org/ovf/envelope/1"
|
<Section xsi:type="NetworkConnectionSectionType" xmlns="http://schemas.dmtf.org/ovf/envelope/1"
|
||||||
xmlns:q1="http://www.vmware.com/vcloud/v1">
|
xmlns:q1="http://www.vmware.com/vcloud/v1">
|
||||||
<q1:NetworkConnection Network="Internal">
|
<NetworkConnection Network="Internal">
|
||||||
<q1:IpAddress>10.114.34.131</q1:IpAddress>
|
<IpAddress>10.114.34.131</IpAddress>
|
||||||
</q1:NetworkConnection>
|
</NetworkConnection>
|
||||||
</Section>
|
</Section>
|
||||||
<OperatingSystemSection d2p1:id="45"
|
<OperatingSystemSection d2p1:id="45"
|
||||||
xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:d2p1="http://schemas.dmtf.org/ovf/envelope/1">
|
xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:d2p1="http://schemas.dmtf.org/ovf/envelope/1">
|
||||||
|
|
Loading…
Reference in New Issue