Quantcast
Channel: VMware Communities : Popular Discussions - VIX API
Viewing all articles
Browse latest Browse all 34639

unable to connect to host using VIX API with Perl

$
0
0

Hi

 

The envrionment we have is Vsphere with VCenter 4.1. I am attemping to make a connectiion to vcenter using VIX API with Perl.(End goal being able to create a vm on a node).

 

I am not successful with the connection. Per VIX API ref link-http://www.vmware.com/support/developer/vix-api/vix18_reference/

I am supposed to use $hostType=VIX_SERVICEPROVIDER_VMWARE_VI_SERVER for vCenter Server, ESX/ESXi hosts, and VMware Server 2.0. When i try this I get  an error-

Failed to get property type for 3010 on handle 16799219.
HostConnect() failed, 22003 The specified service provider was not found

 

and when i changed the $hostType=VIX_SERVICEPROVIDER_VMWARE_SERVER, I get the following error-

HostConnect() failed, 16 The system returned an error. Communication with the virtual machine may have been interrupted

Here is the sample perl script I wrote which I am running from linux (a virtual machine with VIXAPI 1.7 on 32-bit kernel)

 

#!/usr/bin/perl


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

my $err = VIX_OK;
my $hostHandle = VIX_INVALID_HANDLE;
my $apiVersion="1.7";
my $hostType= VIX_SERVICEPROVIDER_VMWARE_SERVER;
#my $hostType= VIX_SERVICEPROVIDER_VMWARE_VI_SERVER;
my $hostName= 'https://vcenter.domain.com/sdk';
my $hostPort= 0;
my $userName= "myusername";
my $password= "mypwd";
my $options = 0;
my $propertyListHandle = VIX_INVALID_HANDLE;


($err, $hostHandle) = HostConnect($apiVersion,
                                  $hostType,
                                  $hostName,
                                  $hostPort,
                                  $userName,
                                  $password,
                                  $options,
                                  $propertyListHandle);


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


Viewing all articles
Browse latest Browse all 34639

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>