1 2 Previous Next 16 Replies Latest reply: Jan 28, 2008 2:37 AM by tos2k RSS

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

    EliJuni Novice

       

      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.

       

       

       

       

       

        • 1. Re: VI SDK 2.5.0 - Web-based (HTTP) File Access
          ssurana Expert VMware Employees

          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:// /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

          • 2. Re: VI SDK 2.5.0 - Web-based (HTTP) File Access
            tos2k Expert

             

            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

             

             

            • 3. Re: VI SDK 2.5.0 - Web-based (HTTP) File Access
              EliJuni Novice

              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

              Does that mean that in order to create a directory, I have to put a file in it?  What if I want to create an empty directory?

               

               

               

               

               

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

              • 4. Re: VI SDK 2.5.0 - Web-based (HTTP) File Access
                ssurana Expert VMware Employees

                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

                • 5. Re: VI SDK 2.5.0 - Web-based (HTTP) File Access
                  EliJuni Novice

                  Hope the above information answers your questions.

                   

                  ~ Sidharth

                   

                   

                  Thanks, it does.

                  • 6. Re: VI SDK 2.5.0 - Web-based (HTTP) File Access
                    tos2k Expert

                     

                    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

                     

                     

                    • 7. Re: VI SDK 2.5.0 - Web-based (HTTP) File Access
                      ssurana Expert VMware Employees

                      Hi,

                       

                      There are few important things to note here:

                       

                      1. https://

                      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 /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

                      • 8. Re: VI SDK 2.5.0 - Web-based (HTTP) File Access
                        tos2k Expert

                        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

                        • 9. Re: VI SDK 2.5.0 - Web-based (HTTP) File Access
                          ariel.erdman Lurker

                           

                          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

                          • 10. Re: VI SDK 2.5.0 - Web-based (HTTP) File Access
                            tos2k Expert

                             

                            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

                             

                             

                            • 11. Re: VI SDK 2.5.0 - Web-based (HTTP) File Access
                              tos2k Expert

                               

                              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...

                               

                               

                              • 12. Re: VI SDK 2.5.0 - Web-based (HTTP) File Access
                                ssurana Expert VMware Employees

                                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

                                • 13. Re: VI SDK 2.5.0 - Web-based (HTTP) File Access
                                  tos2k Expert

                                   

                                  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

                                   

                                   

                                  • 14. Re: VI SDK 2.5.0 - Web-based (HTTP) File Access
                                    tos2k Expert

                                    Something strange: When browsing files via https:///folder works like a charm

                                    1 2 Previous Next