Hello All,
I just set up VMWare Server 2.0 (Build 122589) on an Ubuntu 7.10 box, and am attempting to get started with the VIX Perl API. Unfortunately, I'm stuck very early in the process - specifically, at getting a handle to a VM - and I'm hoping that my issue is as obvious as I suspect.
Basically, I can connect to the host itself, but when I call VMOpen, I'm getting this error:
VMOpen() failed, 9 An error occurred while accessing a file: wrong file type
Here's the code in question:
-
#!/usr/bin/perl
use VMware::Vix::Simple;
use VMware::Vix::API::Constants;
use strict;
my $err = VIX_OK;
my $hostHandle = VIX_INVALID_HANDLE;
my $vmHandle = VIX_INVALID_HANDLE;
($err, $hostHandle) = HostConnect(VIX_API_VERSION,
VIX_SERVICEPROVIDER_DEFAULT,
10.4.11.194, # hostName
902, # hostPort
"myuser", # userName
"mypass", # password
0, # options
VIX_INVALID_HANDLE); # propertyListHandle
die "HostConnect() failed, $err ", GetErrorText($err), "\n" if $err != VIX_OK;
($err, $vmHandle) = VMOpen($hostHandle, "/home/vmware/Windows\ XP\ SP2/Windows\ XP\ SP2.vmx");
die "VMOpen() failed, $err ", GetErrorText($err), "\n" if $err != VIX_OK;
...Do everything in your program...
HostDisconnect($hostHandle);
-
I suspect that my problem is the spaces in the path to the VMX file, given that I don't see spaces in anyone else's paths while browsing this forum. If I'm correct, is there some other way of escaping out the spaces that I can use to connect to my existing VMs with spaces in their names? Or will I need to modify them to remove the spaces from their names (if so, how?), or even create new VMs (there's not that much on the machines in question, I'd just prefer to avoid rebuilding if I can)?