Content Library
Storage
When you create a
local library, you can store its contents on a datastore managed by the
vCenter Server
instance or on a remote file system.
Depending on the type of storage
that you have, you can use Virtual Machine File System (VMFS) or Network File
System (NFS) for storing content on a datastore.
For storing content on a remote file system, you can
enter the path to the NFS storage that is mounted on the Linux file system of the
vCenter Server
instance. For example,
you can use the following URI formats:
nfs://<server>/<path>?version=4
and
nfs://<server>/<path>
. If you have a vCenter Server
instance that runs on a Windows machine, you can specify the
Server Massage Block (SMB) URI to the Windows shared folders that store the library
content. For example, you can use the following URI format:
smb://<unc-server>/<path>
.- Java
- This example is based on the code in theLibraryCrud.javasample file and shows how to store library content on a datastore.For more information about storing the contents of a local library, see Content Library Storage.For a complete and up-to-date version of the Java sample code, see thevsphere-automation-sdk-javaVMware repository at GitHub.... // Create a StorageBacking instance for storing the library content on a datastore. StorageBacking libraryBacking = new StorageBacking(); libraryBacking.setType(Type.DATASTORE); /* * Pass the value of the datastoreManagedObjectReference. * See thevSphere Web Services SDK Programming Guide* and the vSphere Web Services SDK samples. In addition, thevSphere Automation SDK for Javaprovides * theVimUtilutility class in thevmware.samples.vim.helperspackage. * You can use the utility to retrieve theManagedObjectReference* of the datastore entity. */ libraryBacking.setDatastoreId("datastore-123"); // Create a LibraryModel that represents a local library backed on a datastore. LibraryModel libraryModel = new LibraryModel(); libraryModel.setName("AcmeLibrary"); libraryModel.setDescription("Local library backed by VC datastore"); libraryModel.setType(LibraryType.LOCAL); libraryModel.setStorageBackings(Collections.singletonList(libraryBacking));
- Python
- This example is based on the code in thelibrary_crud.pysample file and shows how to store library content on a datastore.For more information about storing the contents of a local library, see Content Library Storage.For a complete and up-to-date version of the sample code, see thevsphere-automation-sdk-pythonVMware repository at GitHub.... # Create a StorageBacking instance of datastore type. library_backing = library_client.StorageBacking() library_backing.type = library_client.StorageBacking.Type.DATASTORE # Pass the value of the datastore managed object reference. # ThevSphere Automation SDK for Pythoncontains # the GetDatastoreByName class, which sample resource is located in the #/client/samples/src/com/vmware/vcloud/suite/sample/vim/helpers/directory. # You can use the utility to retrieve the managed object reference of the datastore entity. library_backing.datastore_id = ‘datastore-123’ # Create a LibraryModel that represents a local library backed on a datastore. library_model = content_client.LibraryModel() library_model.name = ‘AcmeLibrary’ library_model.storage_backings = [library_backing]