Issue 280: split vcloud 0.8 vapp from 1.0

This commit is contained in:
Adrian Cole 2010-08-23 19:13:30 -07:00
parent 7058b73c2c
commit 345684c6f2
56 changed files with 2213 additions and 562 deletions

View File

@ -45,7 +45,7 @@ public class BlueLockVCloudDirectorComputeClient extends VCloudComputeClientImpl
@Inject
protected BlueLockVCloudDirectorComputeClient(PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider,
VCloudClient client, Predicate<URI> successTester, Map<Status, NodeState> vAppStatusToNodeState) {
VCloudClient client, Predicate<URI> successTester, Map<Status, NodeState> vAppStatusToNodeState) {
super(client, successTester, vAppStatusToNodeState);
this.credentialsProvider = credentialsProvider;
}

View File

@ -30,8 +30,8 @@ import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrat
import org.jclouds.domain.Credentials;
import org.jclouds.vcloud.VCloudExpressClient;
import org.jclouds.vcloud.compute.internal.VCloudExpressComputeClientImpl;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
import com.google.common.base.Predicate;
@ -45,13 +45,14 @@ public class BlueLockVCloudExpressComputeClient extends VCloudExpressComputeClie
@Inject
protected BlueLockVCloudExpressComputeClient(PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider,
VCloudExpressClient client, Predicate<URI> successTester, Map<Status, NodeState> vAppStatusToNodeState) {
VCloudExpressClient client, Predicate<URI> successTester, Map<Status, NodeState> vAppStatusToNodeState) {
super(client, successTester, vAppStatusToNodeState);
this.credentialsProvider = credentialsProvider;
}
@Override
protected Map<String, String> parseAndValidateResponse(VCloudExpressVAppTemplate template, VApp vAppResponse) {
protected Map<String, String> parseAndValidateResponse(VCloudExpressVAppTemplate template,
VCloudExpressVApp vAppResponse) {
Credentials credentials = credentialsProvider.execute(template);
Map<String, String> toReturn = super.parseResponse(template, vAppResponse);
toReturn.put("username", credentials.identity);

View File

@ -25,7 +25,6 @@ import static org.jclouds.vcloud.VCloudMediaType.NETWORK_XML;
import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML;
import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
import java.net.URI;
@ -48,7 +47,6 @@ import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.domain.Org;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.TasksList;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VDC;
import org.jclouds.vcloud.domain.network.OrgNetwork;
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
@ -64,7 +62,6 @@ import org.jclouds.vcloud.xml.OrgHandler;
import org.jclouds.vcloud.xml.OrgNetworkHandler;
import org.jclouds.vcloud.xml.TaskHandler;
import org.jclouds.vcloud.xml.TasksListHandler;
import org.jclouds.vcloud.xml.VAppHandler;
import org.jclouds.vcloud.xml.VDCHandler;
import com.google.common.util.concurrent.ListenableFuture;
@ -283,25 +280,5 @@ public interface CommonVCloudAsyncClient {
@Path("/action/cancel")
ListenableFuture<Void> cancelTask(@EndpointParam URI taskId);
/**
* @see VCloudClient#findVAppInOrgVDCNamed
*/
@GET
@Consumes(VAPP_XML)
@XMLResponseParser(VAppHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends VApp> findVAppInOrgVDCNamed(
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String vAppName);
/**
* @see VCloudClient#getVApp
*/
@GET
@Consumes(VAPP_XML)
@XMLResponseParser(VAppHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends VApp> getVApp(@EndpointParam URI vApp);
}

View File

@ -31,7 +31,6 @@ import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.domain.Org;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.TasksList;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VDC;
import org.jclouds.vcloud.domain.network.OrgNetwork;
@ -149,8 +148,5 @@ public interface CommonVCloudClient {
void cancelTask(URI taskId);
VApp findVAppInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String vAppName);
VApp getVApp(URI vApp);
}

View File

@ -48,6 +48,7 @@ import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VAppTemplate;
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
import org.jclouds.vcloud.functions.OrgNameCatalogNameVAppTemplateNameToEndpoint;
import org.jclouds.vcloud.functions.OrgNameVDCNameResourceEntityNameToEndpoint;
import org.jclouds.vcloud.options.CloneVAppOptions;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
import org.jclouds.vcloud.xml.TaskHandler;
@ -60,8 +61,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* Provides access to VCloud resources via their REST API.
* <p/>
*
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx"
* />
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
* @author Adrian Cole
*/
@RequestFilters(SetVCloudTokenCookie.class)
@ -84,9 +84,9 @@ public interface VCloudAsyncClient extends CommonVCloudAsyncClient {
@XMLResponseParser(VAppTemplateHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends VAppTemplate> findVAppTemplateInOrgCatalogNamed(
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String itemName);
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String itemName);
/**
* @see VCloudClient#instantiateVAppTemplateInVDC
@ -99,9 +99,9 @@ public interface VCloudAsyncClient extends CommonVCloudAsyncClient {
// TODO convert this.
@MapBinder(BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload.class)
ListenableFuture<? extends VApp> instantiateVAppTemplateInVDC(@EndpointParam URI vdc,
@MapPayloadParam("template") URI template,
@MapPayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
InstantiateVAppTemplateOptions... options);
@MapPayloadParam("template") URI template,
@MapPayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
InstantiateVAppTemplateOptions... options);
/**
* @see VCloudClient#cloneVAppInVDC
@ -113,7 +113,27 @@ public interface VCloudAsyncClient extends CommonVCloudAsyncClient {
@XMLResponseParser(TaskHandler.class)
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
ListenableFuture<? extends Task> cloneVAppInVDC(@EndpointParam URI vdc, @MapPayloadParam("vApp") URI toClone,
@MapPayloadParam("newName") @ParamValidators(DnsNameValidator.class) String newName,
CloneVAppOptions... options);
@MapPayloadParam("newName") @ParamValidators(DnsNameValidator.class) String newName,
CloneVAppOptions... options);
/**
* @see VCloudClient#findVAppInOrgVDCNamed
*/
@GET
@Consumes(VAPP_XML)
@XMLResponseParser(VAppHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends VApp> findVAppInOrgVDCNamed(
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String vAppName);
/**
* @see VCloudClient#getVApp
*/
@GET
@Consumes(VAPP_XML)
@XMLResponseParser(VAppHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends VApp> getVApp(@EndpointParam URI vApp);
}

View File

@ -36,9 +36,7 @@ import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
* Provides access to VCloud resources via their REST API.
* <p/>
*
* @see <a
* href="http://communities.vmware.com/community/developer/forums/vcloudapi"
* />
* @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
* @author Adrian Cole
*/
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
@ -51,9 +49,8 @@ public interface VCloudClient extends CommonVCloudClient {
VAppTemplate getVAppTemplate(URI vAppTemplate);
/**
* returns the vapp template corresponding to a catalog item in the catalog
* associated with the specified name. Note that the org and catalog
* parameters can be null to choose default.
* returns the vapp template corresponding to a catalog item in the catalog associated with the
* specified name. Note that the org and catalog parameters can be null to choose default.
*
* @param orgName
* organization name, or null for the default
@ -63,9 +60,12 @@ public interface VCloudClient extends CommonVCloudClient {
* item you wish to lookup
*
* @throws NoSuchElementException
* if you specified an org, catalog, or catalog item name that
* isn't present
* if you specified an org, catalog, or catalog item name that isn't present
*/
VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName,
String itemName);
String itemName);
VApp findVAppInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String vAppName);
VApp getVApp(URI vApp);
}

View File

@ -45,7 +45,7 @@ import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload;
import org.jclouds.vcloud.binders.BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
import org.jclouds.vcloud.domain.network.OrgNetwork;
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
@ -55,7 +55,7 @@ import org.jclouds.vcloud.options.CloneVAppOptions;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
import org.jclouds.vcloud.xml.OrgNetworkFromVCloudExpressNetworkHandler;
import org.jclouds.vcloud.xml.TaskHandler;
import org.jclouds.vcloud.xml.VAppHandler;
import org.jclouds.vcloud.xml.VCloudExpressVAppHandler;
import org.jclouds.vcloud.xml.VCloudExpressVAppTemplateHandler;
import com.google.common.util.concurrent.ListenableFuture;
@ -64,8 +64,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* Provides access to VCloud resources via their REST API.
* <p/>
*
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx"
* />
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
* @author Adrian Cole
*/
@RequestFilters(SetVCloudTokenCookie.class)
@ -88,9 +87,9 @@ public interface VCloudExpressAsyncClient extends CommonVCloudAsyncClient {
@XMLResponseParser(VCloudExpressVAppTemplateHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends VCloudExpressVAppTemplate> findVAppTemplateInOrgCatalogNamed(
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String itemName);
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String itemName);
/**
* @see VCloudClient#findNetworkInOrgVDCNamed
@ -101,9 +100,9 @@ public interface VCloudExpressAsyncClient extends CommonVCloudAsyncClient {
@XMLResponseParser(OrgNetworkFromVCloudExpressNetworkHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends OrgNetwork> findNetworkInOrgVDCNamed(
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String networkName);
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String networkName);
/**
* @see VCloudClient#getNetwork
@ -122,12 +121,12 @@ public interface VCloudExpressAsyncClient extends CommonVCloudAsyncClient {
@Path("action/instantiateVAppTemplate")
@Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
@Consumes(VAPP_XML)
@XMLResponseParser(VAppHandler.class)
@XMLResponseParser(VCloudExpressVAppHandler.class)
@MapBinder(BindInstantiateVCloudExpressVAppTemplateParamsToXmlPayload.class)
ListenableFuture<? extends VApp> instantiateVAppTemplateInVDC(@EndpointParam URI vdc,
@MapPayloadParam("template") URI template,
@MapPayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
InstantiateVAppTemplateOptions... options);
ListenableFuture<? extends VCloudExpressVApp> instantiateVAppTemplateInVDC(@EndpointParam URI vdc,
@MapPayloadParam("template") URI template,
@MapPayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
InstantiateVAppTemplateOptions... options);
/**
* @see VCloudExpressClient#cloneVAppInVDC
@ -139,7 +138,27 @@ public interface VCloudExpressAsyncClient extends CommonVCloudAsyncClient {
@XMLResponseParser(TaskHandler.class)
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
ListenableFuture<? extends Task> cloneVAppInVDC(@EndpointParam URI vdc, @MapPayloadParam("vApp") URI toClone,
@MapPayloadParam("newName") @ParamValidators(DnsNameValidator.class) String newName,
CloneVAppOptions... options);
@MapPayloadParam("newName") @ParamValidators(DnsNameValidator.class) String newName,
CloneVAppOptions... options);
/**
* @see VCloudClient#findVAppInOrgVDCNamed
*/
@GET
@Consumes(VAPP_XML)
@XMLResponseParser(VCloudExpressVAppHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends VCloudExpressVApp> findVAppInOrgVDCNamed(
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String orgName,
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String catalogName,
@EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String vAppName);
/**
* @see VCloudClient#getVApp
*/
@GET
@Consumes(VAPP_XML)
@XMLResponseParser(VCloudExpressVAppHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<? extends VCloudExpressVApp> getVApp(@EndpointParam URI vApp);
}

View File

@ -27,7 +27,7 @@ import javax.annotation.Nullable;
import org.jclouds.concurrent.Timeout;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
import org.jclouds.vcloud.options.CloneVAppOptions;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
@ -36,23 +36,22 @@ import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
* Provides access to VCloud resources via their REST API.
* <p/>
*
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx"
* />
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
* @author Adrian Cole
*/
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
public interface VCloudExpressClient extends CommonVCloudClient {
VApp instantiateVAppTemplateInVDC(URI vDC, URI template, String appName, InstantiateVAppTemplateOptions... options);
VCloudExpressVApp instantiateVAppTemplateInVDC(URI vDC, URI template, String appName,
InstantiateVAppTemplateOptions... options);
Task cloneVAppInVDC(URI vDC, URI toClone, String newName, CloneVAppOptions... options);
VCloudExpressVAppTemplate getVAppTemplate(URI vAppTemplate);
/**
* returns the vapp template corresponding to a catalog item in the catalog
* associated with the specified name. Note that the org and catalog
* parameters can be null to choose default.
* returns the vapp template corresponding to a catalog item in the catalog associated with the
* specified name. Note that the org and catalog parameters can be null to choose default.
*
* @param orgName
* organization name, or null for the default
@ -62,9 +61,12 @@ public interface VCloudExpressClient extends CommonVCloudClient {
* item you wish to lookup
*
* @throws NoSuchElementException
* if you specified an org, catalog, or catalog item name that
* isn't present
* if you specified an org, catalog, or catalog item name that isn't present
*/
VCloudExpressVAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName,
String itemName);
String itemName);
VCloudExpressVApp findVAppInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String vAppName);
VCloudExpressVApp getVApp(URI vApp);
}

View File

@ -31,16 +31,12 @@ import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.domain.Size;
import org.jclouds.compute.strategy.DestroyNodeStrategy;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.compute.strategy.ListNodesStrategy;
import org.jclouds.compute.strategy.RebootNodeStrategy;
import org.jclouds.compute.strategy.RunNodesAndAddToSetStrategy;
import org.jclouds.compute.strategy.impl.EncodeTagIntoNameRunNodesAndAddToSetStrategy;
import org.jclouds.domain.Location;
import org.jclouds.vcloud.compute.internal.VCloudComputeClientImpl;
import org.jclouds.vcloud.compute.strategy.VCloudDestroyNodeStrategy;
import org.jclouds.vcloud.compute.strategy.VCloudGetNodeMetadataStrategy;
import org.jclouds.vcloud.compute.strategy.VCloudListNodesStrategy;
import org.jclouds.vcloud.compute.strategy.VCloudRebootNodeStrategy;
import org.jclouds.vcloud.compute.suppliers.OrgAndVDCToLocationSupplier;
import org.jclouds.vcloud.compute.suppliers.StaticSizeSupplier;
@ -82,8 +78,6 @@ public abstract class CommonVCloudComputeServiceContextModule extends BaseComput
install(new ComputeServiceTimeoutsModule());
bind(DestroyNodeStrategy.class).to(VCloudDestroyNodeStrategy.class);
bind(RunNodesAndAddToSetStrategy.class).to(EncodeTagIntoNameRunNodesAndAddToSetStrategy.class);
bind(ListNodesStrategy.class).to(VCloudListNodesStrategy.class);
bind(GetNodeMetadataStrategy.class).to(VCloudGetNodeMetadataStrategy.class);
bind(RebootNodeStrategy.class).to(VCloudRebootNodeStrategy.class);
bindLoadBalancer();
}

View File

@ -25,6 +25,8 @@ import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.internal.ComputeServiceContextImpl;
import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.compute.strategy.ListNodesStrategy;
import org.jclouds.rest.RestContext;
import org.jclouds.rest.internal.RestContextImpl;
import org.jclouds.vcloud.VCloudClient;
@ -33,6 +35,8 @@ import org.jclouds.vcloud.compute.VCloudComputeClient;
import org.jclouds.vcloud.compute.functions.ImagesInOrg;
import org.jclouds.vcloud.compute.internal.VCloudComputeClientImpl;
import org.jclouds.vcloud.compute.strategy.VCloudAddNodeWithTagStrategy;
import org.jclouds.vcloud.compute.strategy.VCloudGetNodeMetadataStrategy;
import org.jclouds.vcloud.compute.strategy.VCloudListNodesStrategy;
import org.jclouds.vcloud.domain.Org;
import com.google.common.base.Function;
@ -51,6 +55,7 @@ public class VCloudComputeServiceContextModule extends CommonVCloudComputeServic
@Override
protected void configure() {
super.configure();
bind(GetNodeMetadataStrategy.class).to(VCloudGetNodeMetadataStrategy.class);
bind(new TypeLiteral<ComputeServiceContext>() {
}).to(new TypeLiteral<ComputeServiceContextImpl<VCloudClient, VCloudClient>>() {
}).in(Scopes.SINGLETON);
@ -61,6 +66,7 @@ public class VCloudComputeServiceContextModule extends CommonVCloudComputeServic
}).to(new TypeLiteral<ImagesInOrg>() {
});
bind(AddNodeWithTagStrategy.class).to(VCloudAddNodeWithTagStrategy.class);
bind(ListNodesStrategy.class).to(VCloudListNodesStrategy.class);
}
@Provides

View File

@ -25,6 +25,8 @@ import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.internal.ComputeServiceContextImpl;
import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.compute.strategy.ListNodesStrategy;
import org.jclouds.rest.RestContext;
import org.jclouds.rest.internal.RestContextImpl;
import org.jclouds.vcloud.VCloudExpressClient;
@ -33,6 +35,8 @@ import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
import org.jclouds.vcloud.compute.functions.ImagesInVCloudExpressOrg;
import org.jclouds.vcloud.compute.internal.VCloudExpressComputeClientImpl;
import org.jclouds.vcloud.compute.strategy.VCloudExpressAddNodeWithTagStrategy;
import org.jclouds.vcloud.compute.strategy.VCloudExpressGetNodeMetadataStrategy;
import org.jclouds.vcloud.compute.strategy.VCloudExpressListNodesStrategy;
import org.jclouds.vcloud.domain.Org;
import com.google.common.base.Function;
@ -51,6 +55,7 @@ public class VCloudExpressComputeServiceContextModule extends CommonVCloudComput
@Override
protected void configure() {
super.configure();
bind(GetNodeMetadataStrategy.class).to(VCloudExpressGetNodeMetadataStrategy.class);
bind(new TypeLiteral<ComputeServiceContext>() {
}).to(new TypeLiteral<ComputeServiceContextImpl<VCloudExpressClient, VCloudExpressClient>>() {
}).in(Scopes.SINGLETON);
@ -61,6 +66,7 @@ public class VCloudExpressComputeServiceContextModule extends CommonVCloudComput
}).to(new TypeLiteral<ImagesInVCloudExpressOrg>() {
});
bind(AddNodeWithTagStrategy.class).to(VCloudExpressAddNodeWithTagStrategy.class);
bind(ListNodesStrategy.class).to(VCloudExpressListNodesStrategy.class);
}
@Provides

View File

@ -0,0 +1,73 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.vcloud.compute.functions;
import static com.google.common.collect.Maps.newHashMap;
import java.util.Map;
import javax.annotation.Resource;
import javax.inject.Singleton;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.compute.internal.VCloudExpressComputeClientImpl;
import org.jclouds.vcloud.domain.VApp;
import com.google.common.base.Function;
/**
* Configures the {@link VCloudComputeServiceContext}; requires
* {@link VCloudExpressComputeClientImpl} bound.
*
* @author Adrian Cole
*/
@Singleton
public class GetExtraFromVApp implements Function<VApp, Map<String, String>> {
@Resource
protected Logger logger = Logger.NULL;
public Map<String, String> apply(VApp vApp) {
Map<String, String> extra = newHashMap();
try {
// TODO
// extra.put("memory/mb", find(vApp.getResourceAllocations(),
// resourceType(ResourceType.MEMORY))
// .getVirtualQuantity()
// + "");
// extra.put("processor/count", find(vApp.getResourceAllocations(),
// resourceType(ResourceType.PROCESSOR))
// .getVirtualQuantity()
// + "");
// for (ResourceAllocation disk : filter(vApp.getResourceAllocations(),
// resourceType(ResourceType.DISK_DRIVE))) {
// extra.put(String.format("disk_drive/%s/kb", disk.getAddressOnParent()),
// disk.getVirtualQuantity() + "");
// }
//
// for (Entry<String, String> net : vApp.getNetworkToAddresses().entries()) {
// extra.put(String.format("network/%s/ip", net.getKey()), net.getValue());
// }
} catch (Exception e) {
logger.error(e, "error getting extra data for vApp: %s", vApp);
}
return extra;
}
}

View File

@ -34,7 +34,7 @@ import org.jclouds.logging.Logger;
import org.jclouds.vcloud.compute.internal.VCloudExpressComputeClientImpl;
import org.jclouds.vcloud.domain.ResourceAllocation;
import org.jclouds.vcloud.domain.ResourceType;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import com.google.common.base.Function;
@ -45,12 +45,12 @@ import com.google.common.base.Function;
* @author Adrian Cole
*/
@Singleton
public class GetExtra implements Function<VApp, Map<String, String>> {
public class GetExtraFromVCloudExpressVApp implements Function<VCloudExpressVApp, Map<String, String>> {
@Resource
protected Logger logger = Logger.NULL;
public Map<String, String> apply(VApp vApp) {
public Map<String, String> apply(VCloudExpressVApp vApp) {
Map<String, String> extra = newHashMap();
try {
extra.put("memory/mb", find(vApp.getResourceAllocations(), resourceType(ResourceType.MEMORY))

View File

@ -33,21 +33,19 @@ import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.CommonVCloudClient;
import org.jclouds.vcloud.compute.CommonVCloudComputeClient;
import org.jclouds.vcloud.domain.NamedResource;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
/**
* @author Adrian Cole
*/
@Singleton
public class CommonVCloudComputeClientImpl<T> implements CommonVCloudComputeClient {
public abstract class CommonVCloudComputeClientImpl<T, A extends NamedResource> implements CommonVCloudComputeClient {
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL;
@ -61,7 +59,7 @@ public class CommonVCloudComputeClientImpl<T> implements CommonVCloudComputeClie
this.taskTester = successTester;
}
protected Map<String, String> parseAndValidateResponse(T template, VApp vAppResponse) {
protected Map<String, String> parseAndValidateResponse(T template, A vAppResponse) {
Map<String, String> response = parseResponse(template, vAppResponse);
checkState(response.containsKey("id"), "bad configuration: [id] should be in response");
checkState(response.containsKey("username"), "bad configuration: [username] should be in response");
@ -69,7 +67,7 @@ public class CommonVCloudComputeClientImpl<T> implements CommonVCloudComputeClie
return response;
}
protected Map<String, String> parseResponse(T template, VApp vAppResponse) {
protected Map<String, String> parseResponse(T template, A vAppResponse) {
Map<String, String> config = Maps.newLinkedHashMap();// Allows nulls
config.put("id", vAppResponse.getId().toASCIIString());
config.put("username", null);
@ -79,99 +77,65 @@ public class CommonVCloudComputeClientImpl<T> implements CommonVCloudComputeClie
@Override
public void reboot(URI id) {
VApp vApp = client.getVApp(id);
A vApp = refreshVApp(id);
logger.debug(">> resetting vApp(%s)", vApp.getName());
Task task = client.resetVApp(vApp.getId());
if (!taskTester.apply(task.getLocation())) {
throw new TaskException("resetVApp", vApp, task);
throw new RuntimeException(String.format("failed to %s %s: %s", "resetVApp", vApp.getName(), task));
}
logger.debug("<< on vApp(%s)", vApp.getName());
}
protected abstract A refreshVApp(URI id);
@Override
public void stop(URI id) {
VApp vApp = client.getVApp(id);
A vApp = refreshVApp(id);
vApp = powerOffVAppIfDeployed(vApp);
vApp = undeployVAppIfDeployed(vApp);
deleteVApp(vApp);
logger.debug("<< deleted vApp(%s)", vApp.getName());
}
private void deleteVApp(VApp vApp) {
private void deleteVApp(A vApp) {
logger.debug(">> deleting vApp(%s)", vApp.getName());
client.deleteVApp(vApp.getId());
}
private VApp undeployVAppIfDeployed(VApp vApp) {
if (vApp.getStatus().compareTo(Status.RESOLVED) > 0) {
logger.debug(">> undeploying vApp(%s), current status: %s", vApp.getName(), vApp.getStatus());
private A undeployVAppIfDeployed(A vApp) {
if (getStatus(vApp).compareTo(Status.RESOLVED) > 0) {
logger.debug(">> undeploying vApp(%s), current status: %s", vApp.getName(), getStatus(vApp));
Task task = client.undeployVApp(vApp.getId());
if (!taskTester.apply(task.getLocation())) {
throw new TaskException("undeploy", vApp, task);
// TODO timeout
throw new RuntimeException(String.format("failed to %s %s: %s", "undeploy", vApp.getName(), task));
}
vApp = client.getVApp(vApp.getId());
logger.debug("<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
vApp = refreshVApp(vApp.getId());
logger.debug("<< %s vApp(%s)", getStatus(vApp), vApp.getName());
}
return vApp;
}
private VApp powerOffVAppIfDeployed(VApp vApp) {
if (vApp.getStatus().compareTo(Status.OFF) > 0) {
logger.debug(">> powering off vApp(%s), current status: %s", vApp.getName(), vApp.getStatus());
private A powerOffVAppIfDeployed(A vApp) {
if (getStatus(vApp).compareTo(Status.OFF) > 0) {
logger.debug(">> powering off vApp(%s), current status: %s", vApp.getName(), getStatus(vApp));
Task task = client.powerOffVApp(vApp.getId());
if (!taskTester.apply(task.getLocation())) {
throw new TaskException("powerOff", vApp, task);
// TODO timeout
throw new RuntimeException(String.format("failed to %s %s: %s", "powerOff", vApp.getName(), task));
}
vApp = client.getVApp(vApp.getId());
logger.debug("<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
vApp = refreshVApp(vApp.getId());
logger.debug("<< %s vApp(%s)", getStatus(vApp), vApp.getName());
}
return vApp;
}
public static class TaskException extends VAppException {
private final Task task;
/** The serialVersionUID */
private static final long serialVersionUID = 251801929573211256L;
public TaskException(String type, VApp vApp, Task task) {
super(String.format("failed to %s vApp %s status %s;task %s status %s", type, vApp.getName(),
vApp.getStatus(), task.getLocation(), task.getStatus()), vApp);
this.task = task;
}
public Task getTask() {
return task;
}
}
public static class VAppException extends RuntimeException {
private final VApp vApp;
/** The serialVersionUID */
private static final long serialVersionUID = 251801929573211256L;
public VAppException(String message, VApp vApp) {
super(message);
this.vApp = vApp;
}
public VApp getvApp() {
return vApp;
}
}
protected abstract Status getStatus(A vApp);
@Override
public Set<String> getPrivateAddresses(URI id) {
return ImmutableSet.of();
}
public abstract Set<String> getPrivateAddresses(URI id);
@Override
public Set<String> getPublicAddresses(URI id) {
VApp vApp = client.getVApp(id);
return Sets.newHashSet(vApp.getNetworkToAddresses().values());
}
public abstract Set<String> getPublicAddresses(URI id);
}

View File

@ -23,6 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import javax.inject.Singleton;
@ -38,26 +39,28 @@ import org.jclouds.vcloud.domain.VDC;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Inject;
/**
* @author Adrian Cole
*/
@Singleton
public class VCloudComputeClientImpl extends CommonVCloudComputeClientImpl<VAppTemplate> implements VCloudComputeClient {
public class VCloudComputeClientImpl extends CommonVCloudComputeClientImpl<VAppTemplate, VApp> implements
VCloudComputeClient {
protected final Map<Status, NodeState> vAppStatusToNodeState;
@Inject
public VCloudComputeClientImpl(VCloudClient client, Predicate<URI> successTester,
Map<Status, NodeState> vAppStatusToNodeState) {
Map<Status, NodeState> vAppStatusToNodeState) {
super(client, successTester);
this.vAppStatusToNodeState = vAppStatusToNodeState;
}
@Override
public Map<String, String> start(@Nullable URI VDC, URI templateId, String name,
InstantiateVAppTemplateOptions options, int... portsToOpen) {
InstantiateVAppTemplateOptions options, int... portsToOpen) {
checkNotNull(options, "options");
logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) options(%s) ", VDC, templateId, name, options);
@ -65,7 +68,7 @@ public class VCloudComputeClientImpl extends CommonVCloudComputeClientImpl<VAppT
VAppTemplate template = VCloudClient.class.cast(client).getVAppTemplate(templateId);
VApp vAppResponse = VCloudClient.class.cast(client).instantiateVAppTemplateInVDC(vdc.getId(), template.getId(),
name, options);
name, options);
logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
logger.debug(">> deploying vApp(%s)", vAppResponse.getName());
@ -73,17 +76,40 @@ public class VCloudComputeClientImpl extends CommonVCloudComputeClientImpl<VAppT
Task task = client.deployVApp(vAppResponse.getId());
if (options.shouldBlockOnDeploy()) {
if (!taskTester.apply(task.getLocation())) {
throw new TaskException("deploy", vAppResponse, task);
throw new RuntimeException(String.format("failed to %s %s: %s", "deploy", vAppResponse.getName(), task));
}
logger.debug("<< deployed vApp(%s)", vAppResponse.getName());
logger.debug(">> powering vApp(%s)", vAppResponse.getName());
task = client.powerOnVApp(vAppResponse.getId());
if (!taskTester.apply(task.getLocation())) {
throw new TaskException("powerOn", vAppResponse, task);
throw new RuntimeException(String.format("failed to %s %s: %s", "powerOn", vAppResponse.getName(), task));
}
logger.debug("<< on vApp(%s)", vAppResponse.getName());
}
return parseAndValidateResponse(template, vAppResponse);
}
@Override
public Set<String> getPrivateAddresses(URI id) {
return ImmutableSet.of();
}
@Override
public Set<String> getPublicAddresses(URI id) {
return ImmutableSet.of();
// TODO
// VApp vApp = refreshVApp(id);
// return Sets.newHashSet(vApp.getNetworkToAddresses().values());
}
@Override
protected Status getStatus(VApp vApp) {
return vApp.getStatus();
}
@Override
protected VApp refreshVApp(URI id) {
return VCloudClient.class.cast(client).getVApp(id);
}
}

View File

@ -23,6 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import javax.inject.Singleton;
@ -32,41 +33,44 @@ import org.jclouds.vcloud.VCloudExpressClient;
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
import org.jclouds.vcloud.domain.VDC;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
/**
* @author Adrian Cole
*/
@Singleton
public class VCloudExpressComputeClientImpl extends CommonVCloudComputeClientImpl<VCloudExpressVAppTemplate> implements
VCloudExpressComputeClient {
public class VCloudExpressComputeClientImpl extends
CommonVCloudComputeClientImpl<VCloudExpressVAppTemplate, VCloudExpressVApp> implements
VCloudExpressComputeClient {
protected final Map<Status, NodeState> vAppStatusToNodeState;
@Inject
public VCloudExpressComputeClientImpl(VCloudExpressClient client, Predicate<URI> successTester,
Map<Status, NodeState> vAppStatusToNodeState) {
Map<Status, NodeState> vAppStatusToNodeState) {
super(client, successTester);
this.vAppStatusToNodeState = vAppStatusToNodeState;
}
@Override
public Map<String, String> start(@Nullable URI VDC, URI templateId, String name,
InstantiateVAppTemplateOptions options, int... portsToOpen) {
InstantiateVAppTemplateOptions options, int... portsToOpen) {
checkNotNull(options, "options");
logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) options(%s) ", VDC, templateId, name, options);
VDC vdc = client.getVDC(VDC);
VCloudExpressVAppTemplate template = VCloudExpressClient.class.cast(client).getVAppTemplate(templateId);
VApp vAppResponse = VCloudExpressClient.class.cast(client).instantiateVAppTemplateInVDC(vdc.getId(),
template.getId(), name, options);
VCloudExpressVApp vAppResponse = VCloudExpressClient.class.cast(client).instantiateVAppTemplateInVDC(vdc.getId(),
template.getId(), name, options);
logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
logger.debug(">> deploying vApp(%s)", vAppResponse.getName());
@ -74,18 +78,38 @@ public class VCloudExpressComputeClientImpl extends CommonVCloudComputeClientImp
Task task = client.deployVApp(vAppResponse.getId());
if (options.shouldBlockOnDeploy()) {
if (!taskTester.apply(task.getLocation())) {
throw new TaskException("deploy", vAppResponse, task);
throw new RuntimeException(String.format("failed to %s %s: %s", "deploy", vAppResponse.getName(), task));
}
logger.debug("<< deployed vApp(%s)", vAppResponse.getName());
logger.debug(">> powering vApp(%s)", vAppResponse.getName());
task = client.powerOnVApp(vAppResponse.getId());
if (!taskTester.apply(task.getLocation())) {
throw new TaskException("powerOn", vAppResponse, task);
throw new RuntimeException(String.format("failed to %s %s: %s", "powerOn", vAppResponse.getName(), task));
}
logger.debug("<< on vApp(%s)", vAppResponse.getName());
}
return parseAndValidateResponse(template, vAppResponse);
}
@Override
public Set<String> getPrivateAddresses(URI id) {
return ImmutableSet.of();
}
@Override
public Set<String> getPublicAddresses(URI id) {
VCloudExpressVApp vApp = refreshVApp(id);
return Sets.newHashSet(vApp.getNetworkToAddresses().values());
}
@Override
protected Status getStatus(VCloudExpressVApp vApp) {
return vApp.getStatus();
}
@Override
protected VCloudExpressVApp refreshVApp(URI id) {
return VCloudExpressClient.class.cast(client).getVApp(id);
}
}

View File

@ -37,8 +37,8 @@ import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
import org.jclouds.domain.Credentials;
import org.jclouds.vcloud.VCloudClient;
import org.jclouds.vcloud.compute.VCloudComputeClient;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
import com.google.common.collect.ImmutableMap;
@ -82,8 +82,11 @@ public class VCloudAddNodeWithTagStrategy implements AddNodeWithTagStrategy {
}
private OperatingSystem getOperatingSystemForVAppOrDefaultTo(VApp vApp, OperatingSystem operatingSystem) {
return vApp.getOsType() != null ? new CIMOperatingSystem(CIMOperatingSystem.OSType.fromValue(vApp.getOsType()),
null, null, vApp.getOperatingSystemDescription()) : operatingSystem;
// TODO
return new CIMOperatingSystem(CIMOperatingSystem.OSType.UBUNTU_64, null, null, vApp.getDescription());
// return vApp.getOsType() != null ? new
// CIMOperatingSystem(CIMOperatingSystem.OSType.fromValue(vApp.getOsType()),
// null, null, vApp.getOperatingSystemDescription()) : operatingSystem;
}
}

View File

@ -37,7 +37,7 @@ import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
import org.jclouds.domain.Credentials;
import org.jclouds.vcloud.VCloudExpressClient;
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
@ -68,11 +68,11 @@ public class VCloudExpressAddNodeWithTagStrategy implements AddNodeWithTagStrate
options.blockOnDeploy(false);
Map<String, String> metaMap = computeClient.start(URI.create(template.getLocation().getId()), URI.create(template
.getImage().getId()), name, options, template.getOptions().getInboundPorts());
VApp vApp = client.getVApp(URI.create(metaMap.get("id")));
VCloudExpressVApp vApp = client.getVApp(URI.create(metaMap.get("id")));
return newCreateNodeResponse(tag, template, metaMap, vApp);
}
protected NodeMetadata newCreateNodeResponse(String tag, Template template, Map<String, String> metaMap, VApp vApp) {
protected NodeMetadata newCreateNodeResponse(String tag, Template template, Map<String, String> metaMap, VCloudExpressVApp vApp) {
return new NodeMetadataImpl(vApp.getId().toASCIIString(), vApp.getName(), vApp.getId().toASCIIString(), template
.getLocation(), vApp.getId(), ImmutableMap.<String, String> of(), tag, template.getImage().getId(),
getOperatingSystemForVAppOrDefaultTo(vApp, template.getImage().getOperatingSystem()),
@ -81,7 +81,7 @@ public class VCloudExpressAddNodeWithTagStrategy implements AddNodeWithTagStrate
metaMap.get("username"), metaMap.get("password")));
}
private OperatingSystem getOperatingSystemForVAppOrDefaultTo(VApp vApp, OperatingSystem operatingSystem) {
private OperatingSystem getOperatingSystemForVAppOrDefaultTo(VCloudExpressVApp vApp, OperatingSystem operatingSystem) {
return vApp.getOsType() != null ? new CIMOperatingSystem(CIMOperatingSystem.OSType.fromValue(vApp.getOsType()),
null, null, vApp.getOperatingSystemDescription()) : operatingSystem;
}

View File

@ -0,0 +1,94 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.vcloud.compute.strategy;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.compute.util.ComputeServiceUtils.parseTagFromName;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.domain.internal.NodeMetadataImpl;
import org.jclouds.compute.domain.os.CIMOperatingSystem;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.domain.Location;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.VCloudExpressClient;
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
import org.jclouds.vcloud.compute.functions.FindLocationForResource;
import org.jclouds.vcloud.compute.functions.GetExtraFromVCloudExpressVApp;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableMap;
/**
* @author Adrian Cole
*/
@Singleton
public class VCloudExpressGetNodeMetadataStrategy implements GetNodeMetadataStrategy {
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
public Logger logger = Logger.NULL;
protected final VCloudExpressClient client;
protected final VCloudExpressComputeClient computeClient;
protected final Supplier<Set<? extends Image>> images;
protected final FindLocationForResource findLocationForResourceInVDC;
protected final GetExtraFromVCloudExpressVApp getExtra;
protected final Map<Status, NodeState> vAppStatusToNodeState;
@Inject
protected VCloudExpressGetNodeMetadataStrategy(VCloudExpressClient client, VCloudExpressComputeClient computeClient,
Map<Status, NodeState> vAppStatusToNodeState, GetExtraFromVCloudExpressVApp getExtra,
FindLocationForResource findLocationForResourceInVDC, Supplier<Set<? extends Image>> images) {
this.client = checkNotNull(client, "client");
this.images = checkNotNull(images, "images");
this.getExtra = checkNotNull(getExtra, "getExtra");
this.findLocationForResourceInVDC = checkNotNull(findLocationForResourceInVDC, "findLocationForResourceInVDC");
this.computeClient = checkNotNull(computeClient, "computeClient");
this.vAppStatusToNodeState = checkNotNull(vAppStatusToNodeState, "vAppStatusToNodeState");
}
public NodeMetadata execute(String in) {
URI id = URI.create(in);
VCloudExpressVApp from = client.getVApp(id);
if (from == null)
return null;
String tag = parseTagFromName(from.getName());
Location location = findLocationForResourceInVDC.apply(from.getVDC());
return new NodeMetadataImpl(in, from.getName(), in, location, from.getId(), ImmutableMap.<String, String> of(),
tag, null, from.getOsType() != null ? new CIMOperatingSystem(CIMOperatingSystem.OSType.fromValue(from
.getOsType()), null, null, from.getOperatingSystemDescription()) : null, vAppStatusToNodeState
.get(from.getStatus()), computeClient.getPublicAddresses(id), computeClient
.getPrivateAddresses(id), getExtra.apply(from), null);
}
}

View File

@ -0,0 +1,140 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.vcloud.compute.strategy;
import static org.jclouds.compute.reference.ComputeServiceConstants.COMPUTE_LOGGER;
import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_BLACKLIST_NODES;
import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
import javax.inject.Named;
import javax.inject.Singleton;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.compute.domain.ComputeType;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.internal.ComputeMetadataImpl;
import org.jclouds.compute.strategy.ListNodesStrategy;
import org.jclouds.domain.Location;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.CommonVCloudClient;
import org.jclouds.vcloud.VCloudMediaType;
import org.jclouds.vcloud.compute.functions.FindLocationForResource;
import org.jclouds.vcloud.domain.NamedResource;
import org.jclouds.vcloud.endpoints.Org;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Predicate;
import com.google.common.base.Splitter;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
import com.google.inject.internal.util.ImmutableSet;
/**
* @author Adrian Cole
*/
// TODO REFACTOR!!! needs to be parallel
@Singleton
public class VCloudExpressListNodesStrategy implements ListNodesStrategy {
@Resource
@Named(COMPUTE_LOGGER)
public Logger logger = Logger.NULL;
protected final VCloudExpressGetNodeMetadataStrategy getNodeMetadata;
protected final CommonVCloudClient client;
protected final FindLocationForResource findLocationForResourceInVDC;
Set<String> blackListVAppNames = ImmutableSet.<String> of();
@Inject(optional = true)
void setBlackList(@Named(PROPERTY_BLACKLIST_NODES) String blackListNodes) {
if (blackListNodes != null && !"".equals(blackListNodes))
this.blackListVAppNames = ImmutableSet.copyOf(Splitter.on(',').split(blackListNodes));
}
private final Supplier<Map<String, NamedResource>> orgNameToEndpoint;
@Inject
protected VCloudExpressListNodesStrategy(CommonVCloudClient client,
@Org Supplier<Map<String, NamedResource>> orgNameToEndpoint, VCloudExpressGetNodeMetadataStrategy getNodeMetadata,
FindLocationForResource findLocationForResourceInVDC) {
this.client = client;
this.orgNameToEndpoint = orgNameToEndpoint;
this.getNodeMetadata = getNodeMetadata;
this.findLocationForResourceInVDC = findLocationForResourceInVDC;
}
@Override
public Iterable<ComputeMetadata> list() {
Set<ComputeMetadata> nodes = Sets.newHashSet();
for (String org : orgNameToEndpoint.get().keySet()) {
for (NamedResource vdc : client.findOrgNamed(org).getVDCs().values()) {
for (NamedResource resource : client.getVDC(vdc.getId()).getResourceEntities().values()) {
if (validVApp(resource)) {
nodes.add(convertVAppToComputeMetadata(vdc, resource));
}
}
}
}
return nodes;
}
private boolean validVApp(NamedResource resource) {
return resource.getType().equals(VCloudMediaType.VAPP_XML) && !blackListVAppNames.contains(resource.getName());
}
private ComputeMetadata convertVAppToComputeMetadata(NamedResource vdc, NamedResource resource) {
Location location = findLocationForResourceInVDC.apply(vdc);
return new ComputeMetadataImpl(ComputeType.NODE, resource.getId().toASCIIString(), resource.getName(), resource
.getId().toASCIIString(), location, null, ImmutableMap.<String, String> of());
}
@Override
public Iterable<NodeMetadata> listDetailsOnNodesMatching(Predicate<ComputeMetadata> filter) {
Set<NodeMetadata> nodes = Sets.newHashSet();
for (String org : orgNameToEndpoint.get().keySet()) {
for (NamedResource vdc : client.findOrgNamed(org).getVDCs().values()) {
for (NamedResource resource : client.getVDC(vdc.getId()).getResourceEntities().values()) {
if (validVApp(resource) && filter.apply(convertVAppToComputeMetadata(vdc, resource))) {
addVAppToSetRetryingIfNotYetPresent(nodes, vdc, resource);
}
}
}
}
return nodes;
}
@VisibleForTesting
void addVAppToSetRetryingIfNotYetPresent(Set<NodeMetadata> nodes, NamedResource vdc, NamedResource resource) {
NodeMetadata node = null;
int i = 0;
while (node == null && i++ < 3) {
try {
node = getNodeMetadata.execute(resource.getId().toASCIIString());
nodes.add(node);
} catch (NullPointerException e) {
logger.warn("vApp %s not yet present in vdc %s", resource.getName(), vdc.getName());
}
}
}
}

View File

@ -34,18 +34,19 @@ import javax.inject.Singleton;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.domain.internal.NodeMetadataImpl;
import org.jclouds.compute.domain.os.CIMOperatingSystem;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.domain.Location;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.CommonVCloudClient;
import org.jclouds.vcloud.compute.CommonVCloudComputeClient;
import org.jclouds.vcloud.VCloudClient;
import org.jclouds.vcloud.compute.VCloudComputeClient;
import org.jclouds.vcloud.compute.functions.FindLocationForResource;
import org.jclouds.vcloud.compute.functions.GetExtra;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.compute.functions.GetExtraFromVApp;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VApp;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableMap;
@ -58,16 +59,16 @@ public class VCloudGetNodeMetadataStrategy implements GetNodeMetadataStrategy {
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
public Logger logger = Logger.NULL;
protected final CommonVCloudClient client;
protected final CommonVCloudComputeClient computeClient;
protected final VCloudClient client;
protected final VCloudComputeClient computeClient;
protected final Supplier<Set<? extends Image>> images;
protected final FindLocationForResource findLocationForResourceInVDC;
protected final GetExtra getExtra;
protected final GetExtraFromVApp getExtra;
protected final Map<Status, NodeState> vAppStatusToNodeState;
@Inject
protected VCloudGetNodeMetadataStrategy(CommonVCloudClient client, CommonVCloudComputeClient computeClient,
Map<Status, NodeState> vAppStatusToNodeState, GetExtra getExtra,
protected VCloudGetNodeMetadataStrategy(VCloudClient client, VCloudComputeClient computeClient,
Map<Status, NodeState> vAppStatusToNodeState, GetExtraFromVApp getExtra,
FindLocationForResource findLocationForResourceInVDC, Supplier<Set<? extends Image>> images) {
this.client = checkNotNull(client, "client");
this.images = checkNotNull(images, "images");
@ -85,10 +86,17 @@ public class VCloudGetNodeMetadataStrategy implements GetNodeMetadataStrategy {
String tag = parseTagFromName(from.getName());
Location location = findLocationForResourceInVDC.apply(from.getVDC());
return new NodeMetadataImpl(in, from.getName(), in, location, from.getId(), ImmutableMap.<String, String> of(),
tag, null, from.getOsType() != null ? new CIMOperatingSystem(CIMOperatingSystem.OSType.fromValue(from
.getOsType()), null, null, from.getOperatingSystemDescription()) : null, vAppStatusToNodeState
.get(from.getStatus()), computeClient.getPublicAddresses(id), computeClient
tag, null, getOperatingSystemForVAppOrDefaultTo(from, null),
vAppStatusToNodeState.get(from.getStatus()), computeClient.getPublicAddresses(id), computeClient
.getPrivateAddresses(id), getExtra.apply(from), null);
}
private OperatingSystem getOperatingSystemForVAppOrDefaultTo(VApp vApp, OperatingSystem operatingSystem) {
// TODO
return new CIMOperatingSystem(CIMOperatingSystem.OSType.UBUNTU_64, null, null, vApp.getDescription());
// return vApp.getOsType() != null ? new
// CIMOperatingSystem(CIMOperatingSystem.OSType.fromValue(vApp.getOsType()),
// null, null, vApp.getOperatingSystemDescription()) : operatingSystem;
}
}

View File

@ -19,49 +19,47 @@
package org.jclouds.vcloud.domain;
import java.util.Set;
import java.util.List;
import javax.annotation.Nullable;
import org.jclouds.vcloud.domain.internal.VAppImpl;
import com.google.common.collect.ListMultimap;
import com.google.inject.ImplementedBy;
/**
* A virtual application (vApp) is a software solution, packaged in OVF containing one or more
* virtual machines. A vApp can be authored by Developers at ISVs and VARs or by IT Administrators
* in Enterprises and Service Providers.
*
* A VApp is the result of instantiation of a {@link VAppTemplate}.
* <h2>note</h2>
* <p/> When the {@link #getStatus} is {@link Status#UNRESOLVED}, there will be a task present for the instantiation of the VApp.
* @author Adrian Cole
*/
@ImplementedBy(VAppImpl.class)
public interface VApp extends NamedResource {
/**
* Reference to the vdc containing this vApp.
*
* @since vcloud api 1.0
* @return vdc, or null if this is a version before 1.0 where the org isn't present
*/
NamedResource getVDC();
/**
* The creation status of the vDC
*
* @since vcloud api 1.0
*/
Status getStatus();
Long getSize();
ListMultimap<String, String> getNetworkToAddresses();
/**
* optional description
*
* @return CIM OSType of the image or null, if this information isn't available yet
* @see <a href="http://dmtf.org/standards/cim/cim_schema_v2260">DMTF CIM model</a>
* @since vcloud api 0.8
*/
@Nullable
Integer getOsType();
String getDescription();
/**
* readonly container for Task elements. Each element in the container represents a queued,
* running, or failed task owned by this object.
*
* @return description or null, if this information isn't available yet
* @since vcloud api 1.0
*/
@Nullable
String getOperatingSystemDescription();
VirtualSystem getSystem();
Set<ResourceAllocation> getResourceAllocations();
List<Task> getTasks();
}

View File

@ -0,0 +1,67 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.vcloud.domain;
import java.util.Set;
import javax.annotation.Nullable;
import org.jclouds.vcloud.domain.internal.VCloudExpressVAppImpl;
import com.google.common.collect.ListMultimap;
import com.google.inject.ImplementedBy;
/**
* A virtual application (vApp) is a software solution, packaged in OVF containing one or more
* virtual machines. A vApp can be authored by Developers at ISVs and VARs or by IT Administrators
* in Enterprises and Service Providers.
*
* @author Adrian Cole
*/
@ImplementedBy(VCloudExpressVAppImpl.class)
public interface VCloudExpressVApp extends NamedResource {
NamedResource getVDC();
Status getStatus();
Long getSize();
ListMultimap<String, String> getNetworkToAddresses();
/**
*
* @return CIM OSType of the image or null, if this information isn't available yet
* @see <a href="http://dmtf.org/standards/cim/cim_schema_v2260">DMTF CIM model</a>
*/
@Nullable
Integer getOsType();
/**
*
* @return description or null, if this information isn't available yet
*/
@Nullable
String getOperatingSystemDescription();
VirtualSystem getSystem();
Set<ResourceAllocation> getResourceAllocations();
}

View File

@ -22,50 +22,38 @@ package org.jclouds.vcloud.domain.internal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Set;
import java.util.List;
import javax.annotation.Nullable;
import org.jclouds.vcloud.VCloudExpressMediaType;
import org.jclouds.vcloud.domain.NamedResource;
import org.jclouds.vcloud.domain.ResourceAllocation;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VirtualSystem;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
/**
*
* @author Adrian Cole
*
*/
public class VAppImpl implements VApp {
private final String name;
private final URI id;
private final NamedResource vDC;
public class VAppImpl extends NamedResourceImpl implements VApp {
private final Status status;
private final Long size;
private final ListMultimap<String, String> networkToAddresses;
private final String operatingSystemDescription;
private final VirtualSystem system;
private final Set<ResourceAllocation> resourceAllocations;
private final Integer osType;
@Nullable
private final NamedResource vdc;
@Nullable
private final String description;
private final List<Task> tasks = Lists.newArrayList();
/** The serialVersionUID */
private static final long serialVersionUID = 8464716396538298809L;
public VAppImpl(String name, URI id, Status status, Long size, NamedResource vDC,
ListMultimap<String, String> networkToAddresses, Integer osType, String operatingSystemDescription,
VirtualSystem system, Set<ResourceAllocation> resourceAllocations) {
this.name = checkNotNull(name, "name");
this.id = checkNotNull(id, "id");
public VAppImpl(String name, String type, URI id, Status status, @Nullable NamedResource vdc,
@Nullable String description, Iterable<Task> tasks) {
super(name, type, id);
this.status = checkNotNull(status, "status");
this.size = size;
this.vDC = vDC;
this.networkToAddresses = checkNotNull(networkToAddresses, "networkToAddresses");
this.osType = osType;
this.operatingSystemDescription = operatingSystemDescription;
this.system = system;
this.resourceAllocations = checkNotNull(resourceAllocations, "resourceAllocations");
this.vdc = vdc;
this.description = description;
Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
}
@Override
@ -73,50 +61,29 @@ public class VAppImpl implements VApp {
return status;
}
@Override
public ListMultimap<String, String> getNetworkToAddresses() {
return networkToAddresses;
}
@Override
public Integer getOsType() {
return osType;
}
@Override
public String getOperatingSystemDescription() {
return operatingSystemDescription;
}
@Override
public VirtualSystem getSystem() {
return system;
}
@Override
public Set<ResourceAllocation> getResourceAllocations() {
return resourceAllocations;
}
@Override
public NamedResource getVDC() {
return vDC;
return vdc;
}
@Override
public String getDescription() {
return description;
}
@Override
public List<Task> getTasks() {
return tasks;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((networkToAddresses == null) ? 0 : networkToAddresses.hashCode());
result = prime * result + ((operatingSystemDescription == null) ? 0 : operatingSystemDescription.hashCode());
result = prime * result + ((resourceAllocations == null) ? 0 : resourceAllocations.hashCode());
result = prime * result + ((size == null) ? 0 : size.hashCode());
result = prime * result + ((osType == null) ? 0 : osType.hashCode());
int result = super.hashCode();
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((status == null) ? 0 : status.hashCode());
result = prime * result + ((system == null) ? 0 : system.hashCode());
result = prime * result + ((vDC == null) ? 0 : vDC.hashCode());
result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
result = prime * result + ((vdc == null) ? 0 : vdc.hashCode());
return result;
}
@ -124,95 +91,43 @@ public class VAppImpl implements VApp {
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
VAppImpl other = (VAppImpl) obj;
if (id == null) {
if (other.id != null)
if (description == null) {
if (other.description != null)
return false;
} else if (!id.equals(other.id))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (osType == null) {
if (other.osType != null)
return false;
} else if (!osType.equals(other.osType))
return false;
if (networkToAddresses == null) {
if (other.networkToAddresses != null)
return false;
} else if (!networkToAddresses.equals(other.networkToAddresses))
return false;
if (operatingSystemDescription == null) {
if (other.operatingSystemDescription != null)
return false;
} else if (!operatingSystemDescription.equals(other.operatingSystemDescription))
return false;
if (resourceAllocations == null) {
if (other.resourceAllocations != null)
return false;
} else if (!resourceAllocations.equals(other.resourceAllocations))
return false;
if (size == null) {
if (other.size != null)
return false;
} else if (!size.equals(other.size))
} else if (!description.equals(other.description))
return false;
if (status == null) {
if (other.status != null)
return false;
} else if (!status.equals(other.status))
return false;
if (system == null) {
if (other.system != null)
if (tasks == null) {
if (other.tasks != null)
return false;
} else if (!system.equals(other.system))
} else if (!tasks.equals(other.tasks))
return false;
if (vDC == null) {
if (other.vDC != null)
if (vdc == null) {
if (other.vdc != null)
return false;
} else if (!vDC.equals(other.vDC))
} else if (!vdc.equals(other.vdc))
return false;
return true;
}
@Override
public String getName() {
return name;
}
@Override
public URI getId() {
return id;
}
@Override
public Long getSize() {
return size;
}
@Override
public String toString() {
return "[id=" + id + ", name=" + name + ", networkToAddresses=" + networkToAddresses + ", osType=" + osType
+ ", operatingSystemDescription=" + operatingSystemDescription + ", resourceAllocationByType="
+ resourceAllocations + ", size=" + size + ", status=" + status + ", system=" + system + ", vDC=" + vDC
+ "]";
}
@Override
public String getType() {
return VCloudExpressMediaType.VAPP_XML;
}
@Override
public int compareTo(NamedResource o) {
return (this == o) ? 0 : getId().compareTo(o.getId());
}
@Override
public String toString() {
return "[id=" + getId() + ", name=" + getName() + ", type=" + getType() + ", status=" + getStatus() + ", vdc="
+ getVDC() + ", description=" + getDescription() + "]";
}
}

View File

@ -0,0 +1,218 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.vcloud.domain.internal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Set;
import org.jclouds.vcloud.VCloudExpressMediaType;
import org.jclouds.vcloud.domain.NamedResource;
import org.jclouds.vcloud.domain.ResourceAllocation;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VirtualSystem;
import com.google.common.collect.ListMultimap;
/**
*
* @author Adrian Cole
*
*/
public class VCloudExpressVAppImpl implements VCloudExpressVApp {
private final String name;
private final URI id;
private final NamedResource vDC;
private final Status status;
private final Long size;
private final ListMultimap<String, String> networkToAddresses;
private final String operatingSystemDescription;
private final VirtualSystem system;
private final Set<ResourceAllocation> resourceAllocations;
private final Integer osType;
/** The serialVersionUID */
private static final long serialVersionUID = 8464716396538298809L;
public VCloudExpressVAppImpl(String name, URI id, Status status, Long size, NamedResource vDC,
ListMultimap<String, String> networkToAddresses, Integer osType, String operatingSystemDescription,
VirtualSystem system, Set<ResourceAllocation> resourceAllocations) {
this.name = checkNotNull(name, "name");
this.id = checkNotNull(id, "id");
this.status = checkNotNull(status, "status");
this.size = size;
this.vDC = vDC;
this.networkToAddresses = checkNotNull(networkToAddresses, "networkToAddresses");
this.osType = osType;
this.operatingSystemDescription = operatingSystemDescription;
this.system = system;
this.resourceAllocations = checkNotNull(resourceAllocations, "resourceAllocations");
}
@Override
public Status getStatus() {
return status;
}
@Override
public ListMultimap<String, String> getNetworkToAddresses() {
return networkToAddresses;
}
@Override
public Integer getOsType() {
return osType;
}
@Override
public String getOperatingSystemDescription() {
return operatingSystemDescription;
}
@Override
public VirtualSystem getSystem() {
return system;
}
@Override
public Set<ResourceAllocation> getResourceAllocations() {
return resourceAllocations;
}
@Override
public NamedResource getVDC() {
return vDC;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((networkToAddresses == null) ? 0 : networkToAddresses.hashCode());
result = prime * result + ((operatingSystemDescription == null) ? 0 : operatingSystemDescription.hashCode());
result = prime * result + ((resourceAllocations == null) ? 0 : resourceAllocations.hashCode());
result = prime * result + ((size == null) ? 0 : size.hashCode());
result = prime * result + ((osType == null) ? 0 : osType.hashCode());
result = prime * result + ((status == null) ? 0 : status.hashCode());
result = prime * result + ((system == null) ? 0 : system.hashCode());
result = prime * result + ((vDC == null) ? 0 : vDC.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VCloudExpressVAppImpl other = (VCloudExpressVAppImpl) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (osType == null) {
if (other.osType != null)
return false;
} else if (!osType.equals(other.osType))
return false;
if (networkToAddresses == null) {
if (other.networkToAddresses != null)
return false;
} else if (!networkToAddresses.equals(other.networkToAddresses))
return false;
if (operatingSystemDescription == null) {
if (other.operatingSystemDescription != null)
return false;
} else if (!operatingSystemDescription.equals(other.operatingSystemDescription))
return false;
if (resourceAllocations == null) {
if (other.resourceAllocations != null)
return false;
} else if (!resourceAllocations.equals(other.resourceAllocations))
return false;
if (size == null) {
if (other.size != null)
return false;
} else if (!size.equals(other.size))
return false;
if (status == null) {
if (other.status != null)
return false;
} else if (!status.equals(other.status))
return false;
if (system == null) {
if (other.system != null)
return false;
} else if (!system.equals(other.system))
return false;
if (vDC == null) {
if (other.vDC != null)
return false;
} else if (!vDC.equals(other.vDC))
return false;
return true;
}
@Override
public String getName() {
return name;
}
@Override
public URI getId() {
return id;
}
@Override
public Long getSize() {
return size;
}
@Override
public String toString() {
return "[id=" + id + ", name=" + name + ", networkToAddresses=" + networkToAddresses + ", osType=" + osType
+ ", operatingSystemDescription=" + operatingSystemDescription + ", resourceAllocationByType="
+ resourceAllocations + ", size=" + size + ", status=" + status + ", system=" + system + ", vDC=" + vDC
+ "]";
}
@Override
public String getType() {
return VCloudExpressMediaType.VAPP_XML;
}
@Override
public int compareTo(NamedResource o) {
return (this == o) ? 0 : getId().compareTo(o.getId());
}
}

View File

@ -7,7 +7,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.vdc/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -21,124 +21,79 @@ package org.jclouds.vcloud.xml;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import java.net.URI;
import java.util.Set;
import java.util.List;
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.VCloudExpressMediaType;
import org.jclouds.vcloud.domain.NamedResource;
import org.jclouds.vcloud.domain.ResourceAllocation;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VirtualSystem;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.internal.VAppImpl;
import org.jclouds.vcloud.util.Utils;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Sets;
import com.google.common.collect.Lists;
/**
* @author Adrian Cole
*/
public class VAppHandler extends ParseSax.HandlerWithResult<VApp> {
private final String apiVersion;
private final VirtualSystemHandler systemHandler;
private final ResourceAllocationHandler allocationHandler;
@Resource
protected Logger logger = Logger.NULL;
protected final String apiVersion;
protected final TaskHandler taskHandler;
@Inject
public VAppHandler(@Named(PROPERTY_API_VERSION) String apiVersion, VirtualSystemHandler systemHandler,
ResourceAllocationHandler allocationHandler) {
public VAppHandler(@Named(PROPERTY_API_VERSION) String apiVersion, TaskHandler taskHandler) {
this.apiVersion = apiVersion;
this.systemHandler = systemHandler;
this.allocationHandler = allocationHandler;
this.taskHandler = taskHandler;
}
protected VirtualSystem system;
protected Set<ResourceAllocation> allocations = Sets.newLinkedHashSet();
private StringBuilder currentText = new StringBuilder();
protected NamedResource vApp;
protected List<Task> tasks = Lists.newArrayList();
protected String description;
protected NamedResource vdc;
protected Status status;
protected final ListMultimap<String, String> networkToAddresses = ArrayListMultimap.create();
protected StringBuilder currentText = new StringBuilder();
protected String operatingSystemDescription;
protected boolean inOs;
protected String networkName;
protected String name;
protected Integer osType;
protected URI location;
protected Long size;
protected NamedResource vDC;
public VApp getResult() {
return new VAppImpl(name, location, status, size, vDC, networkToAddresses, osType, operatingSystemDescription,
system, allocations);
}
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (qName.equals("VApp")) {
NamedResource resource = Utils.newNamedResource(attributes);
name = resource.getName();
location = resource.getId();
String statusString = attributes.getValue(attributes.getIndex("status"));
if (apiVersion.indexOf("0.8") != -1 && "2".equals(statusString))
status = Status.OFF;
else
status = Status.fromValue(statusString);
if (attributes.getIndex("size") != -1)
size = new Long(attributes.getValue(attributes.getIndex("size")));
} else if (qName.equals("Link")) { // type should never be missing
if (attributes.getIndex("type") != -1
&& attributes.getValue(attributes.getIndex("type")).equals(VCloudExpressMediaType.VDC_XML)) {
vDC = Utils.newNamedResource(attributes);
}
} else if (qName.equals("OperatingSystemSection")) {
inOs = true;
for (int i = 0; i < attributes.getLength(); i++)
if (attributes.getQName(i).indexOf("id") != -1)
osType = Integer.parseInt(attributes.getValue(i));
} else if (qName.endsWith("NetworkConnection")) {
networkName = attributes.getValue(attributes.getIndex("Network"));
} else {
systemHandler.startElement(uri, localName, qName, attributes);
allocationHandler.startElement(uri, localName, qName, attributes);
}
return new VAppImpl(vApp.getName(), vApp.getType(), vApp.getId(), status, vdc, description, tasks);
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("OperatingSystemSection")) {
inOs = false;
} else if (inOs && qName.equals("Description")) {
operatingSystemDescription = currentText.toString().trim();
} else if (qName.endsWith("IpAddress")) {
networkToAddresses.put(networkName, currentText.toString().trim());
} else if (qName.equals("System")) {
systemHandler.endElement(uri, localName, qName);
system = systemHandler.getResult();
} else if (qName.equals("Item")) {
allocationHandler.endElement(uri, localName, qName);
allocations.add(allocationHandler.getResult());
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (qName.equals("VApp")) {
vApp = Utils.newNamedResource(attributes);
String statusString = attributes.getValue(attributes.getIndex("status"));
status = Status.fromValue(statusString);
// } else if (qName.equals("VAppItem")) {
// Utils.putNamedResource(contents, attributes);
} else if (qName.equals("Link") && "up".equals(Utils.attrOrNull(attributes, "rel"))) {
vdc = Utils.newNamedResource(attributes);
} else {
systemHandler.endElement(uri, localName, qName);
allocationHandler.endElement(uri, localName, qName);
taskHandler.startElement(uri, localName, qName, attributes);
}
}
public void endElement(String uri, String name, String qName) {
taskHandler.endElement(uri, name, qName);
if (qName.equals("Task")) {
this.tasks.add(taskHandler.getResult());
} else if (qName.equals("Description")) {
description = currentOrNull();
}
currentText = new StringBuilder();
}
@Override
public void characters(char ch[], int start, int length) {
currentText.append(ch, start, length);
systemHandler.characters(ch, start, length);
allocationHandler.characters(ch, start, length);
}
protected String currentOrNull() {
String returnVal = currentText.toString().trim();
return returnVal.equals("") ? null : returnVal;
}
}

View File

@ -0,0 +1,144 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.vcloud.xml;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import java.net.URI;
import java.util.Set;
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.VCloudExpressMediaType;
import org.jclouds.vcloud.domain.NamedResource;
import org.jclouds.vcloud.domain.ResourceAllocation;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VirtualSystem;
import org.jclouds.vcloud.domain.internal.VCloudExpressVAppImpl;
import org.jclouds.vcloud.util.Utils;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Sets;
/**
* @author Adrian Cole
*/
public class VCloudExpressVAppHandler extends ParseSax.HandlerWithResult<VCloudExpressVApp> {
private final String apiVersion;
private final VirtualSystemHandler systemHandler;
private final ResourceAllocationHandler allocationHandler;
@Resource
protected Logger logger = Logger.NULL;
@Inject
public VCloudExpressVAppHandler(@Named(PROPERTY_API_VERSION) String apiVersion, VirtualSystemHandler systemHandler,
ResourceAllocationHandler allocationHandler) {
this.apiVersion = apiVersion;
this.systemHandler = systemHandler;
this.allocationHandler = allocationHandler;
}
protected VirtualSystem system;
protected Set<ResourceAllocation> allocations = Sets.newLinkedHashSet();
protected Status status;
protected final ListMultimap<String, String> networkToAddresses = ArrayListMultimap.create();
protected StringBuilder currentText = new StringBuilder();
protected String operatingSystemDescription;
protected boolean inOs;
protected String networkName;
protected String name;
protected Integer osType;
protected URI location;
protected Long size;
protected NamedResource vDC;
public VCloudExpressVApp getResult() {
return new VCloudExpressVAppImpl(name, location, status, size, vDC, networkToAddresses, osType, operatingSystemDescription,
system, allocations);
}
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (qName.equals("VApp")) {
NamedResource resource = Utils.newNamedResource(attributes);
name = resource.getName();
location = resource.getId();
String statusString = attributes.getValue(attributes.getIndex("status"));
if (apiVersion.indexOf("0.8") != -1 && "2".equals(statusString))
status = Status.OFF;
else
status = Status.fromValue(statusString);
if (attributes.getIndex("size") != -1)
size = new Long(attributes.getValue(attributes.getIndex("size")));
} else if (qName.equals("Link")) { // type should never be missing
if (attributes.getIndex("type") != -1
&& attributes.getValue(attributes.getIndex("type")).equals(VCloudExpressMediaType.VDC_XML)) {
vDC = Utils.newNamedResource(attributes);
}
} else if (qName.equals("OperatingSystemSection")) {
inOs = true;
for (int i = 0; i < attributes.getLength(); i++)
if (attributes.getQName(i).indexOf("id") != -1)
osType = Integer.parseInt(attributes.getValue(i));
} else if (qName.endsWith("NetworkConnection")) {
networkName = attributes.getValue(attributes.getIndex("Network"));
} else {
systemHandler.startElement(uri, localName, qName, attributes);
allocationHandler.startElement(uri, localName, qName, attributes);
}
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("OperatingSystemSection")) {
inOs = false;
} else if (inOs && qName.equals("Description")) {
operatingSystemDescription = currentText.toString().trim();
} else if (qName.endsWith("IpAddress")) {
networkToAddresses.put(networkName, currentText.toString().trim());
} else if (qName.equals("System")) {
systemHandler.endElement(uri, localName, qName);
system = systemHandler.getResult();
} else if (qName.equals("Item")) {
allocationHandler.endElement(uri, localName, qName);
allocations.add(allocationHandler.getResult());
} else {
systemHandler.endElement(uri, localName, qName);
allocationHandler.endElement(uri, localName, qName);
}
currentText = new StringBuilder();
}
@Override
public void characters(char ch[], int start, int length) {
currentText.append(ch, start, length);
systemHandler.characters(ch, start, length);
allocationHandler.characters(ch, start, length);
}
}

View File

@ -33,7 +33,6 @@ import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.domain.NamedResource;
import org.jclouds.vcloud.domain.Org;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VDC;
import org.jclouds.vcloud.domain.network.OrgNetwork;
import org.testng.annotations.BeforeGroups;
@ -135,14 +134,13 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
for (NamedResource resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
CatalogItem item = connection.findCatalogItemInOrgCatalogNamed(org.getName(), response.getName(),
resource.getName());
resource.getName());
verifyCatalogItem(item);
}
}
}
}
@Test
public void testDefaultVDC() throws Exception {
Org org = connection.findOrgNamed(null);
@ -178,20 +176,6 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
}
}
@Test
public void testGetVApp() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getId());
for (NamedResource item : response.getResourceEntities().values()) {
if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
VApp app = connection.getVApp(item.getId());
assertNotNull(app);
}
}
}
}
protected abstract void setupCredentials();
@BeforeGroups(groups = { "live" })
@ -201,7 +185,7 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
props.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
props.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
context = new ComputeServiceContextFactory().createContext(provider, identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule()), props).getProviderSpecificContext();
ImmutableSet.<Module> of(new Log4JLoggingModule()), props).getProviderSpecificContext();
connection = context.getApi();
}

View File

@ -27,6 +27,8 @@ import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.domain.NamedResource;
import org.jclouds.vcloud.domain.Org;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VDC;
import org.testng.annotations.Test;
/**
@ -63,6 +65,24 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClien
}
}
@Test
public void testGetVApp() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getId());
for (NamedResource item : response.getResourceEntities().values()) {
if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
try {
VApp app = connection.getVApp(item.getId());
assertNotNull(app);
} catch (RuntimeException e) {
}
}
}
}
}
@Test
public void testFindVAppTemplate() throws Exception {
Org org = connection.findOrgNamed(null);
@ -74,7 +94,7 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClien
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
try {
assertNotNull(connection.findVAppTemplateInOrgCatalogNamed(org.getName(), response.getName(), item
.getEntity().getName()));
.getEntity().getName()));
} catch (AuthorizationException e) {
}

View File

@ -68,7 +68,7 @@ import org.jclouds.vcloud.xml.OrgHandler;
import org.jclouds.vcloud.xml.OrgNetworkFromVCloudExpressNetworkHandler;
import org.jclouds.vcloud.xml.TaskHandler;
import org.jclouds.vcloud.xml.TasksListHandler;
import org.jclouds.vcloud.xml.VAppHandler;
import org.jclouds.vcloud.xml.VCloudExpressVAppHandler;
import org.jclouds.vcloud.xml.VCloudExpressVAppTemplateHandler;
import org.jclouds.vcloud.xml.VDCHandler;
import org.testng.annotations.Test;
@ -106,7 +106,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, VAppHandler.class);
assertSaxResponseParserClassEquals(method, VCloudExpressVAppHandler.class);
assertExceptionParserClassEquals(method, null);
checkFilters(request);
@ -130,7 +130,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, VAppHandler.class);
assertSaxResponseParserClassEquals(method, VCloudExpressVAppHandler.class);
assertExceptionParserClassEquals(method, null);
checkFilters(request);
@ -457,7 +457,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, VAppHandler.class);
assertSaxResponseParserClassEquals(method, VCloudExpressVAppHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
checkFilters(request);

View File

@ -26,6 +26,8 @@ import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.domain.NamedResource;
import org.jclouds.vcloud.domain.Org;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VDC;
import org.testng.annotations.Test;
/**
@ -58,6 +60,24 @@ public class VCloudExpressClientLiveTest extends
}
}
@Test
public void testGetVApp() throws Exception {
Org org = connection.findOrgNamed(null);
for (NamedResource vdc : org.getVDCs().values()) {
VDC response = connection.getVDC(vdc.getId());
for (NamedResource item : response.getResourceEntities().values()) {
if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
try {
VCloudExpressVApp app = connection.getVApp(item.getId());
assertNotNull(app);
} catch (RuntimeException e) {
}
}
}
}
}
@Test
public void testFindVAppTemplate() throws Exception {
Org org = connection.findOrgNamed(null);

View File

@ -20,10 +20,8 @@
package org.jclouds.vcloud.compute;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.filter;
import static org.jclouds.Constants.PROPERTY_TRUST_ALL_CERTS;
import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.processorCount;
import static org.jclouds.vcloud.predicates.VCloudPredicates.resourceType;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
@ -38,7 +36,6 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.net.IPSocket;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.vcloud.VCloudClient;
import org.jclouds.vcloud.domain.ResourceType;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VAppTemplate;
@ -98,7 +95,7 @@ public class VCloudComputeClientLiveTest {
VAppTemplate template = client.findVAppTemplateInOrgCatalogNamed(null, null, templateName);
InstantiateVAppTemplateOptions options = processorCount(1).memory(512).disk(10 * 1025 * 1024).productProperties(
ImmutableMap.of("foo", "bar"));
ImmutableMap.of("foo", "bar"));
id = URI.create(computeClient.start(null, template.getId(), templateName, options).get("id"));
Expectation expectation = expectationMap.get(toTest);
@ -110,7 +107,7 @@ public class VCloudComputeClientLiveTest {
private String getCompatibleServerName(OsFamily toTest) {
String serverName = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, toTest.toString()).substring(0,
toTest.toString().length() <= 15 ? toTest.toString().length() : 14);
toTest.toString().length() <= 15 ? toTest.toString().length() : 14);
return serverName;
}
@ -121,19 +118,24 @@ public class VCloudComputeClientLiveTest {
}
private void verifyConfigurationOfVApp(VApp vApp, String serverName, String expectedOs, int processorCount,
int memory, long hardDisk) {
// assertEquals(vApp.getName(), serverName);
int memory, long hardDisk) {
assertEquals(vApp.getName(), serverName);
// assertEquals(vApp.getOperatingSystemDescription(), expectedOs);
assertEquals(Iterables
.getOnlyElement(filter(vApp.getResourceAllocations(), resourceType(ResourceType.PROCESSOR)))
.getVirtualQuantity(), processorCount);
assertEquals(Iterables.getOnlyElement(
filter(vApp.getResourceAllocations(), resourceType(ResourceType.SCSI_CONTROLLER))).getVirtualQuantity(), 1);
assertEquals(Iterables.getOnlyElement(filter(vApp.getResourceAllocations(), resourceType(ResourceType.MEMORY)))
.getVirtualQuantity(), memory);
assertEquals(Iterables.getOnlyElement(
filter(vApp.getResourceAllocations(), resourceType(ResourceType.DISK_DRIVE))).getVirtualQuantity(),
hardDisk);
// assertEquals(Iterables
// .getOnlyElement(filter(vApp.getResourceAllocations(),
// resourceType(ResourceType.PROCESSOR)))
// .getVirtualQuantity(), processorCount);
// assertEquals(Iterables.getOnlyElement(
// filter(vApp.getResourceAllocations(),
// resourceType(ResourceType.SCSI_CONTROLLER))).getVirtualQuantity(),
// 1);
// assertEquals(Iterables.getOnlyElement(filter(vApp.getResourceAllocations(),
// resourceType(ResourceType.MEMORY)))
// .getVirtualQuantity(), memory);
// assertEquals(Iterables.getOnlyElement(
// filter(vApp.getResourceAllocations(),
// resourceType(ResourceType.DISK_DRIVE))).getVirtualQuantity(),
// hardDisk);
}
@AfterTest
@ -153,14 +155,14 @@ public class VCloudComputeClientLiveTest {
Properties properties = new Properties();
properties.setProperty(PROPERTY_TRUST_ALL_CERTS, "true");
Injector injector = new RestContextFactory().createContextBuilder("vcloud", identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule()), properties).buildInjector();
ImmutableSet.<Module> of(new Log4JLoggingModule()), properties).buildInjector();
computeClient = injector.getInstance(VCloudComputeClient.class);
client = injector.getInstance(VCloudClient.class);
addressTester = injector.getInstance(Key.get(new TypeLiteral<Predicate<IPSocket>>() {
}));
expectationMap = ImmutableMap.<OsFamily, Expectation> builder().put(OsFamily.CENTOS,
new Expectation(4194304 / 2 * 10, "Red Hat Enterprise Linux 5 (64-bit)")).build();
new Expectation(4194304 / 2 * 10, "Red Hat Enterprise Linux 5 (64-bit)")).build();
provider = "vcloudtest";
templateName = "Ubuntu JeOS 9.10 (32-bit)";
}

View File

@ -36,7 +36,7 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.vcloud.VCloudExpressClient;
import org.jclouds.vcloud.domain.ResourceType;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
@ -100,7 +100,7 @@ public class VCloudExpressComputeClientLiveTest {
id = URI.create(computeClient.start(null, template.getId(), templateName, options).get("id"));
Expectation expectation = expectationMap.get(toTest);
VApp vApp = client.getVApp(id);
VCloudExpressVApp vApp = client.getVApp(id);
verifyConfigurationOfVApp(vApp, serverName, expectation.os, processorCount, memory, expectation.hardDisk);
assertEquals(vApp.getStatus(), Status.ON);
}
@ -117,7 +117,7 @@ public class VCloudExpressComputeClientLiveTest {
assert !addressTester.apply(publicAddress);
}
private void verifyConfigurationOfVApp(VApp vApp, String serverName, String expectedOs, int processorCount,
private void verifyConfigurationOfVApp(VCloudExpressVApp vApp, String serverName, String expectedOs, int processorCount,
int memory, long hardDisk) {
// assertEquals(vApp.getName(), serverName);
// assertEquals(vApp.getOperatingSystemDescription(), expectedOs);

View File

@ -52,7 +52,7 @@ public class TaskHandlerTest extends BaseHandlerTest {
}
public void testApplyInputStream() {
InputStream is = getClass().getResourceAsStream("/task.xml");
InputStream is = getClass().getResourceAsStream("/express/task.xml");
Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
@ -72,7 +72,7 @@ public class TaskHandlerTest extends BaseHandlerTest {
}
public void testSelf() {
InputStream is = getClass().getResourceAsStream("/task-self.xml");
InputStream is = getClass().getResourceAsStream("/express/task-self.xml");
Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
@ -83,7 +83,7 @@ public class TaskHandlerTest extends BaseHandlerTest {
}
public void testApplyInputStream2() {
InputStream is = getClass().getResourceAsStream("/task-hosting.xml");
InputStream is = getClass().getResourceAsStream("/express/task-hosting.xml");
Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
@ -98,7 +98,7 @@ public class TaskHandlerTest extends BaseHandlerTest {
}
public void testError() {
InputStream is = getClass().getResourceAsStream("/task-error.xml");
InputStream is = getClass().getResourceAsStream("/express/task-error.xml");
Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);

View File

@ -34,10 +34,10 @@ import org.jclouds.http.functions.config.SaxParserModule;
import org.jclouds.vcloud.domain.ResourceAllocation;
import org.jclouds.vcloud.domain.ResourceType;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VirtualSystem;
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
import org.jclouds.vcloud.domain.internal.VAppImpl;
import org.jclouds.vcloud.domain.internal.VCloudExpressVAppImpl;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@ -50,12 +50,12 @@ import com.google.inject.Guice;
import com.google.inject.name.Names;
/**
* Tests behavior of {@code VAppHandler}
* Tests behavior of {@code VCloudExpressVAppHandler}
*
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "vcloud.VAppHandlerTest")
public class VAppHandlerTest extends BaseHandlerTest {
@Test(groups = "unit", testName = "vcloud.VCloudExpressVAppHandlerTest")
public class VCloudExpressVAppHandlerTest extends BaseHandlerTest {
@BeforeTest
@Override
protected void setUpInjector() {
@ -75,19 +75,19 @@ public class VAppHandlerTest extends BaseHandlerTest {
public void testInstantiated() throws UnknownHostException {
InputStream is = getClass().getResourceAsStream("/instantiatedvapp.xml");
VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
VCloudExpressVApp result = factory.create(injector.getInstance(VCloudExpressVAppHandler.class)).parse(is);
VApp expects = new VAppImpl("centos53", URI.create("http://10.150.4.49/api/v0.8/vApp/10"), Status.RESOLVED,
123456789l, new NamedResourceImpl(null, "application/vnd.vmware.vcloud.vdc+xml", URI
.create("http://10.150.4.49/api/v0.8/vdc/4")), ImmutableListMultimap.<String, String> of(),
null, null, null, ImmutableSet.<ResourceAllocation> of());
VCloudExpressVApp expects = new VCloudExpressVAppImpl("centos53", URI
.create("http://10.150.4.49/api/v0.8/vApp/10"), Status.RESOLVED, 123456789l, new NamedResourceImpl(null,
"application/vnd.vmware.vcloud.vdc+xml", URI.create("http://10.150.4.49/api/v0.8/vdc/4")),
ImmutableListMultimap.<String, String> of(), null, null, null, ImmutableSet.<ResourceAllocation> of());
assertEquals(result, expects);
}
public void testDefault() throws UnknownHostException {
InputStream is = getClass().getResourceAsStream("/vapp.xml");
VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
VCloudExpressVApp result = factory.create(injector.getInstance(VCloudExpressVAppHandler.class)).parse(is);
ListMultimap<String, String> networkToAddresses = ImmutableListMultimap.<String, String> of("Public Network",
"10.150.4.93");
@ -105,10 +105,10 @@ public class VAppHandlerTest extends BaseHandlerTest {
new ResourceAllocation(9, "Hard Disk 1", null, ResourceType.DISK_DRIVE, null, "104857", null, 0, 3,
null, 104857, "byte * 2^20")).build();
VApp expects = new VAppImpl("centos53", URI.create("http://10.150.4.49/api/v0.8/vApp/10"), Status.ON, new Long(
104857), new NamedResourceImpl(null, "application/vnd.vmware.vcloud.vdc+xml", URI
.create("http://10.150.4.49/api/v0.8/vdc/4")), networkToAddresses, null, "Other Linux (32-bit)", system,
resourceAllocations);
VCloudExpressVApp expects = new VCloudExpressVAppImpl("centos53", URI
.create("http://10.150.4.49/api/v0.8/vApp/10"), Status.ON, new Long(104857), new NamedResourceImpl(null,
"application/vnd.vmware.vcloud.vdc+xml", URI.create("http://10.150.4.49/api/v0.8/vdc/4")),
networkToAddresses, null, "Other Linux (32-bit)", system, resourceAllocations);
assertEquals(result.getId(), expects.getId());
assertEquals(result.getName(), expects.getName());
assertEquals(result.getNetworkToAddresses(), expects.getNetworkToAddresses());
@ -124,7 +124,7 @@ public class VAppHandlerTest extends BaseHandlerTest {
public void testLatest() throws UnknownHostException {
InputStream is = getClass().getResourceAsStream("/vapp2.xml");
VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
VCloudExpressVApp result = factory.create(injector.getInstance(VCloudExpressVAppHandler.class)).parse(is);
ListMultimap<String, String> networkToAddresses = ImmutableListMultimap.<String, String> of("Public Network",
"10.23.119.221");
@ -142,9 +142,9 @@ public class VAppHandlerTest extends BaseHandlerTest {
new ResourceAllocation(9, "Hard Disk 1", null, ResourceType.DISK_DRIVE, null, "10485760", null, 0, 3,
null, 10485760, "byte * 2^20")).build();
VApp expects = new VAppImpl("m1", URI.create("http://localhost:8000/api/v0.8/vApp/80"), Status.ON, new Long(
10485760), new NamedResourceImpl(null, "application/vnd.vmware.vcloud.vdc+xml", URI
.create("http://localhost:8000/api/v0.8/vdc/28")), networkToAddresses, null,
VCloudExpressVApp expects = new VCloudExpressVAppImpl("m1", URI.create("http://localhost:8000/api/v0.8/vApp/80"),
Status.ON, new Long(10485760), new NamedResourceImpl(null, "application/vnd.vmware.vcloud.vdc+xml", URI
.create("http://localhost:8000/api/v0.8/vdc/28")), networkToAddresses, null,
"Microsoft Windows XP Professional (32-bit)", system, resourceAllocations);
assertEquals(result.getId(), expects.getId());
assertEquals(result.getName(), expects.getName());

View File

@ -0,0 +1,322 @@
<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
deployed="false" status="8" name="vApp_acole_2"
type="application/vnd.vmware.vcloud.vApp+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
<Link rel="power:powerOn"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/power/action/powerOn" />
<Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/action/deploy" />
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/controlAccess/" />
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/action/controlAccess" />
<Link rel="recompose"
type="application/vnd.vmware.vcloud.recomposeVAppParams+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/action/recomposeVApp" />
<Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439" />
<Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
<Link rel="remove"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
<Description />
<LeaseSettingsSection
type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/leaseSettingsSection/"
ovf:required="false">
<ovf:Info>Lease settings section</ovf:Info>
<Link rel="edit"
type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/leaseSettingsSection/" />
<DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
<StorageLeaseInSeconds>0</StorageLeaseInSeconds>
</LeaseSettingsSection>
<ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/startupSection/"
vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
<ovf:Info>VApp startup section</ovf:Info>
<ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff"
ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0"
ovf:id="RHEL5" />
<Link rel="edit"
type="application/vnd.vmware.vcloud.startupSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/startupSection/" />
</ovf:StartupSection>
<ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/networkSection/"
vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
<ovf:Info>The list of logical networks</ovf:Info>
<ovf:Network ovf:name="internet01">
<ovf:Description />
</ovf:Network>
</ovf:NetworkSection>
<NetworkConfigSection
type="application/vnd.vmware.vcloud.networkConfigSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/networkConfigSection/"
ovf:required="false">
<ovf:Info>The configuration parameters for logical networks</ovf:Info>
<Link rel="edit"
type="application/vnd.vmware.vcloud.networkConfigSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/networkConfigSection/" />
<NetworkConfig networkName="internet01">
<Description />
<Configuration>
<IpScope>
<IsInherited>true</IsInherited>
<Gateway>174.47.101.161</Gateway>
<Netmask>255.255.255.224</Netmask>
<Dns1>24.172.173.113</Dns1>
<IpRanges>
<IpRange>
<StartAddress>174.47.101.164</StartAddress>
<EndAddress>174.47.101.190</EndAddress>
</IpRange>
</IpRanges>
</IpScope>
<ParentNetwork
type="application/vnd.vmware.vcloud.network+xml"
name="internet01"
href="https://vcenterprise.bluelock.com/api/v1.0/network/758634723" />
<FenceMode>bridged</FenceMode>
<Features>
<DhcpService>
<IsEnabled>false</IsEnabled>
<DefaultLeaseTime>3600</DefaultLeaseTime>
<MaxLeaseTime>7200</MaxLeaseTime>
<IpRange>
<StartAddress>174.47.101.162</StartAddress>
<EndAddress>174.47.101.163</EndAddress>
</IpRange>
</DhcpService>
<FirewallService>
<IsEnabled>true</IsEnabled>
</FirewallService>
<NatService>
<IsEnabled>true</IsEnabled>
<NatType>ipTranslation</NatType>
<Policy>allowTraffic</Policy>
<NatRule>
<OneToOneVmRule>
<MappingMode>automatic</MappingMode>
<VAppScopedVmId>10_rhel_template</VAppScopedVmId>
<VmNicId>0</VmNicId>
</OneToOneVmRule>
</NatRule>
</NatService>
</Features>
</Configuration>
<IsDeployed>false</IsDeployed>
</NetworkConfig>
</NetworkConfigSection>
<Children>
<Vm deployed="false" status="8" name="RHEL5"
type="application/vnd.vmware.vcloud.vm+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248">
<Link rel="power:powerOn"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/power/action/powerOn" />
<Link rel="deploy"
type="application/vnd.vmware.vcloud.deployVAppParams+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/action/deploy" />
<Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
<Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248" />
<Link rel="remove"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248" />
<Link rel="screen:thumbnail"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/screen" />
<Link rel="screen:acquireTicket"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/screen/action/acquireTicket" />
<Link rel="media:insertMedia"
type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/media/action/insertMedia" />
<Link rel="media:ejectMedia"
type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/media/action/ejectMedia" />
<Description />
<ovf:VirtualHardwareSection
xmlns:vcloud="http://www.vmware.com/vcloud/v1"
vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/"
vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
<ovf:Info>Virtual hardware requirements</ovf:Info>
<ovf:System>
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
<vssd:InstanceID>0</vssd:InstanceID>
<vssd:VirtualSystemIdentifier>RHEL5</vssd:VirtualSystemIdentifier>
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
</ovf:System>
<ovf:Item>
<rasd:Address>00:50:56:01:01:f2</rasd:Address>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
<rasd:Connection vcloud:ipAddress="174.47.101.164"
vcloud:primaryNetworkConnection="true"
vcloud:ipAddressingMode="POOL">internet01</rasd:Connection>
<rasd:Description>PCNet32 ethernet adapter</rasd:Description>
<rasd:ElementName>Network adapter 0</rasd:ElementName>
<rasd:InstanceID>1</rasd:InstanceID>
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>SCSI Controller</rasd:Description>
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
<rasd:InstanceID>2</rasd:InstanceID>
<rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:Description>Hard disk</rasd:Description>
<rasd:ElementName>Hard disk 1</rasd:ElementName>
<rasd:HostResource
vcloud:capacity="30720" vcloud:busType="6"
vcloud:busSubType="lsilogic" />
<rasd:InstanceID>2000</rasd:InstanceID>
<rasd:Parent>2</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>IDE Controller 0</rasd:ElementName>
<rasd:InstanceID>3</rasd:InstanceID>
<rasd:ResourceType>5</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>CD/DVD Drive</rasd:Description>
<rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
<rasd:HostResource />
<rasd:InstanceID>3002</rasd:InstanceID>
<rasd:Parent>3</rasd:Parent>
<rasd:ResourceType>15</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>Floppy Drive</rasd:Description>
<rasd:ElementName>Floppy Drive 1</rasd:ElementName>
<rasd:HostResource />
<rasd:InstanceID>8000</rasd:InstanceID>
<rasd:ResourceType>14</rasd:ResourceType>
</ovf:Item>
<ovf:Item
vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu"
vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
<rasd:Description>Number of Virtual CPUs</rasd:Description>
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit"
type="application/vnd.vmware.vcloud.rasdItem+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
</ovf:Item>
<ovf:Item
vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory"
vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
<rasd:Description>Memory Size</rasd:Description>
<rasd:ElementName>384 MB of memory</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:VirtualQuantity>384</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit"
type="application/vnd.vmware.vcloud.rasdItem+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
</ovf:Item>
<Link rel="edit"
type="application/vnd.vmware.vcloud.virtualHardwareSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/" />
<Link rel="down"
type="application/vnd.vmware.vcloud.rasdItem+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
<Link rel="edit"
type="application/vnd.vmware.vcloud.rasdItem+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
<Link rel="down"
type="application/vnd.vmware.vcloud.rasdItem+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
<Link rel="edit"
type="application/vnd.vmware.vcloud.rasdItem+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
<Link rel="down"
type="application/vnd.vmware.vcloud.rasdItemsList+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
<Link rel="edit"
type="application/vnd.vmware.vcloud.rasdItemsList+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
<Link rel="down"
type="application/vnd.vmware.vcloud.rasdItemsList+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/media" />
<Link rel="down"
type="application/vnd.vmware.vcloud.rasdItemsList+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
<Link rel="edit"
type="application/vnd.vmware.vcloud.rasdItemsList+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
</ovf:VirtualHardwareSection>
<ovf:OperatingSystemSection
xmlns:vcloud="http://www.vmware.com/vcloud/v1"
xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80"
vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/"
vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
vmw:osType="rhel5_64Guest">
<ovf:Info>Specifies the operating system installed</ovf:Info>
<ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
<Link rel="edit"
type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/" />
</ovf:OperatingSystemSection>
<NetworkConnectionSection
type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/"
ovf:required="false">
<ovf:Info>Specifies the available VM network connections</ovf:Info>
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection network="internet01">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IpAddress>174.47.101.164</IpAddress>
<IsConnected>true</IsConnected>
<MACAddress>00:50:56:01:01:f2</MACAddress>
<IpAddressAllocationMode>POOL</IpAddressAllocationMode>
</NetworkConnection>
<Link rel="edit"
type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/" />
</NetworkConnectionSection>
<GuestCustomizationSection
type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/"
ovf:required="false">
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
<Enabled>true</Enabled>
<ChangeSid>false</ChangeSid>
<VirtualMachineId>2087535248</VirtualMachineId>
<JoinDomainEnabled>false</JoinDomainEnabled>
<UseOrgSettings>false</UseOrgSettings>
<AdminPasswordEnabled>true</AdminPasswordEnabled>
<AdminPasswordAuto>true</AdminPasswordAuto>
<ResetPasswordRequired>false</ResetPasswordRequired>
<CustomizationScript>#!/bin/bash if [[ $1 == "postcustomization" ]]; then echo "post customization" touch /root/.postcustomization ping www.redhat.com -c 1 sleep 30 # register with RHN /usr/sbin/rhnreg_ks --profilename vic_`hostname`_`dmidecode -s system-uuid` --activationkey=281c9a9c77b8c001fe8ac8dd3b3f76d6 --force echo "rhn registered" # make hostname fully qualified to speed up sendmail start perl -i -pe "s/`hostname`/`hostname`.victory.blk/g" /etc/sysconfig/network rm /etc/ssh/*_key* service sshd restart echo "completed" fi</CustomizationScript>
<ComputerName>RHEL5</ComputerName>
<Link rel="edit"
type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/" />
</GuestCustomizationSection>
<VAppScopedLocalId>10_rhel_template</VAppScopedLocalId>
</Vm>
</Children>
</VApp>

View File

@ -0,0 +1,213 @@
<?xml version="1.0" encoding="UTF-8"?>
<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" deployed="false" status="8" name="vApp_acole_1" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
<Link rel="power:powerOn" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/power/action/powerOn"/>
<Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/action/deploy"/>
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/controlAccess/"/>
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/action/controlAccess"/>
<Link rel="recompose" type="application/vnd.vmware.vcloud.recomposeVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/action/recomposeVApp"/>
<Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721"/>
<Link rel="remove" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721"/>
<Description/>
<LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/leaseSettingsSection/" ovf:required="false">
<ovf:Info>Lease settings section</ovf:Info>
<Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/leaseSettingsSection/"/>
<DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
<StorageLeaseInSeconds>0</StorageLeaseInSeconds>
</LeaseSettingsSection>
<ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/startupSection/" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
<ovf:Info>VApp startup section</ovf:Info>
<ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="Ubuntu1004"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.startupSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/startupSection/"/>
</ovf:StartupSection>
<ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
<ovf:Info>The list of logical networks</ovf:Info>
<ovf:Network ovf:name="internet01">
<ovf:Description/>
</ovf:Network>
</ovf:NetworkSection>
<NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/networkConfigSection/" ovf:required="false">
<ovf:Info>The configuration parameters for logical networks</ovf:Info>
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/networkConfigSection/"/>
<NetworkConfig networkName="internet01">
<Description/>
<Configuration>
<IpScope>
<IsInherited>true</IsInherited>
<Gateway>174.47.101.161</Gateway>
<Netmask>255.255.255.224</Netmask>
<Dns1>24.172.173.113</Dns1>
<IpRanges>
<IpRange>
<StartAddress>174.47.101.164</StartAddress>
<EndAddress>174.47.101.190</EndAddress>
</IpRange>
</IpRanges>
</IpScope>
<ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="internet01" href="https://vcenterprise.bluelock.com/api/v1.0/network/758634723"/>
<FenceMode>bridged</FenceMode>
<Features>
<DhcpService>
<IsEnabled>false</IsEnabled>
<DefaultLeaseTime>3600</DefaultLeaseTime>
<MaxLeaseTime>7200</MaxLeaseTime>
<IpRange>
<StartAddress>174.47.101.162</StartAddress>
<EndAddress>174.47.101.163</EndAddress>
</IpRange>
</DhcpService>
<FirewallService>
<IsEnabled>true</IsEnabled>
</FirewallService>
<NatService>
<IsEnabled>true</IsEnabled>
<NatType>ipTranslation</NatType>
<Policy>allowTraffic</Policy>
</NatService>
</Features>
</Configuration>
<IsDeployed>false</IsDeployed>
</NetworkConfig>
</NetworkConfigSection>
<Children>
<Vm deployed="false" status="8" name="Ubuntu1004" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975">
<Link rel="power:powerOn" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/power/action/powerOn"/>
<Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/action/deploy"/>
<Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975"/>
<Link rel="remove" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975"/>
<Link rel="screen:thumbnail" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/screen"/>
<Link rel="screen:acquireTicket" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/screen/action/acquireTicket"/>
<Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/media/action/insertMedia"/>
<Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/media/action/ejectMedia"/>
<Description/>
<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
<ovf:Info>Virtual hardware requirements</ovf:Info>
<ovf:System>
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
<vssd:InstanceID>0</vssd:InstanceID>
<vssd:VirtualSystemIdentifier>Ubuntu1004</vssd:VirtualSystemIdentifier>
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
</ovf:System>
<ovf:Item>
<rasd:Address>00:50:56:01:01:f1</rasd:Address>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
<rasd:Connection vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="DHCP">internet01</rasd:Connection>
<rasd:Description>PCNet32 ethernet adapter</rasd:Description>
<rasd:ElementName>Network adapter 0</rasd:ElementName>
<rasd:InstanceID>1</rasd:InstanceID>
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>SCSI Controller</rasd:Description>
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
<rasd:InstanceID>2</rasd:InstanceID>
<rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:Description>Hard disk</rasd:Description>
<rasd:ElementName>Hard disk 1</rasd:ElementName>
<rasd:HostResource vcloud:capacity="30720" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
<rasd:InstanceID>2000</rasd:InstanceID>
<rasd:Parent>2</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>IDE Controller 0</rasd:ElementName>
<rasd:InstanceID>3</rasd:InstanceID>
<rasd:ResourceType>5</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>CD/DVD Drive</rasd:Description>
<rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
<rasd:HostResource/>
<rasd:InstanceID>3002</rasd:InstanceID>
<rasd:Parent>3</rasd:Parent>
<rasd:ResourceType>15</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>Floppy Drive</rasd:Description>
<rasd:ElementName>Floppy Drive 1</rasd:ElementName>
<rasd:HostResource/>
<rasd:InstanceID>8000</rasd:InstanceID>
<rasd:ResourceType>14</rasd:ResourceType>
</ovf:Item>
<ovf:Item vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
<rasd:Description>Number of Virtual CPUs</rasd:Description>
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/cpu"/>
</ovf:Item>
<ovf:Item vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
<rasd:Description>Memory Size</rasd:Description>
<rasd:ElementName>512 MB of memory</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:VirtualQuantity>512</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/memory"/>
</ovf:Item>
<Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/cpu"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/cpu"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/memory"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/memory"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/disks"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/disks"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/media"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/networkCards"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/networkCards"/>
</ovf:VirtualHardwareSection>
<ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="94" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="ubuntu64Guest">
<ovf:Info>Specifies the operating system installed</ovf:Info>
<ovf:Description>Ubuntu Linux (64-bit)</ovf:Description>
<Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/operatingSystemSection/"/>
</ovf:OperatingSystemSection>
<NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/networkConnectionSection/" ovf:required="false">
<ovf:Info>Specifies the available VM network connections</ovf:Info>
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection network="internet01">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IsConnected>true</IsConnected>
<MACAddress>00:50:56:01:01:f1</MACAddress>
<IpAddressAllocationMode>DHCP</IpAddressAllocationMode>
</NetworkConnection>
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/networkConnectionSection/"/>
</NetworkConnectionSection>
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/guestCustomizationSection/" ovf:required="false">
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
<Enabled>true</Enabled>
<ChangeSid>false</ChangeSid>
<VirtualMachineId>2093098975</VirtualMachineId>
<JoinDomainEnabled>false</JoinDomainEnabled>
<UseOrgSettings>false</UseOrgSettings>
<AdminPasswordEnabled>true</AdminPasswordEnabled>
<AdminPasswordAuto>true</AdminPasswordAuto>
<AdminPassword>%3eD%gmF</AdminPassword>
<ResetPasswordRequired>false</ResetPasswordRequired>
<CustomizationScript>#regenerate keys /bin/rm /etc/ssh/ssh_host_* /usr/sbin/dpkg-reconfigure openssh-server</CustomizationScript>
<ComputerName>Ubuntu1004</ComputerName>
<Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/guestCustomizationSection/"/>
</GuestCustomizationSection>
<VAppScopedLocalId>02_ubuntu_template</VAppScopedLocalId>
</Vm>
</Children>
</VApp>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<VApp xmlns="http://www.vmware.com/vcloud/v1" deployed="false"
status="0" name="vApp_acole_2" type="application/vnd.vmware.vcloud.vApp+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
<Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439" />
<Description />
<Tasks>
<Task status="running" startTime="2010-08-23T02:09:52.443-04:00"
operation="Creating Virtual Application vApp_acole_2(607806320)"
expiryTime="2010-11-21T02:09:52.443-05:00" endTime="9999-12-31T23:59:59.999-05:00"
type="application/vnd.vmware.vcloud.task+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/task/3cc08ir8oczbze3n1a3">
<Owner type="application/vnd.vmware.vcloud.vApp+xml"
name="vApp_acole_2"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
</Task>
</Tasks>
</VApp>

View File

@ -0,0 +1,219 @@
<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" deployed="false" status="8" name="vApp_acole_4" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
<Link rel="power:powerOn" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/power/action/powerOn"/>
<Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/action/deploy"/>
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/controlAccess/"/>
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/action/controlAccess"/>
<Link rel="recompose" type="application/vnd.vmware.vcloud.recomposeVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/action/recomposeVApp"/>
<Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903"/>
<Link rel="remove" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903"/>
<Description/>
<LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/leaseSettingsSection/" ovf:required="false">
<ovf:Info>Lease settings section</ovf:Info>
<Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/leaseSettingsSection/"/>
<DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
<StorageLeaseInSeconds>0</StorageLeaseInSeconds>
</LeaseSettingsSection>
<ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/startupSection/" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
<ovf:Info>VApp startup section</ovf:Info>
<ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="Windows2008R2"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.startupSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/startupSection/"/>
</ovf:StartupSection>
<ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
<ovf:Info>The list of logical networks</ovf:Info>
<ovf:Network ovf:name="internet01">
<ovf:Description/>
</ovf:Network>
</ovf:NetworkSection>
<NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/networkConfigSection/" ovf:required="false">
<ovf:Info>The configuration parameters for logical networks</ovf:Info>
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/networkConfigSection/"/>
<NetworkConfig networkName="internet01">
<Description/>
<Configuration>
<IpScope>
<IsInherited>true</IsInherited>
<Gateway>174.47.101.161</Gateway>
<Netmask>255.255.255.224</Netmask>
<Dns1>24.172.173.113</Dns1>
<IpRanges>
<IpRange>
<StartAddress>174.47.101.164</StartAddress>
<EndAddress>174.47.101.190</EndAddress>
</IpRange>
</IpRanges>
</IpScope>
<ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="internet01" href="https://vcenterprise.bluelock.com/api/v1.0/network/758634723"/>
<FenceMode>bridged</FenceMode>
<Features>
<DhcpService>
<IsEnabled>false</IsEnabled>
<DefaultLeaseTime>3600</DefaultLeaseTime>
<MaxLeaseTime>7200</MaxLeaseTime>
<IpRange>
<StartAddress>174.47.101.162</StartAddress>
<EndAddress>174.47.101.163</EndAddress>
</IpRange>
</DhcpService>
<FirewallService>
<IsEnabled>true</IsEnabled>
</FirewallService>
<NatService>
<IsEnabled>true</IsEnabled>
<NatType>ipTranslation</NatType>
<Policy>allowTraffic</Policy>
<NatRule>
<OneToOneVmRule>
<MappingMode>automatic</MappingMode>
<VAppScopedVmId>04_windows_template</VAppScopedVmId>
<VmNicId>0</VmNicId>
</OneToOneVmRule>
</NatRule>
</NatService>
</Features>
</Configuration>
<IsDeployed>false</IsDeployed>
</NetworkConfig>
</NetworkConfigSection>
<Children>
<Vm deployed="false" status="8" name="Windows2008R2" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461">
<Link rel="power:powerOn" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/power/action/powerOn"/>
<Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/action/deploy"/>
<Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461"/>
<Link rel="remove" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461"/>
<Link rel="screen:thumbnail" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/screen"/>
<Link rel="screen:acquireTicket" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/screen/action/acquireTicket"/>
<Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/media/action/insertMedia"/>
<Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/media/action/ejectMedia"/>
<Description/>
<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
<ovf:Info>Virtual hardware requirements</ovf:Info>
<ovf:System>
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
<vssd:InstanceID>0</vssd:InstanceID>
<vssd:VirtualSystemIdentifier>Windows2008R2</vssd:VirtualSystemIdentifier>
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
</ovf:System>
<ovf:Item>
<rasd:Address>00:50:56:01:02:33</rasd:Address>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
<rasd:Connection vcloud:ipAddress="174.47.101.165" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">internet01</rasd:Connection>
<rasd:Description>PCNet32 ethernet adapter</rasd:Description>
<rasd:ElementName>Network adapter 0</rasd:ElementName>
<rasd:InstanceID>1</rasd:InstanceID>
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>SCSI Controller</rasd:Description>
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
<rasd:InstanceID>2</rasd:InstanceID>
<rasd:ResourceSubType>lsilogicsas</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:Description>Hard disk</rasd:Description>
<rasd:ElementName>Hard disk 1</rasd:ElementName>
<rasd:HostResource vcloud:capacity="40960" vcloud:busType="6" vcloud:busSubType="lsilogicsas"/>
<rasd:InstanceID>2000</rasd:InstanceID>
<rasd:Parent>2</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>IDE Controller 0</rasd:ElementName>
<rasd:InstanceID>3</rasd:InstanceID>
<rasd:ResourceType>5</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>CD/DVD Drive</rasd:Description>
<rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
<rasd:HostResource/>
<rasd:InstanceID>3002</rasd:InstanceID>
<rasd:Parent>3</rasd:Parent>
<rasd:ResourceType>15</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>Floppy Drive</rasd:Description>
<rasd:ElementName>Floppy Drive 1</rasd:ElementName>
<rasd:HostResource/>
<rasd:InstanceID>8000</rasd:InstanceID>
<rasd:ResourceType>14</rasd:ResourceType>
</ovf:Item>
<ovf:Item vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
<rasd:Description>Number of Virtual CPUs</rasd:Description>
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/cpu"/>
</ovf:Item>
<ovf:Item vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
<rasd:Description>Memory Size</rasd:Description>
<rasd:ElementName>4096 MB of memory</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:VirtualQuantity>4096</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/memory"/>
</ovf:Item>
<Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/cpu"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/cpu"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/memory"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/memory"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/disks"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/disks"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/media"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/networkCards"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/networkCards"/>
</ovf:VirtualHardwareSection>
<ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="102" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="windows7Server64Guest">
<ovf:Info>Specifies the operating system installed</ovf:Info>
<ovf:Description>Microsoft Windows Server 2008 R2 (64-bit)</ovf:Description>
<Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/operatingSystemSection/"/>
</ovf:OperatingSystemSection>
<NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/networkConnectionSection/" ovf:required="false">
<ovf:Info>Specifies the available VM network connections</ovf:Info>
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection network="internet01">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IpAddress>174.47.101.165</IpAddress>
<IsConnected>true</IsConnected>
<MACAddress>00:50:56:01:02:33</MACAddress>
<IpAddressAllocationMode>POOL</IpAddressAllocationMode>
</NetworkConnection>
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/networkConnectionSection/"/>
</NetworkConnectionSection>
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/guestCustomizationSection/" ovf:required="false">
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
<Enabled>true</Enabled>
<ChangeSid>true</ChangeSid>
<VirtualMachineId>904484461</VirtualMachineId>
<JoinDomainEnabled>false</JoinDomainEnabled>
<UseOrgSettings>false</UseOrgSettings>
<AdminPasswordEnabled>true</AdminPasswordEnabled>
<AdminPasswordAuto>true</AdminPasswordAuto>
<ResetPasswordRequired>false</ResetPasswordRequired>
<CustomizationScript/>
<ComputerName>Windows2008R2</ComputerName>
<Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/guestCustomizationSection/"/>
</GuestCustomizationSection>
<VAppScopedLocalId>04_windows_template</VAppScopedLocalId>
</Vm>
</Children>
</VApp>

View File

@ -0,0 +1,199 @@
<Vm deployed="false" status="8" name="RHEL5"
type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248">
<Link rel="power:powerOn"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/power/action/powerOn" />
<Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/action/deploy" />
<Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
<Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248" />
<Link rel="remove"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248" />
<Link rel="screen:thumbnail"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/screen" />
<Link rel="screen:acquireTicket"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/screen/action/acquireTicket" />
<Link rel="media:insertMedia"
type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/media/action/insertMedia" />
<Link rel="media:ejectMedia"
type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/media/action/ejectMedia" />
<Description />
<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/"
vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
<ovf:Info>Virtual hardware requirements</ovf:Info>
<ovf:System>
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
<vssd:InstanceID>0</vssd:InstanceID>
<vssd:VirtualSystemIdentifier>RHEL5</vssd:VirtualSystemIdentifier>
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
</ovf:System>
<ovf:Item>
<rasd:Address>00:50:56:01:01:f2</rasd:Address>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
<rasd:Connection vcloud:ipAddress="174.47.101.164"
vcloud:primaryNetworkConnection="true"
vcloud:ipAddressingMode="POOL">internet01</rasd:Connection>
<rasd:Description>PCNet32 ethernet adapter</rasd:Description>
<rasd:ElementName>Network adapter 0</rasd:ElementName>
<rasd:InstanceID>1</rasd:InstanceID>
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>SCSI Controller</rasd:Description>
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
<rasd:InstanceID>2</rasd:InstanceID>
<rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:Description>Hard disk</rasd:Description>
<rasd:ElementName>Hard disk 1</rasd:ElementName>
<rasd:HostResource vcloud:capacity="30720"
vcloud:busType="6" vcloud:busSubType="lsilogic" />
<rasd:InstanceID>2000</rasd:InstanceID>
<rasd:Parent>2</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>IDE Controller 0</rasd:ElementName>
<rasd:InstanceID>3</rasd:InstanceID>
<rasd:ResourceType>5</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>CD/DVD Drive</rasd:Description>
<rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
<rasd:HostResource />
<rasd:InstanceID>3002</rasd:InstanceID>
<rasd:Parent>3</rasd:Parent>
<rasd:ResourceType>15</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>Floppy Drive</rasd:Description>
<rasd:ElementName>Floppy Drive 1</rasd:ElementName>
<rasd:HostResource />
<rasd:InstanceID>8000</rasd:InstanceID>
<rasd:ResourceType>14</rasd:ResourceType>
</ovf:Item>
<ovf:Item
vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu"
vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
<rasd:Description>Number of Virtual CPUs</rasd:Description>
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
</ovf:Item>
<ovf:Item
vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory"
vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
<rasd:Description>Memory Size</rasd:Description>
<rasd:ElementName>384 MB of memory</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:VirtualQuantity>384</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
</ovf:Item>
<Link rel="edit"
type="application/vnd.vmware.vcloud.virtualHardwareSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/" />
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/media" />
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
</ovf:VirtualHardwareSection>
<ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80"
vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/"
vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
vmw:osType="rhel5_64Guest">
<ovf:Info>Specifies the operating system installed</ovf:Info>
<ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
<Link rel="edit"
type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/" />
</ovf:OperatingSystemSection>
<NetworkConnectionSection
type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/"
ovf:required="false">
<ovf:Info>Specifies the available VM network connections</ovf:Info>
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection network="internet01">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IpAddress>174.47.101.164</IpAddress>
<IsConnected>true</IsConnected>
<MACAddress>00:50:56:01:01:f2</MACAddress>
<IpAddressAllocationMode>POOL</IpAddressAllocationMode>
</NetworkConnection>
<Link rel="edit"
type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/" />
</NetworkConnectionSection>
<GuestCustomizationSection
type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/"
ovf:required="false">
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
<Enabled>true</Enabled>
<ChangeSid>false</ChangeSid>
<VirtualMachineId>2087535248</VirtualMachineId>
<JoinDomainEnabled>false</JoinDomainEnabled>
<UseOrgSettings>false</UseOrgSettings>
<AdminPasswordEnabled>true</AdminPasswordEnabled>
<AdminPasswordAuto>true</AdminPasswordAuto>
<ResetPasswordRequired>false</ResetPasswordRequired>
<CustomizationScript>#!/bin/bash if [[ $1 == "postcustomization"
]]; then echo "post customization" touch
/root/.postcustomization ping www.redhat.com -c 1 sleep 30 #
register with RHN /usr/sbin/rhnreg_ks --profilename
vic_`hostname`_`dmidecode -s system-uuid`
--activationkey=281c9a9c77b8c001fe8ac8dd3b3f76d6 --force
echo "rhn registered" # make hostname fully qualified to
speed up sendmail start perl -i -pe
"s/`hostname`/`hostname`.victory.blk/g"
/etc/sysconfig/network rm /etc/ssh/*_key* service sshd
restart echo "completed" fi</CustomizationScript>
<ComputerName>RHEL5</ComputerName>
<Link rel="edit"
type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/" />
</GuestCustomizationSection>
<VAppScopedLocalId>10_rhel_template</VAppScopedLocalId>
</Vm>

View File

@ -59,7 +59,7 @@ import org.jclouds.vcloud.VCloudExpressAsyncClient;
import org.jclouds.vcloud.VCloudExpressClient;
import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VDC;
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
import org.jclouds.vcloud.functions.OrgNameAndVDCNameToEndpoint;
@ -94,7 +94,7 @@ import org.jclouds.vcloud.terremark.xml.TerremarkCatalogItemHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkOrgHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler;
import org.jclouds.vcloud.xml.CatalogHandler;
import org.jclouds.vcloud.xml.VAppHandler;
import org.jclouds.vcloud.xml.VCloudExpressVAppHandler;
import com.google.common.util.concurrent.ListenableFuture;
@ -188,9 +188,9 @@ public interface TerremarkVCloudAsyncClient extends VCloudExpressAsyncClient {
@Path("action/instantiateVAppTemplate")
@Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
@Consumes(VAPP_XML)
@XMLResponseParser(VAppHandler.class)
@XMLResponseParser(VCloudExpressVAppHandler.class)
@MapBinder(TerremarkBindInstantiateVAppTemplateParamsToXmlPayload.class)
ListenableFuture<? extends VApp> instantiateVAppTemplateInVDC(@EndpointParam URI vdc,
ListenableFuture<? extends VCloudExpressVApp> instantiateVAppTemplateInVDC(@EndpointParam URI vdc,
@MapPayloadParam("template") URI template,
@MapPayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
InstantiateVAppTemplateOptions... options);
@ -330,7 +330,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudExpressAsyncClient {
@MapBinder(BindVAppConfigurationToXmlPayload.class)
@ResponseParser(ParseTaskFromLocationHeader.class)
ListenableFuture<? extends Task> configureVApp(
@EndpointParam(parser = BindVAppConfigurationToXmlPayload.class) VApp vApp, VAppConfiguration configuration);
@EndpointParam(parser = BindVAppConfigurationToXmlPayload.class) VCloudExpressVApp vApp, VAppConfiguration configuration);
/**
* @see TerremarkVCloudClient#getCustomizationOptions

View File

@ -28,7 +28,7 @@ import javax.annotation.Nullable;
import org.jclouds.concurrent.Timeout;
import org.jclouds.vcloud.VCloudExpressClient;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.terremark.domain.CustomizationParameters;
import org.jclouds.vcloud.terremark.domain.InternetService;
import org.jclouds.vcloud.terremark.domain.Node;
@ -134,12 +134,12 @@ public interface TerremarkVCloudClient extends VCloudExpressClient {
* You can make more than one change in a single request. For example, you can increase the
* number of virtual CPUs and the amount of virtual memory in the same request.
*
* @param VApp
* @param VCloudExpressVApp
* vApp to change in power state off
* @param configuration
* (s) to change
* @return task of configuration change
*/
Task configureVApp(VApp vApp, VAppConfiguration configuration);
Task configureVApp(VCloudExpressVApp vApp, VAppConfiguration configuration);
}

View File

@ -46,7 +46,7 @@ import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.jclouds.vcloud.domain.ResourceAllocation;
import org.jclouds.vcloud.domain.ResourceType;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.terremark.domain.VAppConfiguration;
import com.google.common.base.Function;
@ -85,7 +85,7 @@ public class BindVAppConfigurationToXmlPayload implements MapBinder, Function<Ob
GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
checkState(gRequest.getArgs() != null, "args should be initialized at this point");
VApp vApp = checkNotNull(findVAppInArgsOrNull(gRequest), "vApp");
VCloudExpressVApp vApp = checkNotNull(findVAppInArgsOrNull(gRequest), "vApp");
checkArgument(vApp.getStatus() == Status.OFF, "vApp must be off!");
VAppConfiguration configuration = checkNotNull(findConfigInArgsOrNull(gRequest), "config");
@ -101,7 +101,7 @@ public class BindVAppConfigurationToXmlPayload implements MapBinder, Function<Ob
}
protected String generateXml(VApp vApp, VAppConfiguration configuration) throws ParserConfigurationException,
protected String generateXml(VCloudExpressVApp vApp, VAppConfiguration configuration) throws ParserConfigurationException,
FactoryConfigurationError, TransformerException {
String name = configuration.getName() != null ? configuration.getName() : vApp.getName();
@ -120,20 +120,20 @@ public class BindVAppConfigurationToXmlPayload implements MapBinder, Function<Ob
return rootBuilder.asString(outputProperties);
}
private void addProcessorItem(XMLBuilder sectionBuilder, VApp vApp, VAppConfiguration configuration) {
private void addProcessorItem(XMLBuilder sectionBuilder, VCloudExpressVApp vApp, VAppConfiguration configuration) {
ResourceAllocation cpu = find(vApp.getResourceAllocations(), resourceType(ResourceType.PROCESSOR));
long quantity = configuration.getProcessorCount() != null ? configuration.getProcessorCount() : cpu
.getVirtualQuantity();
addResourceWithQuantity(sectionBuilder, cpu, quantity);
}
private void addMemoryItem(XMLBuilder sectionBuilder, VApp vApp, VAppConfiguration configuration) {
private void addMemoryItem(XMLBuilder sectionBuilder, VCloudExpressVApp vApp, VAppConfiguration configuration) {
ResourceAllocation memory = find(vApp.getResourceAllocations(), resourceType(ResourceType.MEMORY));
long quantity = configuration.getMemory() != null ? configuration.getMemory() : memory.getVirtualQuantity();
addResourceWithQuantity(sectionBuilder, memory, quantity);
}
private void addDiskItems(XMLBuilder sectionBuilder, VApp vApp, VAppConfiguration configuration) {
private void addDiskItems(XMLBuilder sectionBuilder, VCloudExpressVApp vApp, VAppConfiguration configuration) {
for (ResourceAllocation disk : filter(vApp.getResourceAllocations(), resourceType(ResourceType.DISK_DRIVE))) {
if (!configuration.getDisksToDelete().contains(disk.getAddressOnParent()))
addDiskWithQuantity(sectionBuilder, disk);
@ -165,7 +165,7 @@ public class BindVAppConfigurationToXmlPayload implements MapBinder, Function<Ob
return itemBuilder;
}
protected XMLBuilder buildRoot(VApp vApp, String name) throws ParserConfigurationException,
protected XMLBuilder buildRoot(VCloudExpressVApp vApp, String name) throws ParserConfigurationException,
FactoryConfigurationError {
String status = vApp.getStatus().value();
if (apiVersion.indexOf("0.8") != -1 && "8".equals(status))
@ -176,12 +176,12 @@ public class BindVAppConfigurationToXmlPayload implements MapBinder, Function<Ob
return rootBuilder;
}
protected VApp findVAppInArgsOrNull(GeneratedHttpRequest<?> gRequest) {
protected VCloudExpressVApp findVAppInArgsOrNull(GeneratedHttpRequest<?> gRequest) {
for (Object arg : gRequest.getArgs()) {
if (arg instanceof VApp) {
return (VApp) arg;
} else if (arg instanceof VApp[]) {
VApp[] vapps = (VApp[]) arg;
if (arg instanceof VCloudExpressVApp) {
return (VCloudExpressVApp) arg;
} else if (arg instanceof VCloudExpressVApp[]) {
VCloudExpressVApp[] vapps = (VCloudExpressVApp[]) arg;
return (vapps.length > 0) ? vapps[0] : null;
}
}
@ -210,6 +210,6 @@ public class BindVAppConfigurationToXmlPayload implements MapBinder, Function<Ob
@Override
public URI apply(Object from) {
return VApp.class.cast(checkNotNull(from, "from")).getId();
return VCloudExpressVApp.class.cast(checkNotNull(from, "from")).getId();
}
}

View File

@ -39,11 +39,11 @@ import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
import org.jclouds.domain.Credentials;
import org.jclouds.vcloud.compute.internal.VCloudExpressComputeClientImpl;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.TaskStatus;
import org.jclouds.vcloud.domain.TasksList;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
import org.jclouds.vcloud.terremark.TerremarkECloudClient;
@ -79,7 +79,8 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl
}
@Override
protected Map<String, String> parseAndValidateResponse(VCloudExpressVAppTemplate template, VApp vAppResponse) {
protected Map<String, String> parseAndValidateResponse(VCloudExpressVAppTemplate template,
VCloudExpressVApp vAppResponse) {
Credentials credentials = credentialsProvider.execute(template);
Map<String, String> toReturn = super.parseResponse(template, vAppResponse);
toReturn.put("username", credentials.identity);
@ -113,7 +114,7 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl
}
public String createPublicAddressMappedToPorts(URI vAppId, int... ports) {
VApp vApp = client.getVApp(vAppId);
VCloudExpressVApp vApp = client.getVApp(vAppId);
PublicIpAddress ip = null;
String privateAddress = getLast(vApp.getNetworkToAddresses().values());
for (int port : ports) {
@ -167,7 +168,7 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl
return ip != null ? ip.getAddress() : null;
}
private Set<PublicIpAddress> deleteInternetServicesAndNodesAssociatedWithVApp(VApp vApp) {
private Set<PublicIpAddress> deleteInternetServicesAndNodesAssociatedWithVApp(VCloudExpressVApp vApp) {
Set<PublicIpAddress> ipAddresses = Sets.newHashSet();
SERVICE: for (InternetService service : client.getAllInternetServicesInVDC(vApp.getVDC().getId())) {
for (Node node : client.getNodes(service.getId())) {
@ -210,7 +211,7 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl
*/
@Override
public void stop(URI id) {
VApp vApp = client.getVApp(id);
VCloudExpressVApp vApp = client.getVApp(id);
Set<PublicIpAddress> ipAddresses = deleteInternetServicesAndNodesAssociatedWithVApp(vApp);
deletePublicIpAddressesWithNoServicesAttached(ipAddresses);
if (vApp.getStatus() != Status.OFF) {
@ -229,14 +230,14 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl
logger.debug("<< deleted vApp(%s))", vApp.getName());
}
private void powerOffAndWait(VApp vApp) {
private void powerOffAndWait(VCloudExpressVApp vApp) {
logger.debug(">> powering off vApp(%s), current status: %s", vApp.getName(), vApp.getStatus());
Task task = client.powerOffVApp(vApp.getId());
if (!taskTester.apply(task.getLocation()))
throw new TaskException("powerOff", vApp, task);
throw new RuntimeException(String.format("failed to %s %s: %s", "powerOff", vApp.getName(), task));
}
void blockOnLastTask(VApp vApp) {
void blockOnLastTask(VCloudExpressVApp vApp) {
TasksList list = client.findTasksListInOrgNamed(null);
try {
Task lastTask = getLast(filter(list.getTasks(), new Predicate<Task>() {
@ -248,7 +249,7 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl
}));
if (!taskTester.apply(lastTask.getLocation()))
throw new TaskException("powerOff", vApp, lastTask);
throw new RuntimeException(String.format("failed to %s %s: %s", "powerOff", vApp.getName(), lastTask));
} catch (NoSuchElementException ex) {
}
@ -259,7 +260,7 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl
*/
@Override
public Set<String> getPrivateAddresses(URI id) {
VApp vApp = client.getVApp(id);
VCloudExpressVApp vApp = client.getVApp(id);
if (vApp != null)
return Sets.newHashSet(vApp.getNetworkToAddresses().values());
else
@ -271,7 +272,7 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl
*/
@Override
public Set<String> getPublicAddresses(URI id) {
VApp vApp = client.getVApp(id);
VCloudExpressVApp vApp = client.getVApp(id);
if (vApp != null) {
Set<String> ipAddresses = Sets.newHashSet();
for (InternetService service : client.getAllInternetServicesInVDC(vApp.getVDC().getId())) {

View File

@ -46,7 +46,7 @@ import org.jclouds.vcloud.VCloudExpressClient;
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
import org.jclouds.vcloud.compute.config.VCloudExpressComputeServiceContextModule;
import org.jclouds.vcloud.compute.strategy.VCloudDestroyNodeStrategy;
import org.jclouds.vcloud.compute.strategy.VCloudListNodesStrategy;
import org.jclouds.vcloud.compute.strategy.VCloudExpressListNodesStrategy;
import org.jclouds.vcloud.compute.strategy.VCloudRebootNodeStrategy;
import org.jclouds.vcloud.terremark.compute.TerremarkVCloudComputeClient;
import org.jclouds.vcloud.terremark.compute.TerremarkVCloudComputeService;
@ -97,7 +97,7 @@ public class TerremarkVCloudComputeServiceContextModule extends VCloudExpressCom
}).in(Scopes.SINGLETON);
// NOTE
bind(RunNodesAndAddToSetStrategy.class).to(TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy.class);
bind(ListNodesStrategy.class).to(VCloudListNodesStrategy.class);
bind(ListNodesStrategy.class).to(VCloudExpressListNodesStrategy.class);
// NOTE
bind(GetNodeMetadataStrategy.class).to(TerremarkVCloudGetNodeMetadataStrategy.class);
bind(RebootNodeStrategy.class).to(VCloudRebootNodeStrategy.class);

View File

@ -38,12 +38,12 @@ import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.domain.Credentials;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.CommonVCloudClient;
import org.jclouds.vcloud.compute.CommonVCloudComputeClient;
import org.jclouds.vcloud.VCloudExpressClient;
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
import org.jclouds.vcloud.compute.domain.VCloudLocation;
import org.jclouds.vcloud.compute.functions.FindLocationForResource;
import org.jclouds.vcloud.compute.functions.GetExtra;
import org.jclouds.vcloud.compute.strategy.VCloudGetNodeMetadataStrategy;
import org.jclouds.vcloud.compute.functions.GetExtraFromVCloudExpressVApp;
import org.jclouds.vcloud.compute.strategy.VCloudExpressGetNodeMetadataStrategy;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.terremark.compute.domain.KeyPairCredentials;
import org.jclouds.vcloud.terremark.compute.domain.OrgAndName;
@ -54,7 +54,7 @@ import com.google.common.base.Supplier;
* @author Adrian Cole
*/
@Singleton
public class TerremarkVCloudGetNodeMetadataStrategy extends VCloudGetNodeMetadataStrategy {
public class TerremarkVCloudGetNodeMetadataStrategy extends VCloudExpressGetNodeMetadataStrategy {
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL;
@ -62,10 +62,10 @@ public class TerremarkVCloudGetNodeMetadataStrategy extends VCloudGetNodeMetadat
private final ConcurrentMap<OrgAndName, KeyPairCredentials> credentialsMap;
@Inject
protected TerremarkVCloudGetNodeMetadataStrategy(CommonVCloudClient client, CommonVCloudComputeClient computeClient,
Map<Status, NodeState> vAppStatusToNodeState, GetExtra getExtra,
FindLocationForResource findLocationForResourceInVDC, Supplier<Set<? extends Image>> images,
ConcurrentMap<OrgAndName, KeyPairCredentials> credentialsMap) {
protected TerremarkVCloudGetNodeMetadataStrategy(VCloudExpressClient client,
VCloudExpressComputeClient computeClient, Map<Status, NodeState> vAppStatusToNodeState,
GetExtraFromVCloudExpressVApp getExtra, FindLocationForResource findLocationForResourceInVDC,
Supplier<Set<? extends Image>> images, ConcurrentMap<OrgAndName, KeyPairCredentials> credentialsMap) {
super(client, computeClient, vAppStatusToNodeState, getExtra, findLocationForResourceInVDC, images);
this.credentialsMap = credentialsMap;
}

View File

@ -54,7 +54,7 @@ import org.jclouds.vcloud.domain.NamedResource;
import org.jclouds.vcloud.domain.ResourceAllocation;
import org.jclouds.vcloud.domain.ResourceType;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
import org.jclouds.vcloud.domain.VDC;
@ -96,10 +96,10 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
private String publicIp;
private InternetService is;
private Node node;
private VApp vApp;
private VCloudExpressVApp vApp;
private RetryablePredicate<IPSocket> socketTester;
private RetryablePredicate<URI> successTester;
private VApp clone;
private VCloudExpressVApp clone;
private VDC vdc;
protected String credential;
public static final String PREFIX = System.getProperty("user.name") + "-terremark";
@ -365,7 +365,7 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
loopAndCheckPass();
}
private void verifyConfigurationOfVApp(VApp vApp, String serverName, String expectedOs, int processorCount,
private void verifyConfigurationOfVApp(VCloudExpressVApp vApp, String serverName, String expectedOs, int processorCount,
long memory, long hardDisk) {
assertEquals(vApp.getName(), serverName);
assertEquals(vApp.getOperatingSystemDescription(), expectedOs);

View File

@ -68,7 +68,7 @@ import org.jclouds.vcloud.terremark.xml.NodesHandler;
import org.jclouds.vcloud.terremark.xml.PublicIpAddressesHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler;
import org.jclouds.vcloud.xml.CatalogHandler;
import org.jclouds.vcloud.xml.VAppHandler;
import org.jclouds.vcloud.xml.VCloudExpressVAppHandler;
import org.testng.annotations.Test;
import com.google.common.base.Supplier;
@ -132,7 +132,7 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest<TerremarkEClo
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, VAppHandler.class);
assertSaxResponseParserClassEquals(method, VCloudExpressVAppHandler.class);
assertExceptionParserClassEquals(method, null);
checkFilters(request);
@ -155,7 +155,7 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest<TerremarkEClo
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, VAppHandler.class);
assertSaxResponseParserClassEquals(method, VCloudExpressVAppHandler.class);
assertExceptionParserClassEquals(method, null);
checkFilters(request);

View File

@ -80,7 +80,7 @@ import org.jclouds.vcloud.terremark.xml.NodesHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkCatalogItemHandler;
import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler;
import org.jclouds.vcloud.xml.CatalogHandler;
import org.jclouds.vcloud.xml.VAppHandler;
import org.jclouds.vcloud.xml.VCloudExpressVAppHandler;
import org.testng.annotations.Test;
import com.google.common.base.Function;
@ -181,7 +181,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends RestClientTest<Terrem
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, VAppHandler.class);
assertSaxResponseParserClassEquals(method, VCloudExpressVAppHandler.class);
assertExceptionParserClassEquals(method, null);
checkFilters(request);
@ -204,7 +204,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends RestClientTest<Terrem
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, VAppHandler.class);
assertSaxResponseParserClassEquals(method, VCloudExpressVAppHandler.class);
assertExceptionParserClassEquals(method, null);
checkFilters(request);

View File

@ -35,7 +35,7 @@ import org.jclouds.util.Utils;
import org.jclouds.vcloud.domain.ResourceAllocation;
import org.jclouds.vcloud.domain.ResourceType;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.internal.VAppImpl;
import org.jclouds.vcloud.domain.internal.VCloudExpressVAppImpl;
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressPropertiesBuilder;
import org.jclouds.vcloud.terremark.domain.VAppConfiguration;
import org.testng.annotations.Test;
@ -65,7 +65,7 @@ public class BindVAppConfigurationToXmlPayloadTest {
});
public void testChangeName() throws IOException {
VAppImpl vApp = new VAppImpl("MyAppServer6", URI
VCloudExpressVAppImpl vApp = new VCloudExpressVAppImpl("MyAppServer6", URI
.create("https://services.vcloudexpress/terremark.com/api/v0.8/vapp/4213"), Status.OFF, 4194304l,
null, ImmutableListMultimap.<String, String> of(), null, null, null, ImmutableSet.of(
new ResourceAllocation(1, "n/a", null, ResourceType.PROCESSOR, null, null, null, null, null,
@ -92,7 +92,7 @@ public class BindVAppConfigurationToXmlPayloadTest {
}
public void testRemoveDisk() throws IOException {
VAppImpl vApp = new VAppImpl("MyAppServer6", URI
VCloudExpressVAppImpl vApp = new VCloudExpressVAppImpl("MyAppServer6", URI
.create("https://services.vcloudexpress/terremark.com/api/v0.8/vapp/4213"), Status.OFF, 4194304l,
null, ImmutableListMultimap.<String, String> of(), null, null, null, ImmutableSet.of(
new ResourceAllocation(1, "n/a", null, ResourceType.PROCESSOR, null, null, null, null, null,
@ -121,7 +121,7 @@ public class BindVAppConfigurationToXmlPayloadTest {
}
public void testChangeCPUCountTo4() throws IOException {
VAppImpl vApp = new VAppImpl("eduardo", URI
VCloudExpressVAppImpl vApp = new VCloudExpressVAppImpl("eduardo", URI
.create("https://services.vcloudexpress/terremark.com/api/v0.8/vapp/4213"), Status.OFF, 4194304l,
null, ImmutableListMultimap.<String, String> of(), null, null, null, ImmutableSet.of(
new ResourceAllocation(1, "n/a", null, ResourceType.PROCESSOR, null, null, null, null, null,
@ -146,7 +146,7 @@ public class BindVAppConfigurationToXmlPayloadTest {
}
public void testChangeMemoryTo1536() throws IOException {
VAppImpl vApp = new VAppImpl("MyAppServer6", URI
VCloudExpressVAppImpl vApp = new VCloudExpressVAppImpl("MyAppServer6", URI
.create("https://services.vcloudexpress/terremark.com/api/v0.8/vapp/4213"), Status.OFF, 4194304l,
null, ImmutableListMultimap.<String, String> of(), null, null, null, ImmutableSet.of(
new ResourceAllocation(1, "n/a", null, ResourceType.PROCESSOR, null, null, null, null, null,

View File

@ -34,7 +34,7 @@ import javax.inject.Provider;
import org.jclouds.compute.domain.NodeState;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
@ -63,7 +63,7 @@ public class TerremarkVCloudComputeClientTest {
expect(template.getDescription()).andReturn(description).atLeastOnce();
TerremarkVCloudExpressClient client = createMock(TerremarkVCloudExpressClient.class);
VApp vApp = createMock(VApp.class);
VCloudExpressVApp vApp = createMock(VCloudExpressVApp.class);
expect(client.getVDC(vdcURI)).andReturn(vdc);
expect(client.getVAppTemplate(templateURI)).andReturn(template);
@ -88,7 +88,7 @@ public class TerremarkVCloudComputeClientTest {
expect(successTester.apply(taskLocation)).andReturn(true).atLeastOnce();
expect(client.powerOnVApp(vappLocation)).andReturn(task);
Predicate<VApp> notFoundTester = createMock(Predicate.class);
Predicate<VCloudExpressVApp> notFoundTester = createMock(Predicate.class);
Map<Status, NodeState> vAppStatusToNodeState = createMock(Map.class);
TerremarkVCloudComputeClient computeClient = new TerremarkVCloudComputeClient(client,

View File

@ -38,10 +38,10 @@ import org.jclouds.vcloud.VCloudExpressMediaType;
import org.jclouds.vcloud.domain.ResourceAllocation;
import org.jclouds.vcloud.domain.ResourceType;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VirtualSystem;
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
import org.jclouds.vcloud.xml.VAppHandler;
import org.jclouds.vcloud.xml.VCloudExpressVAppHandler;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@ -79,7 +79,7 @@ public class VAppHandlerTest extends BaseHandlerTest {
public void testApplyInputStream() {
InputStream is = getClass().getResourceAsStream("/terremark/launched_vapp.xml");
VApp result = (VApp) factory.create(injector.getInstance(VAppHandler.class)).parse(is);
VCloudExpressVApp result = (VCloudExpressVApp) factory.create(injector.getInstance(VCloudExpressVAppHandler.class)).parse(is);
assertEquals(result.getName(), "adriantest");
assertEquals(result.getStatus(), Status.UNRESOLVED);
@ -95,7 +95,7 @@ public class VAppHandlerTest extends BaseHandlerTest {
public void testGetVApp() throws UnknownHostException {
InputStream is = getClass().getResourceAsStream("/terremark/get_vapp.xml");
VApp result = (VApp) factory.create(injector.getInstance(VAppHandler.class)).parse(is);
VCloudExpressVApp result = (VCloudExpressVApp) factory.create(injector.getInstance(VCloudExpressVAppHandler.class)).parse(is);
assertEquals(result.getName(), "centos-53");
assertEquals(result.getStatus(), Status.OFF);
@ -133,7 +133,7 @@ public class VAppHandlerTest extends BaseHandlerTest {
public void testGetVApp2disks() throws UnknownHostException {
InputStream is = getClass().getResourceAsStream("/terremark/get_vapp2disks.xml");
VApp vApp = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
VCloudExpressVApp vApp = factory.create(injector.getInstance(VCloudExpressVAppHandler.class)).parse(is);
assertEquals(vApp.getName(), "eduardo");
assertEquals(vApp.getStatus(), Status.OFF);