VMware {code} Community
denz07
Contributor
Contributor

problem with powerOn() on vix api 1.6

Hi,

We badly need help. We need to powerOn a virtual machine on the localhost. This is the code we made:

#!/usr/bin/perl

use strict;

use VMware::Vix::Simple;

#all constants are exported

use VMware::Vix::API::Constants;

my $err = VIX_OK;

my $hostHandle = VIX_INVALID_HANDLE;

my $vmHandle = VIX_INVALID_HANDLE;

($err, $hostHandle) = HostConnect(VIX_API_VERSION,

VIX_SERVICEPROVIDER_VMWARE_VI_SERVER,

"https://localhost:8333/sdk", # hostName

443, # hostPort

"xxxxx", # userName

"yyyyy", # password

0, # options

VIX_INVALID_HANDLE); # propertyListHandle

die "HostConnect() failed, $err ", GetErrorText($err), "\n" if $err != VIX_OK;

  1. Do everything in your program...

($err, $vmHandle) = VMOpen($hostHandle,

"[MobiDatabase] /home/jp/WindowsXP/WindowsXP.vmx");

die "VMOpen() failed, $err ", GetErrorText($err), "\n" if $err != VIX_OK;

$err = VMPowerOn($vmHandle,

VIX_VMPOWEROP_NORMAL, # powerOnOptions

VIX_INVALID_HANDLE); # propertyListHandle

die "VMPowerOn() failed, $err ", GetErrorText($err), "\n" if $err != VIX_OK;

However, I read something on vix 1.6 release notes saying that there is an issue discoveredwith vix 1.6 which is:

Power-on is not recognized while a virtual machine is open.

If you open a powered-off virtual machine with VixVM_Open()

and subsequently power-on that virtual machine,

the change is not reflected by VIX_PROPERTY_VM_POWER_STATE.

Power-off can be recognized when the automation socket closes,

but power-on cannot be recognized.

But, it said it was for vix api 1.6 on vmware workstation 6.5.1.

We are currently using vmware server 2.0. Does this issue also have an

effect on vmware 2.0?

If not, is there a problem with the code

given above which is why we can't powerOn a virtual machine on the

localhost? please help..

Oh yeah.. we're also using a linux host machine..

0 Kudos
1 Reply
dblock
Enthusiast
Enthusiast

If I read your post correctly you have VMWare Server, not VMWare Virtual Infrastructure (VI/ESX). Your connect function needs to take a different parameter: VIX_SERVICEPROVIDER_VMWARE_SERVER and specify no host or "localhost" for a local installation.

0 Kudos