2007 January

VMware Virtual Machine shutdown, startup, etc….

So I did some additional testing on the claim that vmware-cmd will not shutdown a VM that is locked at the console and I have not experienced the problem what I did find was the bash scripts that scripts that worked on my ESX 2.x server did not work on my VMware Server machine – it appears that _spaces_ in the directory structure and/or vm file name cause the script to fail.

These are examples of the original scripts:

getstate.sh
#!/bin/bash
echo “Getting running state of VM Guests…”
for vm in `vmware-cmd -l`
do
vmware-cmd “$vm” getstate $vm
done

stopall.sh
#!/bin/bash
echo “Stopping all running VM Guests…”
for vm in `vmware-cmd -l`
do
vmware-cmd “$vm” stop trysoft hard
done

The results on my ESX 2.x server for getstate.sh is the following:
getstate(/home/bocchrj/vmware/rh62_1/linux.vmx) = off
getstate(/home/bocchrj/vmware/rh62_2/linux.vmx) = off


On my VMware Server box this is the output of getstate.sh:
Getting running state of VM Guests…
/usr/bin/vmware-cmd: Could not connect to VM /Virtual_Machines/Windows
  (VMControl error -11: No such virtual machine: The config file /Virtual_Machines/Windows is not registered.
Please register the config file on the server.  For example:
vmware-cmd -s register “/Virtual_Machines/Windows”)
/usr/bin/vmware-cmd: Could not connect to VM XP
  (VMControl error -14: Unexpected response from vmware-authd: Invalid pathname: XP)
/usr/bin/vmware-cmd: Could not connect to VM Professional
  (VMControl error -14: Unexpected response from vmware-authd: Invalid pathname: Professional)
/usr/bin/vmware-cmd: Could not connect to VM SNMP
  (VMControl error -14: Unexpected response from vmware-authd: Invalid pathname: SNMP)
/usr/bin/vmware-cmd: Could not connect to VM Tools/Windows
  (VMControl error -14: Unexpected response from vmware-authd: Invalid pathname: Tools/Windows)
/usr/bin/vmware-cmd: Could not connect to VM XP
  (VMControl error -14: Unexpected response from vmware-authd: Invalid pathname: XP)
/usr/bin/vmware-cmd: Could not connect to VM Professional.vmx
etc…..

I took the time to write a slightly more robust perl script to stop and start VMs that appears to work well on both ESX 2.x and VMware Server (I only tested this on VMware server running on on a Linux host but it should work on a Windows host with perl installed).  If you would like an executable (exe) version for windows Email me and I can provide it to you.

#!/usr/bin/perl -w
#vmpower.pl
#RJB – 1/23/2007

use strict;
my $command;
my $switch;

if ($ARGV[0] eq “help”) {
    &usage;
    }
if ($ARGV[0] eq “getstate” || $ARGV[0] eq “stop” || $ARGV[0] eq “start” || $ARGV[0] eq “reset”) {
    &power;
    }
else{
    &error;
    }

sub power {
$command = “vmware-cmd -l”;
print “==> $command\n”;
if (system(“$command > .vmtmpfile”) == 0) {
  print ” success, exit status = $?\n”;
} else {
  print ” failure, exit status = $?\n”;
}

open (VM, ‘.vmtmpfile’);
while (<VM>) {
chomp;
$command = “vmware-cmd”;
$switch = $ARGV[0];
print “==> $command \”$_\” $ARGV[0]\n”;
system(“$command \”$_\” $switch”);
    if ( $? == 0 ) {
      print ” success, exit status = $?\n”;
    } else {
      print ” failure, exit status = $?\n”;
    }
}
close (VM);
system (“rm -f .vmtmpfile”);
}

sub usage {
system “clear”;
print “VM statup and shutdown script for ESX 2.x and VMware Server\n”;
print “vmpower.pl\n\n”;
print “Usage:  vmpower.pl [getstate|start|stop|reset]\n\n”;
exit;
}

sub error {
    print ” error\n”;
    print ” \”vmpower.pl help\” – for usage instructions\n\n”;
    exit;
}

By rbocchinfuso on January 23, 2007 | General Discussion, VMware | 3 comments

Shutting down a Windows VM when the console is locked

It was brought to my attention that vmware-cmd can not gracefully shutdown a Windows VM when the console is locked.  Yesterday I spent sometime researching the issue and the guys at Sysinternals once again have coded a quality utility that appears to have solved the problem.  I only hope that they can maintain the same level of quality now that Microsoft has acquired them.

Download psshutdown here

To shutdown a single host the syntax looks like this:
psshutdown \\host -t 5 -f -m “Shutting down in 5 seconds”

To shutdown multiple hosts psshutdown takes input from a file (e.g. – hosts.txt)  where the host names or IP are separated by a .:
psshutdown @hosts.txt -t 5 -f -m “Shutting down in 5 seconds”

To shutdown a single host when not logged in as a privileged user you will need to pass credentials to the the psshutdown command:
psshutdown @hosts.txt -t 5 -f -m “Shutting down in 5 seconds” -u administrator -p password

The standard windows cli shutdown command also works if you use the force option (-f).  The thing I really like about psshutdown is the ability to pass a file with a list of hosts and the ability to pass user credentials.

Download problem

It appears that Tom OToole is having some problems downloading the BackupPC Virtual Appliance.  Tom thanks for the feedback.  The direct link embedded in the post should not require flash.  Nonetheless I will now also include a direct link to the file in future posts.  Enjoy!

Download BACKUPPC_VA.tar.gz

BackupPC Virtual Appliance

So, I landed in California about 3.5 hours ago and headed out to grab some dinner. Just so happened that I wondered into the kick-off party for “The Real Housewives of Orange County”… Nonetheless I made it back to the hotel after consuming some sushi to get the BackupPC virtual appliance posted to the Files sections. Let me know how the virtual appliance works, the install and configuration instructions are documented in the “Open source backup and data de-duplication virtual appliance”post.

[tags]virtual appliances de-dupe backup recovery backuppc[/tags]

By rbocchinfuso on January 17, 2007 | Virtual Appliances | 1 comment

Hacking the Red Train theme

I spent a long time last night reworking my Wordpress theme after trying a number of other themes that were either buggy or not very visually appealing.  I think the new look should work well, I was really tired of the red.  Please let me know what you think, there is a poll at the bottom of the page.

Also you may be wondering where to download the BackupPC virtual appliance from, well I have to figure out how I am going to host it.  I should have it up later today or tomorrow.

[tags]wordpress backuppc theme[/tags]

By rbocchinfuso on January 16, 2007 | General Discussion | A comment?

Get Adobe Flash playerPlugin by wpburn.com wordpress themes

This site is protected with Urban Giraffe's plugin 'HTML Purified' and Edward Z. Yang's Powered by HTML Purifier. 182 items have been purified.