VMware

This Question is Possibly Answered

1 "correct" answer available (10 pts) 1 "helpful" answer available (6 pts)
6 Replies Last post: Oct 6, 2009 7:03 AM by tos2k  

vixDiskLib > Managed posted: Feb 12, 2009 5:57 AM

Click to view fixitchris's profile Expert 549 posts since
Dec 8, 2006
Also, what is the proper way to use .Connect with Vm Server2.0?

I'm not having any success with this:

 Dim err As Integer = VixDiskLib_Init(1, 0, Nothing, Nothing, Nothing, Nothing)

 ' MsgBox("init " & err.ToString)

 Dim cnxParams As New VixDiskLibConnectParams
 cnxParams.serverName = "pc279"
 cnxParams.credType = VixDiskLibCredType.VIXDISKLIB_CRED_UID
 cnxParams.creds.uid.userName = "user"
 cnxParams.creds.uid.password = ""
 cnxParams.port = 0

 Dim connPtr As IntPtr = IntPtr.Zero
 err = VixDiskLib_Connect(cnxParams, connPtr)
 'MsgBox(VixDiskLib_GetErrorText(err, Nothing))
 MsgBox("conn " & err.ToString & " : connPtr " & connPtr.ToString)

 VixDiskLib_Exit()
Attachments:

Re: vixDiskLib > Managed

3. Feb 11, 2009 6:07 PM in response to: fixitchris
Click to view Swapnil D's profile Novice 6 posts since
Jul 2, 2008

hi fixitchris,

Here's some sample code for connecting to VMware Server 2.0 server (Connect2VMwareServer2).

You might be interested in looking at the vixDisk.cs file that acts like a C# wrapper for the vixDiskLib api's.

You seem to have already inplemented a comprehensive wrapper for vixDiskLib api's in vb.net.

Also attached is another piece of sample code that demostrates the use of VixDiskLib through managed code (ManagedVMLoadHive).

This code sample was written to demonstrate interoperability between vixDiskLib api's & VI SDK.

This sample connects to a vmdk on an ESX/VC server using vixDiskLib and VI SDK.

It then downloads the 'system' and 'software' registry hives from the vmdk's active partition.

Hope this helps...

Regards

Swapnil D.

Attachments:

Re: vixDiskLib > Managed

5. Oct 6, 2009 6:31 AM in response to: Swapnil D
Click to view tos2k's profile Expert 308 posts since
May 11, 2007
Hi!
Your wrapper looks very promising, whats the state of development? Any known issues?
I currently get the following error:

** INFO: TicketResolveHostName: Resolving IP address for hostname 192.168.73.204
.

** INFO: TicketResolveHostName: Resolved to 192.168.73.204.

** INFO: VixDiskLibVim: TicketLogin

** INFO: VixDiskLibVim: TicketFindDatacenter: dcPath = -ha-datacenter-

** INFO: VixDiskLibVim: TicketFindVMByDatastorePath: vmxPath = -[TP_SANVOL01] te
st/test.vmx-

** INFO: VixDiskLibVim: TicketLoadVM

** INFO: VixDiskLibVim: Root Snapshot list has 1 elements.

** INFO: VixDiskLibVim: Unable to find key for disk [TP_SANVOL01] test/test.vmdk
, trying snapshot tree.

** INFO: VixDiskLibVim: TicketCollectSnapshots

** INFO: VixDiskLibVim: TicketLoadSnapshot

** INFO: VixDiskLibVim: TicketLoadVMCb

** INFO: VixDiskLibVim: TicketLoadInternalSic

** INFO: VixDiskLibVim: TicketLoadNfcTicket: Request GetVMFiles diskKey = 2000,
readOnly = 1, openSnapshot = 1

** INFO: VixDiskLibVim: TicketLogout

SSLVerifyCertAgainstSystemStore: Subject mismatch: ESX402TDS.tomato.no vs 192.16
8.73.204
SSLVerifyCertAgainstSystemStore: The remote host certificate has these problems:


* The host name used for the connection does not match the subject name on the h
ost certificate

* The host certificate chain is not complete.
SSLVerifyIsEnabled: failed to open the product registry key. Assuming verificati
on is disabled. LastError = 0
SSLVerifyCertAgainstSystemStore: Certificate verification is disabled, so connec
tion will proceed despite the error
CATCH ::: System.AccessViolationException: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt.
   at csharpVixDiskWrapper.vixDisk.Read(IntPtr diskHandle, UInt64 startSector, U
Int64 numSectors, Byte[] readBuffer)
   at VIandVixDiskSample.VixDiskESXConnection.ReadWriteChanges(String strDataSto
reName, String source, String target, Byte[] arrbyteReadBuffer, UInt64 start, UI
nt64 length)
   at ManagedVMLoadHive.DataReaderWriter.ReadWrite(String source, String target,
 String dcName, String vmxFile, UInt64 start, UInt64 length)
   at DeltaTest.Program.Main(String[] args)
111


You have any idea what:

System.AccessViolationException: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt.
at csharpVixDiskWrapper.vixDisk.Read(IntPtr diskHandle, UInt64 startSector, U
Int64 numSectors, Byte[] readBuffer)

will say me? Running that on a default 32bit machine that of course does not have any memory issues...

Tos2k

Re: vixDiskLib > Managed

6. Oct 6, 2009 7:03 AM in response to: Swapnil D
Click to view tos2k's profile Expert 308 posts since
May 11, 2007
Do you know what is the right port to use for VixDiskLib calls?
http://communities.vmware.com/message/897988

Looks like using your wrapper worx for both, 443 as 902???

How can I overwride the logging of VixDiskLib functions with your wrapper?

Tos2k

Developer Social Media

Communities