VMware

This Question is Answered

16 Replies Last post: Jan 28, 2008 1:57 AM by tos2k   1 2 Previous Next

VI SDK 2.5.0 - Web-based (HTTP) File Access posted: Dec 14, 2007 12:35 PM

Click to view EliJuni's profile Novice 16 posts since
Jan 4, 2006

The Release Notes for VI SDK 2.5.0 ( http://www.vmware.com/support/developer/vc-sdk/visdk-2.5.0-200711-releasenotes.html ) mention this feature:

ESX Server 3.5 supports web-based, streaming file-access to ESX Server datastore and selected ESX Server configuration files. Datastore access is available through both VirtualCenter Server and ESX Server systems; configuration files are accessible though ESX Server systems only. Sample code for Java client implementation of this new approach is available in the SDK.

The Programming Guide says pretty much the same thing, and I could not find any other mention anywhere else in the docs. I haven't had a chance to try it, but I'm wondering:

  • Will it be avaliable for ESX 3i? (The Release Notes only mention 3.5.)
  • Will it allow me to create directories within a VMFS partition?
  • Will it allow me to delete files which are on the ESX server?

Thanks.

E.


Re: VI SDK 2.5.0 - Web-based (HTTP) File Access

1. Dec 16, 2007 9:16 PM in response to: EliJuni
Click to view ssurana's profile Hot Shot 132 posts since
Oct 1, 2007
Hi Eli,

Q. Will it be available for ESX 3i? (Release Notes only mention 3.5)
A. Yes it available for ESX 3i as well.

Q. Will it allow me to create directories within a VMFS partition
A. With put operation you can create directories under datastore and tmp directory.
Because put operation supports implicit creation of directories.

For Example -: With the following url

https://<servername> /tmp/firstvm/tmp/test.txt

It first creates the following hierarchy under tmp directory.

/tmp
firstvm
tmp

Q. Will it allow me to delete files which are on ESX server?
A. No

~ Sidharth

Re: VI SDK 2.5.0 - Web-based (HTTP) File Access

2. Dec 17, 2007 1:44 AM in response to: ssurana
Click to view tos2k's profile Expert 308 posts since
May 11, 2007

Hi!

Deletion of files is not a problem, this works for files and folders via the DeleteDatastoreFile_Task command.

Cant you post a sample how to stream files to a ESX server? Do I have to initiate the HTTP based put manually via the HttpRequest object from .NET or is there anything implemented in the VI SDK?

thx, Tos2k

Re: VI SDK 2.5.0 - Web-based (HTTP) File Access

4. Dec 18, 2007 6:31 AM in response to: EliJuni
Click to view ssurana's profile Hot Shot 132 posts since
Oct 1, 2007
Hi Eli,

Q. Does that mean in order to create a directory, I have to put a file in it? What if I want to create an empty directory?
A. Yes, becasue HTTP file access is only meant to Get/Put datastores or configuration files.

Q. And on another front: will it allow me to obtain the list of files within a directory? How about their sizes and timestamps?
A. To list the files in directories

******************************************
a) /folder - Directory listing of known datacenters on this server
b) /folder?dcPath=DCPATH - Directory listing of all datastores available at this datacenter
c) /folder?dcPath=DCPATH&dsName=DSNAME - Top level directory listing of the datastore. If the server is an ESX server, dcPath=DCPATH& can be omitted and defaults to dcPath=ha-datacenter.
d) /folder/PATH...?dcPath=DCPATH&dsName=DSNAME - Directory listing of files in a datastore directory. - No virtual disk interpretation (all files shown). If the server is an ESX server, dcPath=DCPATH& can be omitted and defaults to dcPath=ha-datacenter.
e) /host - List all the accessible configuration files.
******************************************
Hope the above information answers your questions.

~ Sidharth

Re: VI SDK 2.5.0 - Web-based (HTTP) File Access

6. Jan 10, 2008 12:22 AM in response to: EliJuni
Click to view tos2k's profile Expert 308 posts since
May 11, 2007

Hi!

I need to create/upload files to ESX 3i servers via SDK / web service. Can someone send som samples/info on this please?

[/]<servername> /tmp/firstvm/tmp/test.txt
It first creates the following hierarchy under tmp directory.

This cant be right as the datastore is missing, assuming that spaces in urls are wrong anyway...

Tos2k

Re: VI SDK 2.5.0 - Web-based (HTTP) File Access

7. Jan 10, 2008 9:02 AM in response to: tos2k
Click to view ssurana's profile Hot Shot 132 posts since
Oct 1, 2007
Hi,

There are few important things to note here:

1. https://<servername> /tmp/A/B/test.txt
It first creates the following hierarchy under tmp directory.
/tmp/A/B
Please note that this /tmp is the regular tmp folder in the linux environment and not any folder inside the vmfs volume. Therefore you do not need the datastore information. Also you can only perform a put operation on the tmp folder. Retrieval from this folder is not possible.

2. https:// <https:///> <servername>/folder/XP/XP.vmdk?dcPath=<DataCenterName>&dsName=<Datastore Name>
The above url would be used to get/put the files from the particular datastore available . For example the above url will give you access to the path Datastore/XP/XP.vmdk
If the server is an ESX server, dcPath=DCPATH& can be omitted and defaults to dcPath=ha-datacenter.

Hope the above information helps to clarify your doubts.

~ Sidharth

Re: VI SDK 2.5.0 - Web-based (HTTP) File Access

8. Jan 10, 2008 1:48 PM in response to: ssurana
Click to view tos2k's profile Expert 308 posts since
May 11, 2007
Hi!

I understand that you dont need a datastore for

https://<servername>/tmp/A/B/test.txt

Anyway:

  • the space does not really have to be there?

  • at my 3.5 ESXs no directories are created, nor is the (empty file created), not trying 1) nor 2) (using ip address)

Sorry for my unclearness, but I wanted to have (in addition) an example on how to upload an existing file to a 3i server via the webservice/SDK. Is the only way to achieve this as it is described in the java sample:
vi-sdk-2.5.0-64154\SDK\samples\Axis\java\com\vmware\samples\httpfileaccess\ ?

Samples using the SDK and .NET would be appreciated.


Tosk2k

Re: VI SDK 2.5.0 - Web-based (HTTP) File Access

9. Jan 11, 2008 8:04 AM in response to: ssurana
Click to view ariel.erdman's profile Lurker 1 posts since
Aug 31, 2007

Hi Sidharth,

I've been trying to follow your instructions, but I have not yet had any success.

1. https://<servername>/tmp/A/B/test.txt

This gives back HTTP 400: Bad Request. I've checked /tmp and I do not see any created folders/files.

2. https://<servername>/folder/A/test.txt?dcPath=ha-datacenter&dsName=<datastore_name>

This gives back HTTP 404: Not Found. I can browse to https://<servername>/folder/A?dcPath=ha-datacenter&dsName=<datastore_name> successfully, but I cannot seem to create the test.txt file.


I've also tried both of these programmatically by sending a file via a HttpWebRequest in C#, but the response is always HTTP 400: Bad Request.

This there anything that you can see that I am doing wrong? Is there something I need to enable on the ESX Server to allow creating/pushing files in this way? Or can you point me to any more C# examples?

Any help would be appreciated,

Thanks,

Ariel

Re: VI SDK 2.5.0 - Web-based (HTTP) File Access

10. Jan 15, 2008 5:15 AM in response to: ssurana
Click to view tos2k's profile Expert 308 posts since
May 11, 2007

Hi!

The description you provided does not seem to work. Cant VMware please publish a (preferrably .NET) sample on how to upload files to a ESX3i with VimApi?

Thx, Tos2k

Re: VI SDK 2.5.0 - Web-based (HTTP) File Access

11. Jan 22, 2008 2:50 AM in response to: ssurana
Click to view tos2k's profile Expert 308 posts since
May 11, 2007

Ssurana, your description seems to be pretty unclear, at least to some of us.

Can you please point us to sample (or post one) how to upload files to ESX 3i servers via the VimSdk?

it should contain:

  • source of the file to upload

  • target, on where to upload the file on the ESX

Tos2k

p.s. This is due the lack of the service console...

Re: VI SDK 2.5.0 - Web-based (HTTP) File Access

12. Jan 22, 2008 3:28 AM in response to: tos2k
Click to view ssurana's profile Hot Shot 132 posts since
Oct 1, 2007
Well, as far as samples are concerned there are a couple of examples that gets shipped along with the SDK 2.5. These samples are in Java. You can have a look at the samples "com.vmware.samples.httpfileaccess.ColdMigration" and "com.vmware.samples.httpfileaccess.GetVMFiles".
The ColdMigration demonstrates the put functionality whereas the GetVMFiles demonstrate the get functionality.
You can have a look into the code of these samples as to how the URLs are generated and used.
For quick reference I have also attached the 2 sample files.

The .Net and perl samples would be published later for this functionality.

Hope these samples provide you a better insight to the functionality.

~ Sidharth
Attachments:

Re: VI SDK 2.5.0 - Web-based (HTTP) File Access

13. Jan 24, 2008 5:44 AM in response to: ssurana
Click to view tos2k's profile Expert 308 posts since
May 11, 2007

Okay, thanx for your reply, but lets summarize this:

1) no support for file up-/donwload via VimSdk

2) no upload of files via the browser (even ESX 3i), as described of you before

Tos2k

p.s. It just took a day to find out how to down/upload files via ssl ;-)

Re: VI SDK 2.5.0 - Web-based (HTTP) File Access

14. Jan 25, 2008 2:14 AM in response to: ssurana
Click to view tos2k's profile Expert 308 posts since
May 11, 2007
Something strange: When browsing files via https://<virtualcenter25>/folder, it seems not to work to download files from iSCSI datastores. Can somebody test this an post results here!? Downloading and uploading on other datastores (not iSCSI) works perfectly fine.

Tos2k
P.s.: Browsing the same iSCSI datastore via https://<esx35>/folder works like a charm

Developer Social Media

Communities