VMware {code} Community
schnarff
Contributor
Contributor

Spaces In Path To VMX File Causing Problems?

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;

  1. ...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)?

Tags (3)
0 Kudos
1 Reply
stanguturi
VMware Employee
VMware Employee

I don't think there is any issue with the spaces in the VMX file path.

Can you please upload the vix log file from /tmp/vmware-<username>/vix-<pid>.log location.

Also, make sure that a .vmx file exists at /home/vmware/Windows XP SP2/Windows XP SP2.vmx with proper rwx permissions.

-Thanks

Sankar.

0 Kudos