Jul 07 2014

It turns out I was wrong. Nutanix already has a Java SDK!

It turns out I was wrong and the Nutanix engineering team has amazed me once again. Yesterday I wrote about my efforts in creating a Java SDK based on Nutanix REST API (Nutanix Java SDK for Open-Source Community).

After publishing post and making the source code available via GitHub a member of the engineering team reached out to me saying that Nutanix already had a Java SDK. I went – Where is it? Where is it? And he told me that its is already shipping with Nutanix.

It turns out that in NOS 4.0 there is a Download nCLI option that will download zip file containing the ncli.cmd and some extra .jar files under the lib folder. There you will find prism_sdk_rest.jar, the Nutanix Java SDK that uses PRISM APIs.

 

prism_api_download_cli                 prism_ncli_folder

 

I am now targeting the creation of an official documentation to help administrators and engineers to operate Nutanix clusters using Java automation. Keep tuned!

I have not  had the time to use the library, other than instantiate few objects, but I thought would be beneficial to share with people implementing automation on top of Nutanix. Since there is already a Java SDK I will re-focus my SDK work to deal with more complex integrations between Nutanix and other systems, like vSphere, SCVMM, Puppet, Backup tools, run-book automation tools etc.

 

Screen Shot 2014-07-07 at 10.17.32 PM

 

…and soon I will also publish some code samples of how to use the existing Java PRISM SDK.

 

This article was first published by Andre Leibovici (@andreleibovici) at myvirtualcloud.net.

Permanent link to this article: http://myvirtualcloud.net/?p=6451

Jul 06 2014

Nutanix Java SDK for Open-Source Community

I am always tinkering with new projects to keep me busy and more recently I started working on an integration between my VDI Calculator and Nutanix PRISM API. The whole idea is to be able to collect information from Nutanix and pre-fill the calculator with important data to forecast growth and run a capacity management analytics for large VDI environment. This is still in the works, but for that end I created a small amount of code to allow my application to interact with the Nutanix PRISM API using Java.

[UPDATE] It turns out I was wrong. Nutanix already has a Java SDK! http://myvirtualcloud.net/?p=6451

Nutanix offers today a fully featured REST API and Powershell SDK. I quickly realized that having this code in a consumable manner would allow DevOps engineers to create their own Java automation and integrations with the Nutanix platform.

I externalized the code and created the underpinnings for a Java SDK. This is an initial and very simple release and I will contribute more overtime. The code is governed by GNU General Public License and is intended to guarantee your freedom to share and change the software.

You are free to contribute and upstream code improvements and additions. I am also thinking about extending this SDK to allow tight integration with other systems, like vSphere, SCVMM, Puppet, Backup tools, run-book automation tools etc…

The SDK uses Apache Commons HttpClient project to interact with Nutanix PRISM REST API  and Google’s json-simple Toolkit to encode or decode JSON text.

Nutanix-Prism-Java-SDK is hosted in GitHub (here)

If you want to use the SDK in your Java project just download and add Nutanix_Prism_Java_SDK_v1_0.jar into your Java application building path and instantiate objects. I have implemented Connection, Hosts, Vm and VirtualDisks classes, but I have only included few methods in each class, mostly ‘Get’.

 


		final com.nutanix.prism.Connection prismConnect = new Connection();
		final com.nutanix.prism.Hosts prismHost = new com.nutanix.prism.Hosts();
		final com.nutanix.prism.Vm prismVm = new com.nutanix.prism.Vm();
		final com.nutanix.prism.VirtualDisks prismVirtualDisk = new com.nutanix.prism.VirtualDisks();
		prismConnect.connect("IP_Address", "admin:admin");
		System.out.println(prismVm.getVms());
		System.out.println(prismHost.getHosts());
		System.out.println(prismVirtualDisk.getVirtualDisks());
		System.out.println(prismVm.getVm("vmName"));
		prismConnect.disconnect();

 

One of the challenges I faced in my Nutanix lab environment was a self-signed certificate, so I implemented a function that ignores the original self-signed certificate. While this is a very bad coding and security practice I am not planning to implement a valid certificate in my lab environment. I suggest that you implement a valid signed certificate from a trusted root CA authority in your production Nutanix environment. For a next code update I will make sure it’s possible to specify if the connection should be trusted or not.

 


	/**
	 * Ignore SelfSigned Certificate
	 *
	 * @return SSLConnectionSocketFactory */
	protected static final SSLConnectionSocketFactory verifyHostname() {

		final SSLContextBuilder builder = new SSLContextBuilder();
		SSLConnectionSocketFactory sslsf = null;

		try {
			builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
		} catch (final NoSuchAlgorithmException e) {
			return null;
		} catch (final KeyStoreException e) {
			return null;
		}

		try {
			sslsf = new SSLConnectionSocketFactory(builder.build(),
					SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
		} catch (final KeyManagementException e) {
			return null;
		} catch (final NoSuchAlgorithmException e) {
			return null;
		}

		return sslsf;
	}

 

This article was first published by Andre Leibovici (@andreleibovici) at myvirtualcloud.net.

Permanent link to this article: http://myvirtualcloud.net/?p=6442

Jul 03 2014

Nutanix One-Click Upgrade Demo Video (Simple & Easy)

As the name says, it’s a One-Click NOS upgrade for the entire Nutanix cluster. Nutanix one-click upgrade automatically indicates when a new NOS version is available and it will auto-download the binaries if the auto-download option is enabled. With a single-click to upgrade all nodes in a cluster Nutanix will use a highly parallel process and reboot one CVM at a time using a rolling upgrade mechanism. The entire cluster upgrade can be fully monitored by the administrator.

During the upgrade process a feature called Autopathing kicks in redirecting VM I/Os on that Hypervisor host to another CVM (Nutanix Controller) on a different hypervisor host. This has several benefits including allowing you to upgrade the NOS on a CVM without disruption.

The new and improved CVM AutoPathing 2.0 prevents performance loss during rolling upgrades minimizing I/O timeout by pre-emptively redirecting storage traffic to other CVMs. Failover traffic is automatically load-balanced with the rest of the cluster based on node load.

Simple and Easy – Consumer-grade technology applied to enterprises while hiding all the complexity. As my colleague Michael Webster says it best…
 

Screen Shot 2014-07-03 at 11.59.21 AM

 
[Watch in 1080p full-screen]


 
This article was first published by Andre Leibovici (@andreleibovici) at myvirtualcloud.net.

Permanent link to this article: http://myvirtualcloud.net/?p=6433

Older posts «

» Newer posts