Tag Archives: ESXi

Just a quick post to contrast my sceptical post about the new vRO from friday :). You’ve probably heard about this already but Etienne Le Sueur and George Estebe from VMware created an embedded host client for ESXi. The client is available as a fling and it is amazing. Oh and there is a new version available since 20th of december. This one can also update the ESXi host the client is running on.

Installation is really simple. The client is downloadable as a vib and you can install it directly on an ESXi host. Instructions here. The client is fully HTML5 so no flash or other client side stuff needed. And the best thing is: it’s really fast and works very well. So if you haven’t tried it yet you really should!

I’m glad to see that VMware is still able to produce high quality products. Hopefully this trend will cont….. no I won’t rant this time., let’s keep it peaceful this time of the year.

Last week CoreOS released an OS image which included the open-vm-tools. Of course it was possible to run CoreOS on VMware before, but something was missing. With the addition of the open-vm-tools CoreOs is now fully supported on all VMware products. This includes vSphere 6 and vCloud Air.

I happened to be working on my demo for the Dutch VMUG UserCon which involves CoreOS as well. So I decided to give it a go as soon as the image was released. And it turns out it works perfectly. I no longer have to build sleeps in my workflows, I can just wait until the VMware Tools are online and then continue the workflow. This makes deploying CoreOS much more efficient and reliable. Aslo, the gracefull shutdown finally works which prevents the OS from getting corrupted when I have to force a reboto from a workflow.

I ‘ll write in more detail about my automated CoreOS deployment in the coming weeks. If you happen to live in the Netherlands then come and see our demo and presentation this thursday (19-march-2015) at the Dutch VMUG UserCon.

Want to get started with CoreOs yourself? check out this blog post for instructions on how to do this on VMware Fusion. Want to run on vSphere? Here is what I do to download the image on a linux machine and get it to vSphere.

When you work with vCenter Orchestrator as a standalone tool you can just use an object as an input. When you start the workflow it knows what kind of object you are looking for and it presents you with a browser to find an object. But what if you just have the hostname as a string? How do you find a host by name in vCO?

For this example I assume we are looking for an ESXi host in a vCenter inventory. When you run a workflow which requests and input with VC:HostSystem as the type vCO shows you a nice browser to find it. But what if you are using vCO as part of a tool chain? Maybe you are receiving messages on an AMQP Queue or the vCO workflow is called from vCAC. Then you’ll only receive plain text, not objects. And you can’t promt the user for an object because that would take the “auto” out of “automation”.

Here is a scenario: You have the hostname of an ESXi host as a string with the name “inHostname”. Now you want to get the object for that host so you can use it in vCO actions and workflows or get more information about the host. Unfortunately there is no worfkflow or action that can do this for you. So let’s build one. The screenshot below shows the input:

The first thing we need is a list of hosts in which we want to search for our specific hostname. Depending in the situation you might want to get a list of all hosts in vCenter or just the hosts in a specific cluster. Let’s query all hosts in vCenter for this example. The action we need for this is called “getAllComputeResourceForVimHost”. This action needs a vCenter server object as an imput. For this example we will use an attribute and “Hardcode” the value in the workflow.

As you can see in the screenshot above, the output of the action is stored in the variable “allHosts”. This is an array of host objects. The hostname of the host is in the .name propery. So the hostname of the first host can be found like this: allHosts[0].name

So how do we find the host we are looking for in this array? Let’s insert a scripting object, set “inHostname” and “allHosts” as input and “myHost” as output.

now “myHost” contains the host object we are looking for.
That’s it, you can stop reading. Unless you want to know what’s going on.

We are seeing two functions at work which are actually methods of the array class: .map() and .indexOf(). The map method executes a function, which is passed as an argument, on every element in the array and returns the result as an array. The code below returns an array of strings containing all the hostnames.

1

varallHostnames=allHosts.map(function(e){returne.name;});

You can retrieve the hostname of the first host like this: allHostnames[0];
Next thing we need to figure out is in which element of the array our host is stored.

1

varhostIndex=allHostnames.indexOf(inHostname);

With this index we can find the host object we need:

1

myHost=allHosts[hostIndex];

And there you have it. You found a host by hostname in just two lines of code and at the same time learned a bit about the map part of MapReduce.

Recent Posts

Automate-IT Archive

Chris already works with virtualization products since 2004 and since this time he developed into a real expert. Chris works for ITQ and one of his passions is to share his knowledge and use all of his experience to find the best solution for his customers.