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

Python Module for the VIX API

$
0
0

I started a python module for the VIX API.  It is very immature and I've just started it last night.  Parts of it are working and other parts are a work in progress.  Currently the entire VIX API has been completed and is callable from the class provided.  I am currently working on providing a more simple class interface to utilize VIX. 

 

You can grab the code here:

 

https://github.com/diffuse/pyvix/blob/master/pyvix.py


Easiest Way to Use VIX from PowerShell?

$
0
0

I need to write a Windows PowerShell script to deploy a Linux VM from a template, assign the network adapters to particular networks, start the VM, copy some files to the VM, execute a script on the VM, and copy files back from the VM.  (Note that at the time that we need to copy the files and start the scripts, the NICs on the VM are not yet fully configured, so the VM cannot be reached over the network through SSH.)

 

My impression is that all these functions can be accomplished through VIX, but it is not obvious how best to use VIX from PowerShell.

 

1.One of my coworkers has been calling vmrun.exe from PowerShell, but vmrun.exe is actually intended as a command line interpreter for VIX, not as an API for script callers.

2. It appears that the COM interface to VIX should be usable from PowerShell, but I can't find any example scripts that do this. My best hope along these lines is to take the VMScript example from the VIX SDK and try translating it into a PowerShell script.

3. Then I found a blog entry at http://blogs.vmware.com/vix/2008/12/call-vix-more-easily-from-net-plus-powershell-goodness.html that suggests using a wrapper library that someone wrote to make it easy for .NET clients to talk to VIX. But I don't want to get involved in the legalities of redistributing or reimplementing this library, and I also don't understand why it would be better than just using the COM interface to VIX.

 

I don't have much time to implement this, so I'll have to go with the kludge of calling vmrun.exe unless I can quickly find an alternative.

 

Thanks for any suggestions! Josephhttp://blogs.vmware.com/vix/2008/12/call-vix-more-easily-from-net-plus-powershell-goodness.html

Create Vmci Socket in c#

$
0
0

Hello,

I want to create a socket between host and guest in C#...

I have a little problem.. I not find the dll that i need to use

 

Can someone help?

I dont have files in C:\ProgramFiles\CommonFiles\vmware...

My only file is Vmci_Sockets.h

 

where can i find the dll??

 

Thank you!!

Getting "VMware Tools are not running in the guest" from VIX, but tools are running

$
0
0

I'm having an issue with a Perl VIX script that I am writing. I am connecting to a VM, I wait for the VMWare tools using VMWaitForToolsInGuest, and then I execute a VBScript. After about 15 minutes, I get an 3016 error code "VMWare Tools are not running in the guest", but if I check the VM manually, the tools are running. Does anyone have any clue as to why I might get this error if the tools are running?

 

Below is the code that I am using. I am able to connect to the VM before this in the same script without error. The error occurs during the last VMRunProgramInGuest.

 

Any help would be greatly appreciated.

 

Thanks,

 

Andy


print Time(), "Connecting to host...";
$err, $hostHandle) = HostConnect(      VIX_API_VERSION,      VIX_SERVICEPROVIDER_VMWARE_WORKSTATION,      $hostName, # hostName      0, # hostPort      $userName, # userName      $password, # password      0, # options      VIX_INVALID_HANDLE); # propertyListHandle
CheckError("HostConnect() failed");
print "Connected\n";
print Time(), "Opening VM...";
($err, $vmHandle) = VMOpen(      $hostHandle,      "$vmName");
CheckError("VMOpen() failed");
print "Opened\n";

print Time(), "Powering on VM...";
$err = VMPowerOn(
      $vmHandle,      VIX_VMPOWEROP_LAUNCH_GUI, # powerOnOptions      VIX_INVALID_HANDLE);  # propertyListHandle
CheckError("VMPowerOn() failed");
print "Powered on\n";

print Time(), "Waiting for tools...";
$err = VMWaitForToolsInGuest(
      $vmHandle,      3600); # timeoutInSeconds
CheckError("VMWaitForToolsInGuest() failed");
print "Ready\n";  

print Time(), "Logging in as $userName...";
$err = VMLoginInGuest(
      $vmHandle,      $userName, # userName      $password, # password      0); # options
CheckError("VMLoginInGuest() failed");
print "Logged in\n";  

$err =  VMRunProgramInGuest(      $vmHandle,      $cscript, #executable      "$vmTestsDir\\runAnt.vbs $vmTestsDir\\build.xml $buildTarget", #arguments      0, # options      VIX_INVALID_HANDLE);
CheckError("VMRunProgramInGuest(JUnit tests) failed");
print "Finished\n";

Cannot execute VIX API command on a Powered On Virtual Machine - vCenter

$
0
0

I cannot execute any VIX API vmrun command once the Virtual Machine is powered on.

 

The setup is a vCenter server with a number of esx hosts.  I can list all virtual machines, and power the machines on, but once the machine is powered on, every vmrun command fails with the error "Cannot open VM: [datastore] VMname/vmname.vmx, There was an error in communication"

 

When executing the vmrun 'start' command from a command prompt, the command does start the Virtual Machine, but it does not return control immediately.  Instead it hangs for a few minutes before returning with the above error.  In other words it appears that as soon as a Virtual Machine is powered on, the vmrun command cannot communicate with the guest VM.  When powered off, I am able to run many vmrun commands such as revertToSnapshot, snapshot, etc.

 

I tried to execute the vmrun command against the specific esx host and this was successful.  Unfortunately, this is not a great option as the Virtual Machines could reside on any number of esx hosts.

 

Has anyone experienced this?  I'm hoping for a solution other than placing groups of vm's that I need to control via VIX on a particular esx host.

 

Thanks,

 

Joe Yankel

VMware-VIX versions for Gentoo Linux

$
0
0

While installing VMware Player from the Gentoo Linux repositories, I was advised also to download directly from VMware, specifically, "VMware-VIX-1.11.4-744019.i386.bundle". I was not able to find this specific version.    However, I did find the one before it and the one after it. someone swore to me that this unique version, and only this one, had to be used for my purpose. Now risking life and limb here, I have to ask, was such a version ever made, and could it be made available somehow? Thanks.


VIX API 1.11.0 / 1.12.0 vmrun.exe Crashes

vmrun to change a host VM's network adapter connection settings

$
0
0

Hello!

 

I have a vSphere vCenter VM running Windows 2008 R2 that is hosting many VMs of varying OSs on several different network VLANs (100, 200, 300, etc). I would like to be able to run a command from a guest VM running Red Hat Enterprise Linux 6.5 to tell vCenter to switch the network adapter settings from one VLAN to another and back again. I have done a lot of investigating, but I have been unable to figure out a way to do it. The closest thing I have found to what I am looking for are the commands below, but they are not working.

 

vmrun -T vc -h 192.168.0.3 -P443 -gu <guestusername> -gp <guestpassword> readVariable "[Datastore Name] RHEL 6.5/RHEL 6.5.vmx" runtimeConfig ethernet0.vnet /dev/vmnet0

 

vmrun -T vc -h 192.168.0.3 -P443 -gu <guestusername> -gp <guestpassword> writeVariable "[Datastore Name] RHEL 6.5/RHEL 6.5.vmx" runtimeConfig ethernet0.vnet /dev/vmnet1

 

The readVariable command appears to execute successfully, but produces 0 bytes of data, and the writeVariable command gives an error stating that the operation is not supported. Is vmrun able to perform a switch between a VM's network connections or am I going to need to use a different approach? The reason I need to have a command to run instead of simply going into the guest VM's setting in vCenter and selecting the custom network from the drop down is so that the development and testing team can execute a script at will instead of being given administrative privileges.


VLAN Interconnectivity Issue on VIX API

$
0
0

Hi All

We've recently started testing out the VIX API, and picked up a strange issue when crossing the VLANs on our network.

If the client running the VIX API is on the same VLAN as our vCenter Server Appliance, then we don't have issues.

 

Whenever the client is on a different VLAN, we get connectivity errors.  The API will connect to vCenter, but seemingly be unable to send or receive the required data.

Occasionally it'll connect but I can't see anything in the logs to help with this.

VIX API Log:

2015-05-27T11:01:48.137+10:00| vthread-4| I120: Vix: [23412 vixVIMProxy.c:7990]: VixTranslateVimException: basicHttp/libcurl error code is 48, translated to VixError VIX_E_NET_HTTP_TRANSFER (30200).

2015-05-27T11:01:48.137+10:00| vthread-4| I120: Vix: [23412 vixVIMProxy.c:8006]: VixTranslateVimException: response message is "".

 

VPXD Log from vCenter just shows:

[7F6256980700 info 'commonvpxLro' opID=78bdcfae] [VpxLRO] -- BEGIN task-internal-33228 --  -- vmodl.query.PropertyCollector.retrieveContents --

[7F62566FB700 info 'commonvpxLro' opID=efac4ba] [VpxLRO] -- FINISH task-internal-33227 --  -- vmodl.query.PropertyCollector.retrieveContents --

 

 

How do I change/overwrite any of the global settings (better logging)?

Could it be HTTP/S Issue - vCenter appliance is running default certificate? (since browsing to http://x.y.z.25:80/sdk redirects to HTTPS)

Connectivity has been tested between all hosts/VMs

Able to connect on VM to vCenter without issue.

No errors in switches/router.

 

 

 

Example Logs:
VPXD -Ticket 930bd7c2-b625-52a0-bdb2-bc90699907a4(5252ed21-07f6-9795-ad50-289a9b6ee69c eventually works

VIX Logs showing a working example after 14 attempts

 

Does anyone have any suggestions on how to increase logging, or to diagnose the issue?

Thanks

Shared Folders

$
0
0

 

Hello,

 

 

I'm running VMWare Workstation 6 and I'm trying to set up a shared vm folder programmatically.  So, I'm editing the .vmx file with the additions added to it...

 

 

sharedFolder.option = "alwaysEnabled"

sharedFolder.maxNum = "1"

sharedFolder0.present = "TRUE"

sharedFolder0.enabled = "TRUE"

sharedFolder0.readAccess = "TRUE"

sharedFolder0.writeAccess = "TRUE"

sharedFolder0.hostPath =

sharedFolder0.guestName = "FFX Storage"

sharedFolder0.expiration = "never"

 

 

 

 

 

I fill in the hostPath when I know the user who has logged on. 

 

 

 

 

 

Anyway, when the VM starts up I see that the vm has setup the folder to be shared.  However, it isn't enabled.  It seems as though the sharedFolder.option= "alwaysEnabled," nor the  sharedFolder0.enabled = "TRUE" is changing the shared folder from being "disabled."

 

 

Does anyone know how to get it working?

 

 

 

 

 

thanks,

 

 

Rod

 

 

 

 

 

VixCom.dll vs Vix.dll

$
0
0

Hello,

 

I am a bit confused by the dlls that Vix API provides and what to use/reference in my program.

 

 

I have installed VIX API from http://www.vmware.com/download/eula.do (VIX API for Window 32-bit and 64-bit).

 

 

I am using Visual Studio 2005. When i go to the references for my project, all i see is "VixCom 1.0 Type Library" which points to VixCom.dll and not Vix.dll

 

 

This VixCom.dll is at version 1.0.0.1

 

 

Does this sound right? I need to point to Vix dll that is at version 1.0.4

 

 

What is VixCom.dll? Why is the library packaged with VixCom.dll and not Vix.dll?

 

 

All i want to know is, am I missing anything here?

 

 

My program keeps crashing when i try to loop through several VM images (to boot the images), hence the above question.

 

 

Thanks for any input.

 

 

MXYZ

problem with revert to snapshot function

$
0
0

Hi

 

I am having problems with the automation of VM ware workstation 6 with multiple snapshots. On revert to snapshot sometimes it tries reverting to the wrong set of files and I get a vmdk problem. ( file missing )

 

1. Have you seen and over come this?

 

or

 

2. Have another way to automate VMware where this does not happen?

 

Host is on Win 2003 and XP. Guests are XP. We are using VIXAPI to do actions like : poweron, poweroff, reverttosnapshot etc.

 

 

Regards

Minu

Non-interactive VMware Tools install with VixVM_InstallTools

$
0
0

 

Is there any way to initiate a non-interactive VMware Tools install using VixVM_InstallTools? Currently, the tools install launches a wizard GUI that prompts the user to select installation options. For automation purposes, it would be ideal to be able to 'silently' install the VMware Tools without requiring any user interaction.

 

 

The  VixVM_InstallTools function has 'options' and 'commandLineArguments' parameters, but these are currently required to be 0 and NULL respectively.

 

 

 

 

 

Error 26 on trying to get a VM via COM from ESXi; but sometimes it works?

$
0
0

I'm currently working on a bit of wrapper code for the VIXCom API, but I've hit a bit of a stumbling block.

 

When I try to grab a VM handle from the server, it throws error 26 back at me ... but it doesn't do this if I first run vmrun on that VM ... but only one time after that; then it stops working again.

 

My code for getting the VM:

 

        public Machine(Host host, string vmxFilePath, string username, string password)        {            this.username = username;            this.password = password;            m_vixLib = new VixCOM.VixLib();            IJob jobHandle = host.m_hostHandle.OpenVM(vmxFilePath, null);            int[] propertyIds = new int[1] { VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE };            object results = new object();            ulong error = jobHandle.Wait(propertyIds, ref results);            if (error == VixCOM.Constants.VIX_OK)            {                object[] objectArray = (object[])results;                m_vmHandle = (VixCOM.IVM)objectArray[0];            }            else            {                throw new VixException(error, m_vixLib);            }        }

 

and to get the host I'm using:

       public Host(string hostname, string username, string password)        {            m_vixLib = new VixCOM.VixLib();            var job = m_vixLib.Connect(VixCOM.Constants.VIX_API_VERSION,                                  VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_VI_SERVER,                                  String.Format("http://{0}/sdk", hostname),                                  0,                                  username,                                  password,                                  0, null, null);            int[] propertyIds = new int[1] { VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE };            object results = new object();            ulong error = job.Wait(propertyIds, ref results);            if (error == VixCOM.Constants.VIX_OK)            {                object[] objectArray = (object[])results;                m_hostHandle = (VixCOM.IHost)objectArray[0];            }            else            {                throw new VixException(error, m_vixLib);            }        }

 

It doesn't throw any errors when I get the host, but I got the same error when I was trying to list the registered VMs without using a callback. However, using a callback fixed it... maybe I need to use one here as well?

 

Also, sorry for the bad code formatting. It was either no tabs or no line breaks at all

LoginInGuest() Error

$
0
0

 

Hi buddies

 

 

I'm using VIX API 1.1.5 together with VMWare Workstation 6.0.3. But I found the LoginInGuest() API doesn't work. It always results into error and the error string is 'Authentication failure or insufficient permissions in guest operating system' even if I provided the correct username and password:-( Any ideas to solve the problem?

 

 

Really Thanks!

 

 


Getting absolute path for [standard] data store for VMWare Server

$
0
0

 

Hello Experts,

 

 

Is there any VIX API available to get the absoulte path for data store.

 

 

I am getting a vmx file path as : "[standard] Win XP PRO\Win XP PRO.vmx"

I need a vmx path as              : "C:\Virtual Machines\Win XP PRO\Win XP PRO.vmx"

 

 

Is there Any API that can give me a path to data store?

Is there any config file which store this path?

 

 

Thanks in advance,

/usr/bin/vmware-config-tools.pl --default --compile any hidden options?

$
0
0

Hi,

I dug up a very old post to silent install the vmware-tools on linux. There are a bunch of posts on how to silent install them in windows, but I need linux.

So I found this someone posted

/usr/bin/vmware-config-tools.pl --default --compile

It seems to work, but it's setting the display size to HUGE, and I'm wondering if anyone can point me to a way to control the display size while still keeping it a non-interactive setup.

 

Best Regards

beginner questions for VM

$
0
0

 

Hi all,

 

 

I am new to VM product. My questions are for development purpose.

I need to write application in Linux Redhat 4 which automate VM actions, such as: CreateVM, DeleteVM, UpdateVM and so on...

There are so many products of VM which I am not sure where to begin.

 

 

Can any one help me with which of the VM products it best to use? VMworkstation, VMplayer or VMserver?

 

 

Thanks for the help,

 

 

VIX API and VB6 cannot get VixCOM to be read.

$
0
0

I couldn't install VMWare server 2.0 so I installed 1.08, I understand this could possibly be the cause of my problem.  I can get the script samples to run but they do not do anything, I cannot run the code myself either.  I get an error when running the .wsf file in the samples directory, it says "The handle is not a valid object."  I'm new to all of this so some tips would be greatly appreciated, thanks.

Running vmrun on Linux/Windows with ESX

$
0
0

I know VIX 1.6.2 was just released which now supports ESX 3.5u2+ (I believe).

 

I know there are some blogs floating out there about how to use "vmrun.exe" on Windows to manage your Virtual Machines on ESX. I just installed VIX on both Windows and on our VIMA box. I found that "vmrun" exists on both systems which is great, now I found small discrepancy in running the same exact command on the two hosts and was wondering if I was missing something:

 

Windows host execution:

C:\Program Files\VMware\VMware VIX>vmrun.exe -T -h esx https://a.b.c.d/sdk -u root -p SOME_PASS list
Total running VMs: 1
[san-storage1] TEST-VM/TEST-VM.vmx

 

 

VIMA (Linux) host execution:

 

 

 

vmrun -T esx -h https://a.b.c.d/sdk -u root -p SOME_PASS list

 

 

Nothing is returned and it shows the usage summary, I'm not sure if the syntax is supposed to be different? VIMA can talk to the ESX Host and it's also in VIMA's management.  The ESX Host in question is running latest VMware ESX 3.5u3

I've tried both Types = (server|esx), the results yield the same, works on Windows but not on Linux

 

Any idea what the issue might be?

 

Also on a side note, is there a way we can force the password to be prompted, I've found that if you just do -p or without -p that it'll error out. I'm pretty sure people will agree putting the root password in the page is probably not the best idea, especially in clear text. I'm looking at utilizing VIX to automate some tasks and I would like to either pass in the credentials once or store them in a temp cache like how VIMA / VI Perl Toolkit does its authentication.

Viewing all 34639 articles
Browse latest View live


Latest Images

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