Microsoft azure – Determining VM State

Microsoft azure platform provides a lot of exciting features and is very much as par with competition from AWS and google. However, there remain a few questions around the documentation and examples offered by the platform for developers – or maybe just for JAVA developers in particular who use the Azure java SDK.

 

In particular, I found some difficulty dealing with async VM launches and determining VM states accurately. The SDK team has been very helpful in providing examples and getting in touch for answering questions regarding the SDK. I am sharing here some code snippet which may be helpful to other developers treading the same path.

 

The method given below shows how you can read and categorize a VM’s state to a concrete tangible machine state.

 

[ccie_html]

 

private void determineVMState(VirtualMachine instance)
{
PowerState instanceState = instance.powerState();
String instanceProvisionState = instance.provisioningState();

if(instanceProvisionState.equalsIgnoreCase(ProvisioningState.CREATING.name()))
{
// Instance is in pending state and is starting up
}
else if(instanceProvisionState.equalsIgnoreCase(ProvisioningState.SUCCEEDED.name()) && instanceState.toString().equalsIgnoreCase(PowerState.RUNNING.toString()))
{
// Instance is up and running
}
else if(instanceProvisionState.equalsIgnoreCase(ProvisioningState.DELETING.name()))
{
// Instance is terminating
}
else if(instanceProvisionState.equalsIgnoreCase(“Updating”) && instanceState.toString().equalsIgnoreCase(“PowerState/stopping”))
{
// Instance is stopping
}
else
{
// unknown state
}
}

 

[ccie_html]

 

Note how an azure instance state is a combination of PowerState and ProvisingState. You need to read both values and then determine its tangible state using the combination of the two values. For my use case, I have evaluated the combination into four states which mimic the AWS instance states. You can always imply more instance states as per your needs.

FLPlayer – Free OSMF based RTMP live stream player for Android

FLPlayer is a OSMF based simple application for playing flash based live video streaming content to android devices. FLPlayer works with popular streaming servers like Flash media server, Wowza media server or Red5 media server to play live video content. FLPlayer is suitable for both business to consumer redistribution and/or first hand usage.

(more…)

How to watch hindi movies for free on android !!

Watching free movies on android is the best thing to do when you are getting bored. the process described below tell you how to watch videos without annoying popups and spam (more…)

Compose – free greetings and fun image generator for android platform

Compose is a greetings and fun image generating application that lets you build brilliant e-greetings and fun images without any technical knowledge or skills. Its a perfect companion for both kids and parents. Generate funky images, greetings and share with friends and family over social networks, bluetooth, email and more.

(more…)