Thursday, 7 January 2010

VMware Server 2.0.2 and it's use of datastores

If you're like me (!), and prefer scripts to GUIs, then you might find this to be of some use.

I've recently written some scripts for my VMware Server environment to register, start, stop and list VMs. I'm using VMware Server on Ubuntu 9.10 64-bit, and use it to run products such as Lotus Connections, WebSphere Portal etc.

Here're the scripts: -

vmrun -t server -h https://orac:8333/sdk -user root -password passw0rd register "[standard] $1/$1.vmx"

vmrun -t server -h https://orac:8333/sdk -user root -password passw0rd start "[vmwares] $1/$1.vmx"

vmrun -t server -h https://orac:8333/sdk -user root -password passw0rd start "[vmwares] $1/$1.vmx"

vmrun -t server -h https://orac:8333/sdk -user root -password passw0rd list

and, for Lotus Connections especially, there's this one: -

./ Domino
./ DB2
./ Connections

Now, most of these scripts have one thing in common; they all refer to "[vmwares]" which is an alias that points to the physical directory (in my case, this is  a mount point called /vmwares that points to a 1 TB SATA2 internal drive ).

The path is set by the script *BUT* the alias is not; it's set to a default of standard by a configuration file; /etc/vmware/hostd/datastores.xml.

This meant that my scripts were failing - in the case of, I was seeing: -

Error: The virtual machine cannot be found

Therefore, in my case, I've amended this file to reflect the alias as vmwares rather than standard as follows: -

<e id="0">

In other words, I've changed: -


to: -


PS It's worth noting that, depending upon your environment, you may also have a NEW_datastores.xml as well as the original datastores.xml file. Be aware that the NEW file takes precedence over the original version; therefore, ensure that you modify the right version.

The simplest trick is to change the file and then restart VMware Server via the command: -

service vmware stop
service vmware start

or: -

service vmware restart

Check the amended configuration file to ensure that the new alias has been picked up.

No comments:

Grokking grep

A colleague was tinkering with grep  and, thanks to him, I discovered a bit more about the trusty little utility. I had not really explored ...