Dasein Cloud and the vCloud API

By George Reese
January 20, 2010

A chief concern around an abstraction API like Dasein Cloud is that it risks becoming a "least common denominator" API. Consequently, one core objective in the design of Dasein Cloud is to make sure it provides a single Java mechanism for describing cloud concepts without being a "least common denominator" API. Dasein Cloud now supports a new, very different cloud API in the form of VMware's vCloud API. This support provides an excellent example of how Dasein Cloud is able to provide a rich experience for each cloud it supports without sacrificing abstraction.

On Abstraction

Before diving into the details of Dasein Cloud and vCloud, I'd first like to talk a bit about why abstraction is so important. A good abstraction API enables you to get access to a resource regardless of who is providing that resource without altering or recompiling your basic business logic. JDBC is an example of just such an API. Here's an example of some JDBC code:

public void update(Connection conn, long employeeId, String firstName, String lastName) throws SQLException {
    PreparedStatement stmt;
    String sql;

    sql = "UPDATE emp SET first_name = ?, last_name = ? WHERE employee_id = ?";
    stmt = conn.prepareStatement(sql);
    stmt.setString(1, firstName);
    stmt.setString(2, lastName);
    stmt.setLong(3, employeeId);
    stmt.executeUpdate();    
}

This same code works against MySQL, PostgreSQL, Oracle, Microsoft SQL Server, and many other database engines without a recompile. In fact, depending on the way you architect the application, this code can be going against different databases without even restarting your application.

Dasein Cloud is an Open Source Java API that enables programmers to abstract away from the idiosyncrasies of individual clouds and write applications capable of leveraging any cloud without rewrite or recompile. Last August, I wrote an article introducing Dasein Cloud with an example of how you can write code to grab a list of servers from any cloud.

Abstraction Does Not Require Feature Reduction

People often fear abstraction APIs because of the "least common denominator" factor. In other words, there's always the worry that the API designer is achieving abstraction by supporting only features common to all platforms. As JDBC showed, you can provide a rich abstraction layer without reducing everything to only the features supported by all.

Dasein Cloud achieves this impact first by defining an array of services that cloud providers might support. An application can request any service from any cloud provider, but it should be prepared to handle a null value in return if that service is not supported. In the vCloud implementation, for example, we don't yet have a mechanism for describing content distribution (CDN) services. The vCloud implementation of Dasein Cloud thus returns null when an application requests CDN services from Dasein Cloud.

enStratus—a cloud infrastructure management system built on Dasein Cloud—uses this information to decide what interface it should provide users. If no CDN service is returned from Dasein Cloud, for example, it will not display the CDN management screens when a user is managing that cloud.

Within a given service, there are naturally differences from cloud to cloud in how it supports the details of being a cloud provider. In the situations where these differences are significant, Dasein Cloud provides meta-data API calls to help applications auto-discover the features of the underlying cloud. enStratus uses the following Dasein Cloud calls to determine whether it should allow IP address assignment as is done in AWS or forwarding as is done in vCloud:

AddressServices svcs = provider.getAddressServices();

if( svcs.isForwarding() ) {
  // display menu for forwarding IP addresses
}
if( svcs.isAssigned() {
  // display menu for assigning IP addresses to a server
}

This logic does not ask of the underlying cloud is vCloud or if it is Amazon Web Services (AWS), but it instead asks if the cloud supports specific features and acts on that support. As a result, this same forwarding logic supports all clouds that support forwarding, not just the vCloud API. You didn't even need to know the cloud existed when you wrote your code.

Sometimes the implementation of an API helps hide the differences between clouds so applications are not constantly burdened with conditional logic. As an example, vCloud provides much richer meta-data than does Amazon Web Services. AWS doesn't support servers having names, yet vCloud does. The vCloud implementation of Dasein Cloud provides this server name for server.getName(), whereas the AWS implementation provides the AWS instance ID.

Pulling It Together

A good abstraction API provides a common representation of a concept within a domain. As an API for representing a set of cloud services, enStratus provides common representations of clouds concepts, including:

  • Server
  • ServerImage
  • Distribution
  • Volume
  • Snapshot
  • Firewall
  • IpAddress
  • RelationalDatabase
  • LoadBalancer
  • Region
  • DataCenter
  • CloudFile

Dasein Cloud provides access to most—if not all—functionality behind each of these concepts in the clouds it supports without requiring you to write any cloud-specific code. The vCloud integration is no different. Though the underlying vCloud API is very different from other cloud APIs, we didn't have to add anything new to the core Dasein Cloud libraries—just an implementation for vCloud. As a result, applications like enStratus using Dasein Cloud are able to immediately leverage any cloud based on vCloud like Terremark's vCloud Express without the need to change the underlying source code to those applications.


You might also be interested in:

News Topics

Recommended for You

Got a Question?