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

VixVM_CopyFileFromGuestToHost

$
0
0

 

I'm having trouble copying files from my Windows XP machine to my VM running Workstation 6 with Windows XP.

 

 

I have successfully connected, powered on and logged into the VM. However when I run :

 

 

jobHandle = VixVM_CopyFileFromGuestToHost(  vmHandle,

                                                                        "C:
test.txt",  // src name

                                                                        "C:
test.txt", // dest name

                                                                        0, // options

                                                                        VIX_INVALID_HANDLE, // propertyListHan

                                                                        NULL, // callbackProc

                                                                        NULL); // clientData

 

 

  err = VixJob_Wait(jobHandle, VIX_PROPERTY_NONE);

 

 

  if (VIX_FAILED(err)) {

 

 

    }

 

 

  Vix_ReleaseHandle(jobHandle);

 

 

I get err == 4 VIX_E_FILE_NOT_FOUND. The file is present on my host machine.

 

 

Thanks

 

 


Vix 1.2 with C# - Callbacks crash

$
0
0

 

I have created a very basic project to simply enumerate the running VMs.  This is taken from the sample code provided in the documentation for FindItems.  If I do not register a callback, the code runs fine.  However, when I register a callback, it always crashes when returning from the OnVixEvent function.  This happens even I put only a return statement in the function.  Does anyone have an idea as to what is going on?

 

 

I have attached my source file.

 

 

Thanks,

 

 

allan

 

 

some accessibility assistance needed

$
0
0

 

I use speech recognition (not by choice but out of necessity) and I would like to be able to dictate into the VM workstation window.  The first need is to just be able to dictate plaintext into the currently active window inside the virtual machine.  Second would be to change the taskbar of workstation to reflect the currently active application within the virtual machine (this lets me automatically switch grammars inside of NaturallySpeaking).  And third would be figuring out how to get to gnome at-spi  but that's a longer term issue.  today, if I'm going to dictate into applications on the virtual machine, I need to connect via putty, forward X11 connections back to my Windows desktop and then run the application.  It's fragile, it's uncomfortable, and quite frankly, gets a bit confusing when you have a half a dozen putty sessions with various X11 applications floating about.

 

 

I suspect that there is some API that will let me take output from NaturallySpeaking and shove it into the virtual machine.  It would've been nice if they could have just taken straight keystrokes from NaturallySpeaking but apparently it grabs the keyboard stack lower far below that of NaturallySpeaking's hook.  Appreciate any pointers.

 

thanks.

 

 

 

Desperated trying to connect to vmserver. Please help.

$
0
0

 

Hi all,

 

 

I have spent last 3 days trying to maek my c program connect remotely and localy to a vmserver 1.0.3 remote, 1.0.4 local.

 

 

Today I managed to connect to the remote one passing as Provider _WORKSTATION instead of _SERVER (really odd). I tried _DEFAULT too, wihtout any luck.

 

 

Afrter connect  I copied the example code to list vms but no one was found, I tried to open one manually and it wasn´t found either (odd). The VM I connected to

 

 

had around 10 vm's.

 

 

 

 

 

With vmrun everything works ok and I really don´t understand it, lota of time wasted :(.

 

 

I have just read that vmware advices to use Vix 1.0 with vmserver, I have being used 1.1.2 (latest I think), anyway I have read in the forums too that if vmrun my C program should run too.

 

 

 

 

 

Could anyone please help here giving any tip or something?.

 

 

 

 

 

Thanks in advance,

 

 

HexDump.

 

 

 

 

 

 

 

 

How do I interactively login to Windows?

$
0
0

 

Hello,

 

 

I'm automating a Windows XP VM.  I've had success so far doing what I need with LoginInGuest, but for some tasks I'd like to actually log in at the Windows login prompt so the UI comes up.

 

 

I realize that I can save a snapshot with the user already logged in, but I would prefer to have my snapshots with the VM powered off.

 

 

Is there a recommened technique for scripting a login at the Windows login prompt?

 

 

 

 

 

Thanks,

Ben

 

 

Snapshot with C#

$
0
0

I want to take snapshots with C#, but I am having trouble finding the API for it

 

The VMCOMLib seem to not have the snapshot functions. The VIX.DLL can not be added as reference to my project (Visual Studio message: "this is not a valid assembly or com component"). A "VixCom.dll" again is not included in VMware Server...

 

I am using VS 2005 and installed VMware Server 1.0.4

 

Thanks

 

Marcel

ESXi the cheapest licence to have api command to revert to snapshot?

Semi-random segfaults when reverting to snapshots

$
0
0

I've got a set of ESX 4.0.0 boxes where I'm running some heavily automated processes that require me to revert to snapshot frequently. After beating my head against the wall for some time about the fact that, every third day or so, VMware dies in such a way that I have to reboot before I can connect to my guests from the VIX Perl API, I decided to solve the problem by automating a daily reboot of these systems. Now I've run into a snag on even a really, really basic piece of code - my script to revert guests to snapshot is segfaulting (throwing a SIGSEGV) at semi-random intervals, using both the Perl API and the C API.

 

The code itself for the C version of my script (which I've moved to as it's easier to debug this sort of thing in C) is as basic as it gets, largely copied from the sample snapshot.c file for API version 1.8.1 (which is what I'm running):

 

#include <stdio.h>
#include <strings.h>
#include <vmware-vix/vix.h>

#define CONNTYPE VIX_SERVICEPROVIDER_VMWARE_VI_SERVER
#define HOSTPORT 0
#define USERNAME "root"
#define PASSWORD "yourefunnyifyouthinkimpostingithere"
#define VMPOWEROPTIONS VIX_VMPOWEROP_NORMAL

int main(int argc, char **argv) {
        VixError err;        char *vmxPath;        char *hostname;        VixHandle hostHandle = VIX_INVALID_HANDLE;        VixHandle jobHandle = VIX_INVALID_HANDLE;        VixHandle vmHandle = VIX_INVALID_HANDLE;        VixHandle snapshotHandle = VIX_INVALID_HANDLE;        int numSnapshots;        int firstHost = 0;        int lastHost = 0;        int x;        char vmName[45];        if (argc > 1) {                hostname = argv[1];        }        if (argc > 2) {                firstHost = atoi(argv[2]);        }        if (argc > 3) {                lastHost = atoi(argv[3]);        }        if (firstHost == 0) {                firstHost = 2;        }        if (lastHost == 0) {                lastHost = 30;        }        jobHandle = VixHost_Connect(VIX_API_VERSION,                                        CONNTYPE,                                        hostname,                                        HOSTPORT,                                        USERNAME,                                        PASSWORD,                                        0,                                        VIX_INVALID_HANDLE,                                        NULL,                                        NULL);        err = VixJob_Wait(jobHandle,                                 VIX_PROPERTY_JOB_RESULT_HANDLE,                                &hostHandle,                                VIX_PROPERTY_NONE);        if (VIX_FAILED(err)) {                dieGracefully(jobHandle, vmHandle, snapshotHandle, hostHandle);        }        Vix_ReleaseHandle(jobHandle);        printf("Successfully connected to host %s\n", hostname);        for (x = firstHost; x <= lastHost; x++) {                bzero(vmName, 45);                sprintf(vmName, "[Storage1] Virus Clone %d/Virus Clone %d.vmx", x, x);                jobHandle = VixVM_Open(hostHandle,                                        vmName,                                        NULL,                                        NULL);                err = VixJob_Wait(jobHandle,                                        VIX_PROPERTY_JOB_RESULT_HANDLE,                                        &vmHandle,                                        VIX_PROPERTY_NONE);                if (VIX_FAILED(err)) {                        dieGracefully(jobHandle, vmHandle, snapshotHandle, hostHandle);                }                Vix_ReleaseHandle(jobHandle);                printf("Connected to VM %d\n", x);                err = VixVM_GetRootSnapshot(vmHandle, 0, &snapshotHandle);                if (VIX_FAILED(err)) {                        dieGracefully(jobHandle, vmHandle, snapshotHandle, hostHandle);                }                jobHandle = VixVM_RevertToSnapshot(vmHandle,                                                        snapshotHandle,                                                        VMPOWEROPTIONS,                                                        VIX_INVALID_HANDLE,                                                        NULL,                                                        NULL);                err = VixJob_Wait(jobHandle, VIX_PROPERTY_NONE);                if (VIX_FAILED(err)) {                        dieGracefully(jobHandle, vmHandle, snapshotHandle, hostHandle);                }                printf("Reverted VM %d to snapshot\n", x);        }        return 0;
}

int dieGracefully(VixHandle j, VixHandle v, VixHandle s, VixHandle h) {
        Vix_ReleaseHandle(j);        Vix_ReleaseHandle(v);        Vix_ReleaseHandle(s);        VixHost_Disconnect(h);        return -1;
}

 

My Makefile is equally basic; the only real difference from the sample is that I'm manually linking pthreads into my binary, so GDB can debug properly:

 

WRAPPER = -lvixAllProducts -ldl
SERVER11 = /usr/lib/vmware-vix/server-1/64bit/libvix.so
WORKST60 = /usr/lib/vmware-vix/ws-3/64bit/libvix.so
SERVER20 = /usr/lib/vmware-vix/VIServer-2.0.0/64bit/libvix.so
WORKST65 = /usr/lib/vmware-vix/Workstation-6.5.0/64bit/libvix.so
WRAPORNOT = $(WRAPPER)
VIXH = -I/usr/include/vmware-vix

all: eventPump startup

eventPump: eventPump.c
        gcc $(VIXH) eventPump.c -o eventPump -lpthread $(WRAPORNOT)

startup: startup.c
        gcc $(VIXH) startup.c -o startup -lpthread $(WRAPORNOT)

clean:
        rm -f eventPump startup

 

I'm running this script on an Ubuntu 9.10 64-bit system, gcc 4.4.1, pretty vanilla install.

 

When I ran my script in GDB, after revering the first several guests successfully, I got the following:

 

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5193084 in ?? () from /usr/lib/vmware-vix/VSphere-4.0/64bit/libgvmomi.so.0
(gdb) bt
#0  0x00007ffff5193084 in ?? () from /usr/lib/vmware-vix/VSphere-4.0/64bit/libgvmomi.so.0
#1  0x00007ffff5193f94 in ?? () from /usr/lib/vmware-vix/VSphere-4.0/64bit/libgvmomi.so.0
#2  0x00007ffff52fd5eb in ?? () from /usr/lib/vmware-vix/VSphere-4.0/64bit/libgvmomi.so.0
#3  0x00007ffff5e3b282 in g_object_get_valist () from /usr/lib/vmware-vix/VSphere-4.0/64bit/libgobject-2.0.so.0
#4  0x00007ffff5e3b57a in g_object_get () from /usr/lib/vmware-vix/VSphere-4.0/64bit/libgobject-2.0.so.0
#5  0x00007ffff48fd353 in ?? () from /usr/lib/vmware-vix/VSphere-4.0/64bit/libvix.so
#6  0x00007ffff48d4cee in VixVM_GetRootSnapshot () from /usr/lib/vmware-vix/VSphere-4.0/64bit/libvix.so
#7  0x0000000000400ca1 in main ()

 

I'm at a total loss here - this should be incredibly basic, simple stuff, and it's apparently not. Does anyone have a clue why something so straightforward would break?


Can we redistribute VixCOM.dll

$
0
0

 

Hi,

 

 

I am wrting wrapper to VixCOM.dll. What is license requirement to redistribute VixCOMM with our Product?

 

 

Questions regarding VIX and VIX and ANT.

$
0
0

 

Hello,

 

 

I'm curious to know if anyone out there has had experience using VIX to control ANT scripts inside of a Windows XP VM running under VMware Workstation?  I'm trying to figure out the right command structure or syntax that can let me execute an ANT script inside the VM from the host OS.  This is in support of our build process at work.

 

 

Anyway the script xml file is located on the D: drive within the VM, and ant 1.6.5 is installed at D:\ apache-ant-1.6.5.  ANT_HOME and all appropriate environment variables are set.  Normally when I want to run this script by itself I'd open a command window and type in the following:

 

 

D:\ant -f somescript.xml &gt; somescriptlog.txt

 

 

This runs the ANT script that pulls code down from our clearcase environment and performs the build.  I have yet to figure out a use of the vmrun command that will let me switch the context in the VM to D:/ and then run the script and produce the output file.

 

 

In fact the only way I could get this script to run, at all, was to create a bat file and write a vmrun command to call the bat file which then called the script.  The only issue I have now is that after the script completes the bat file doesn't die and the Host OS is left waiting for the return.  The command I've been using has been:

 

 

C:\Program Files\VMware\VMware VIX&gt;vmrun -gu &lt;username&gt; -gp &lt;password&gt; runProgramInGuest "C:\Documents and Settings\All Users\Documents\Virtual Machines\TargetVM\TargetVM.vmx" -ActiveWindow "D:\BuildStart.bat"

 

 

So what am I doing wrong?  There's got to be some way to call that script directly from the host...does anybody have any other tips?

 

 

Also is it just me or does VIX have issues when asking a VM to download data from or copy data up to a maped network drive?  Our clearcase repository appears as a networked drive in the VM and the shared folder where we want to output the results is a network drive as well.  Both are visible and mounted within the guest and for some reason a script that runs fine when manually triggered within the VM will bomb out when we trigger it using vmrun because it can't find the network drive.

 

 

Anyway any light that anyone could shed upon these issues would be greatly appreciated!!!

 

 

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

vdi floating desktops used as labs

$
0
0

Hi,

 

I have a floating desktop pool with about 25 machines which students use to log into via there AD accounts. My parent image has a bunch of software that works fine under the user that I installed it under,which is an admin user but I noticed that some software that gets installed takes a long time to load(when a new user logs in) because it creates a bunch of data directories or temp directories under the user the logs onto the non-persistent floating desktop. I was just curious how others are handling situations like this where they are using View as a virtual lab environment. I was looking at possibly using pgina but just wanted to see what others are using out there to simulate a physical lab.?  spss and eclipse take a long time to load because it has to rebuild what ever files it needs under the student that just logged onto the virtual desktop.

SNMP trap body

$
0
0

Hi everyone.
I'm goroing to write monitoring application for vSphere.

I create triggers for alarms and set SNMP trap action to receive real time notification.

 

Currently I'm on alysys phase. so it's important for me to understand SNMP trap body. Can I receive alarm definition name by SNMP trap which was triggered? Or can you please attach real example of SNMP trap?

 

Thanks in advice.

Getting the name of a snapshot

$
0
0

I've been working on a fairly simple VB.NET wrapper for the Vix api, everything is going OK and it works fine. One thing I can't seem to do is to have more than one VM open at a time (opening by calling the OpenVM function). Each time it opens a different VM the current instance of VMWare closes and opens again with the new VM. Is there a way around this?

 

I'm running VM Workstation 6 and the latest version of the API.

 

 

Thanks.

 

 

Edit This problem was due to a logic error in my code, a stupid logic error at that. However a new problem has made itself apparent:Which property returns the name from a snapshot object? I can't seem to find anything like it.

 

 

Thanks again.

How to Power On a remote host virtual machine

$
0
0

 

I am using vix api and vmware workstation.  My scripts in perl and C++ can power on a guest operating system in my computer (localhost).  However, I cannot power on a remote VM in another computer on my network.  The scripts give the following  errors:

 

 

C++ script:

The virtual machine cannot be found

 

 

Perl Script:

VMopen() failed, 4000 The virtual machine cannot be found

 

 

Here is part of my code:

 

 

C++:

 

 

VixHandle hostHandle = VIX_INVALID_HANDLE;

     VixHandle jobHandle = VIX_INVALID_HANDLE;

     VixHandle vmHandle = VIX_INVALID_HANDLE;

     VixError err;

     char vmxFilePath[] = "c:
home
My Virtual Machines
Windows Server 2003 Enterprise Edition
Windows Server 2003 Enterprise Edition.vmx";

 

 

     jobHandle = VixHost_Connect(1,

          VIX_SERVICEPROVIDER_VMWARE_WORKSTATION,

          "10.55.10.100",                    // hostName

          902,                       // hostPort

          "xxxxxx",                    // userName              

          "yyyyyyy",                    // password

          0,                       // options

          VIX_INVALID_HANDLE,      // propertyListHandle

          NULL,                    // callbackProc

          NULL);                   // clientData

 

 

     // Wait for completion of operation.

     err = VixJob_Wait(jobHandle,

          VIX_PROPERTY_JOB_RESULT_HANDLE,

          &hostHandle,

          VIX_PROPERTY_NONE);

 

 

     if (VIX_OK != err) {

          goto abort;

     } else {

          printf ("connect success\n");

     }

 

 

     Vix_ReleaseHandle(jobHandle);

 

 

     // Use VixVM_Open with the hostHandle and the vmxFilePath to open your virtual machine.

     jobHandle = VixVM_Open(hostHandle,

          vmxFilePath,

          NULL,           // callbackProc

          NULL);          // clientData

 

 

 

     err = VixJob_Wait(jobHandle,

          VIX_PROPERTY_JOB_RESULT_HANDLE,

          &vmHandle,

          VIX_PROPERTY_NONE);

 

 

     if (VIX_OK != err) {

          goto abort;

     } else {

          printf ("%s: open success\n",vmxFilePath);

     }

 

 

     // Use VixVM_PowerOn to power on your VM.

 

 

     jobHandle = VixVM_PowerOn(vmHandle,

          VIX_VMPOWEROP_NORMAL,           // options

          VIX_INVALID_HANDLE,             // propertyListHandle

          NULL,                           // *callbackProc,

          NULL);                          // *clientData

 

 

     err = VixJob_Wait(jobHandle, VIX_PROPERTY_NONE);

 

 

     if (VIX_OK != err) {

          goto abort;

     } else {

          printf ( "%s: power on success\n",vmxFilePath);

     }

 

 

     Vix_ReleaseHandle(jobHandle);

 

 

 

 

 

Perl Code:

 

 

use VMware::Vix::Simple;

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

 

 

my $err = VIX_OK;

my $hostHandle = VIX_INVALID_HANDLE;

my $vmHandle = VIX_INVALID_HANDLE;

 

 

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

                                  VIX_SERVICEPROVIDER_VMWARE_WORKSTATION,

                                  "10.55.10.100", # hostName

                                  902, # hostPort

                                  "xxxxxx", # userName

                                  "yyyyyyy", # password

                                  0, # options

                                  VIX_INVALID_HANDLE); # propertyListHandle

 

 

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

 

 

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

                           "c:
home
My Virtual Machines
Windows Server 2003 Enterprise Edition
Windows Server 2003 Enterprise Edition.vmx");

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

 

$err = VMPowerOn($vmHandle,

                 VIX_VMPOWEROP_LAUNCH_GUI, # powerOnOptions

                 VIX_INVALID_HANDLE);  # propertyListHandle

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

 

 

$err = VMWaitForToolsInGuest($vmHandle,

                             300); # timeoutInSeconds

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

 

 

$err = VMLoginInGuest($vmHandle,

                      "administrator", # userName

                      "C*vmuser$$", # password

                      0); # options

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

 

 

 

 

 

 

Help please.  Both work well with the localhost when I change the hostname and port to NULL and 0.

 

 

 

 

 

Thanks

 

 

 

 

 

 

 

 


Trouble trying to connect to local host with connect() and wait() using VixCOM

$
0
0

 

I have been trying to connect to the local host to do some automated testing using VMWare. However, whenever I try to connect to the Local Host as the Current User I get the "The handle is not a valid VIX object" (error code 1000) from the call to wait(). My code is below:

 

 

VixCOM.IVixLib vixLib = null;

 

ulong m_vixError;

VixCOM.IHost m_hostHandle = null;

VixCOM.IVM m_vmHandle = null;

public bool Connect()

        {

            int hostType = VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_WORKSTATION;

            int vixVersion = VixCOM.Constants.VIX_API_VERSION;

            vixVersion = 1;

 

            //Connecting to a local host as current user

            VixCOM.IJob jobHandle = vixLib.Connect(

                vixVersion,                                 //API Version

                hostType,                                   //Host Type

                null,                                       //Host Name

                0,                                          //Host Port

                null,                                       //User Name

                null,                                       //User Password

                0,                                          //Options

                null,                                       //Handle Property List

                null);                                      //Job Done Callback

 

            int[] propertyIds = new int[1] { VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE };

            object results = new object();

 

            m_vixError = jobHandle.Wait(propertyIds, ref results);

            MessageBox.Show(vixLib.GetErrorText(m_vixError, null));

 

            if (m_vixError == VixCOM.Constants.VIX_OK)

            {

                object[] objectArray = (object[])results;

                m_hostHandle = (VixCOM.IHost)objectArray[0];

                return true;

            }

 

            return false;

        }

 

 

 

 

 

I am using VIX API 1.1.5 with VMWare Workstation 5.5.4. Any help would be greatly appreciated. Thanks.

 

 

 

 

 

SOLVED: Insufficient permissions in host OS

$
0
0

I'm trying to use VIX to open a VM on a Server 2.0.  If I set the user as an admin on the server I'm able to open the machine just fine.  However if I remove the user from the admin group I get the "Insufficient permissions in host operating system" error.  I have tried giving the user in question full access to the drive where the .vmx file is stored but to no avail.  Does anyone know the permissions needed to open a vm through VIX?  I would rather not give this user admin rights on the machine.

 

Matt

VIX_SERVICEPROVIDER_VMWARE_WORKSTATION error

$
0
0

 

Hi,

 

 

I'm trying to run a script in a 64-bit Windows 7 VM usingthe vmrun command line tool (1.6.0.2073) and the following options:

 

 

vmrun -T ws -gu user -gp passwordrunProgramInHost "C:\vms\W7.vmx" -interactive "C:\test\test.cmd"

 

 

and i get the following error:

 

 

Error: Service type VIX_SERVICEPROVIDER_VMWARE_WORKSTATION was specified, but not installed

 

 

Can anyone help me with this error, it would be most appreciated!

 

 

Thanks

 

 

 

 

 

Runtime Error

$
0
0

 

Hello

 

 

I have written some code to copy files between the guest and the local system.

 

 

I read the directories within the guest with the methode ListDirectoryInGuest. I initiate it when I expand a directory (the node within the treelist). The first two times I'm able to expand the node and receive the results of the new directory level. Mostly the third time the application will crash with the following message:

 

 

Runtime Error

This application has requested the runtime to terminate it in an unusual way.

 

 

This Problem occures only on some systems but if it is a problem on a system it appears all the time.

 

 

The error can't be tracked with the debugger (or I don't know how?)

 

 

As it appears the result of the directory list is returned and processed, the application just crashes after processing the result.

 

 

 

 

 

Below is the function I use to retrieve the directories and files...

 

 

Does anyone have an idea what causes this crash? It seems to be related with the VIX API

 

 

 

 

 

Regards

 

 

Manfred

 

 

 

 

 

Private Function RetrieveFiles(ByVal path As String, ByVal parentnodeID As Integer, ByVal ForGrid As Boolean) As Boolean

 

 

Try

 

 

GuestResults.Clear()

 

 

If CheckConnectState() Then

 

 

PathToRetrieve = path

 

 

ParentNodeID_Used = parentnodeID

 

 

Dim FlagList() As Integer = {Constants.VIX_PROPERTY_JOB_RESULT_ITEM_NAME, Constants.VIX_PROPERTY_JOB_RESULT_FILE_FLAGS, Constants.VIX_PROPERTY_JOB_RESULT_FILE_MOD_TIME}

 

 

Dim numResults As Integer

 

 

job = Interfacevm.ListDirectoryInGuest(path, 0, Nothing)

 

 

vix_status = job.WaitWithoutResults

 

 

If VixLib.ErrorIndicatesFailure(vix_status) Then

 

 

Dim VixException As New Exception("Retrieve directories and files failed '" & VM_VMXPath & "' failed with exception '" & VixLib.GetErrorText(vix_status, Nothing) & "'")

 

 

XtraMessageBox.Show(VixException.Message, " Can't Retrieve Guest Files ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

 

 

VixException = Nothing

 

 

Return False

 

 

End If

 

 

If DebugGuestFiles Then Console.WriteLine(GetCurrentMethod.DeclaringType.Name & " " & GetCurrentMethod().Name & " Guest Files retrieved")

 

 

numResults = job.GetNumProperties(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_ITEM_NAME)

 

 

Dim node As TreeListNode

 

 

' If ForGrid Then tlGuest.BeginUnboundLoad()

 

 

For i As Integer = 0 To numResults - 1

 

 

Dim results As Object

 

 

vix_status = job.GetNthProperties(i, FlagList, results)

 

 

If VixLib.ErrorIndicatesFailure(vix_status) Then

 

 

Dim VixException As New Exception("List Files '" & VM_VMXPath & "' failed with exception '" & VixLib.GetErrorText(vix_status, Nothing) & "'")

 

 

XtraMessageBox.Show(VixException.Message, " Can't Retrieve Guest Files ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

 

 

VixException = Nothing

 

 

Else

 

 

Select Case results(1)

 

 

Case Constants.VIX_FILE_ATTRIBUTES_SYMLINK

 

 

If ForGrid Then

 

 

Addnode(path & FilesystemSeparator & results(0), results(0), results(2), parentnodeID, 4, "file")

 

 

'node = tlGuest.AppendNode(New Object() {path & FilesystemSeparator & results(0), results(0), ConvertDateEpoche(results(2)), "file"}, parentnodeID)

 

 

'node.ImageIndex = 4

 

 

'node.SelectImageIndex = 4

 

 

Else

 

 

Dim res As New GuestItem

 

 

res.isDirectory = False

 

 

res.ShortName = results(0)

 

 

res.Fullpath = path & FilesystemSeparator & results(0)

 

 

GuestResults.Add(res)

 

 

res = Nothing

 

 

End If

 

 

'Console.WriteLine("Link:" & results(0) & " Modified:" & ConvertDateEpoche(results(2)) & " " & vbLf)

 

 

Case Constants.VIX_FILE_ATTRIBUTES_DIRECTORY

 

 

If ForGrid Then

 

 

Addnode(path & FilesystemSeparator & results(0), results(0), results(2), parentnodeID, 0, "folder")

 

 

'node = tlGuest.AppendNode(New Object() {path & FilesystemSeparator & results(0), results(0), ConvertDateEpoche(results(2)), "folder"}, parentnodeID)

 

 

'node.ImageIndex = 0

 

 

'node.SelectImageIndex = 0

 

 

'node.HasChildren = True

 

 

Else

 

 

Dim res As New GuestItem

 

 

res.isDirectory = True

 

 

res.ShortName = results(0)

 

 

res.Fullpath = path & FilesystemSeparator & results(0)

 

 

GuestResults.Add(res)

 

 

res = Nothing

 

 

End If

 

 

'Console.WriteLine("Directory:" & results(0) & " Modified:" & ConvertDateEpoche(results(2)) & " " & vbLf)

 

 

Case Else

 

 

If ForGrid Then

 

 

'Retrieve Extension

 

 

' Dim sExtension As String = results(0).Substring(InStrRev(results(0), "."))

 

 

'If results(0) = "acpid" Then

 

 

' Console.WriteLine()

 

 

'End If

 

 

Dim sExtension As String = System.IO.Path.GetExtension(results(0))

 

 

Dim index As Integer = -1

 

 

If sExtension &lt;&gt; "" Then

 

 

index = imageList1.Images.IndexOfKey(sExtension)

 

 

End If

 

 

If index = -1 Then 'Not found

 

 

If sExtension = "" Then

 

 

index = 2

 

 

Else

 

 

Dim ic As Icon = retieveIcon.GetDefaultIcon(results(0), 1)

 

 

imageList1.Images.Add(sExtension, ic)

 

 

index = imageList1.Images.IndexOfKey(sExtension)

 

 

ic = Nothing

 

 

End If

 

 

End If

 

 

Addnode(path & FilesystemSeparator & results(0), results(0), results(2), parentnodeID, index, "file")

 

 

'node = tlGuest.AppendNode(New Object() {path & FilesystemSeparator & results(0), results(0), ConvertDateEpoche(results(2)), "file"}, parentnodeID)

 

 

'node.SelectImageIndex = index

 

 

'node.ImageIndex = index

 

 

index = Nothing

 

 

sExtension = Nothing

 

 

Else

 

 

Dim res As New GuestItem

 

 

res.isDirectory = False

 

 

res.ShortName = results(0)

 

 

res.Fullpath = path & FilesystemSeparator & results(0)

 

 

GuestResults.Add(res)

 

 

res = Nothing

 

 

End If

 

 

End Select

 

 

End If

 

 

results = Nothing

 

 

Next

 

 

If DebugGuestFiles Then Console.WriteLine(GetCurrentMethod.DeclaringType.Name & " " & GetCurrentMethod().Name & " Guest Files Added to grid")

 

 

If ForGrid Then

 

 

' tlGuest.EndUnboundLoad()

 

 

SortTreelist()

 

 

End If

 

 

FlagList = Nothing

 

 

numResults = Nothing

 

 

node = Nothing

 

 

job = Nothing

 

 

If DebugGuestFiles Then Console.WriteLine(GetCurrentMethod.DeclaringType.Name & " " & GetCurrentMethod().Name & " Guest Files retrieve completed")

 

 

Return (True)

 

 

Else

 

 

Return False

 

 

End If

 

 

Catch ex As Exception

 

 

Return False

 

 

End Function

 

 

 

 

 

how to unlock vmdk files?

$
0
0

 

Hi,

 

 

 

 

 

Im using vix api to create a snapshot of guest os. After creating snapshot i try to download the snapshot files to remote machine without power off the guest os . But the problem is  *flat.vmdk files are locked by ESX server when the guest os is powered ON. so im unable to download 'flat.vmdk files. Can any one tell me is there anyway to unlock that file and make it free to download?. OR is the any vmware commandline tools to do this?

 

 

 

 

 

NOTE: I want to do this operation without power off the guest machine as well as with out renaming or moving the vmdk files.

 

 

 

 

 

its very urgent. Please help me.

 

 

Regards,

 

 

Ilavaa

 

 

Viewing all 34639 articles
Browse latest View live


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