Class FcdMetadataOperations


  • @Sample(name="fcd-metatdataoperations",
            description="This sample creates FCD with metadata, retrieves metadata, retrieves metadata value and update metadata from vslm.")
    public class FcdMetadataOperations
    extends com.vmware.connection.ConnectedVimServiceBase
     FcdMetadataOperations
    
     This sample executes metadata related
     operations on a given VStorageObject from vslm:
    
     1. Create VStorageObject with metadata.
     2. Retrieve metadata key-value pairs from a virtual storage object.
     3. Retrieve the metadata value by key from a virtual storage object.
     4. Updates metadata key-value pairs to a virtual storage object.
    
     Pre-requisite :        1. Existing VStorageObject name
    
     Parameters:
     url                    [required] : url of the web service
     username               [required] : username for the authentication
     password               [required] : password for the authentication
     vstorageobjectname     [required] : name of the vstorageobject to be created
     datastoreName          [required] : Name of the datastore
     vstorageobjectsizeinMB [required] : Size of the disk(in MB)
     provisioningtype       [optional] : Type of provisioning for the disk
                                         [thin | eagerZeroedThick |
                                         lazyZeroedThick | virtualMode |
                                         physicalMode]
     devicename             [optional] : Canonical name of the LUN to use for disk types
    
     Command Line:
     run.bat com.vmware.fcd.FcdMetadataOperations --url [webserviceurl]
     --username [username] --password [password]
     --vstorageobjectid [vstorageobjectid] --datastoreName [datastoreName]
     --vstorageobjectsizeinMB  [vstorageobjectsizeinMB ]
     
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.vmware.connection.ConnectedVimServiceBase

        com.vmware.connection.ConnectedVimServiceBase.ConnectionException
    • Field Summary

      • Fields inherited from class com.vmware.connection.ConnectedVimServiceBase

        PROP_ME_NAME, SVC_INST_NAME
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<com.vmware.vim25.KeyValue> generateMetadataPair​(int numberOfMetadataToCreate)
      This method creates metadata key-value pairs
      com.vmware.vim25.VslmCreateSpec generateVslmCreateSpec​(com.vmware.vim25.ManagedObjectReference dsMor, com.vmware.fcd.FcdMetadataOperations.DiskProvisioningTypes provisioningType)
      This method constructs a VslmCreateSpec for the vStorageObject
      static java.lang.String getFcdFilePath​(com.vmware.vim25.VStorageObject vStorageObject)
      Util method to get the FilePath of a given VStorageObject.
      void init()  
      static boolean isSnapshotIdInSnapshotList​(com.vmware.vim25.VStorageObjectSnapshotInfo retrievedSnapshotInfo, com.vmware.vim25.ID snapshotId)
      Verify if Snapshot Id is included in retrievedSnapshotInfo
      void run()  
      void setDatastoreName​(java.lang.String datastoreName)  
      void setDeviceName​(java.lang.String deviceName)  
      void setProvisioningType​(java.lang.String provisioningType)  
      void setVStorageObjectName​(java.lang.String vStorageObjectName)  
      void setVStorageObjectSize​(long vStorageObjectSizeInMB)  
      • Methods inherited from class com.vmware.connection.ConnectedVimServiceBase

        basicConnectionFromConnection, connect, disconnect, getServiceInstanceReference, setConnection, setHostConnection
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FcdMetadataOperations

        public FcdMetadataOperations()
    • Method Detail

      • setVStorageObjectName

        @Option(name="vstorageobjectname",
                required=true,
                description="Name of the Disk.")
        public void setVStorageObjectName​(java.lang.String vStorageObjectName)
        Parameters:
        vStorageObjectName - the vStorageObjectName to set
      • setDatastoreName

        @Option(name="datastorename",
                required=true,
                description="Name of datastore.")
        public void setDatastoreName​(java.lang.String datastoreName)
        Parameters:
        datastoreName - the datastoreName to set
      • setVStorageObjectSize

        @Option(name="vstorageobjectsizeinMB",
                required=true,
                description="Size of the Disk (in MB)")
        public void setVStorageObjectSize​(long vStorageObjectSizeInMB)
        Parameters:
        vStorageObjectSizeInMB - the vStorageObjectSizeInMB to set
      • setProvisioningType

        @Option(name="provisioningtype",
                required=false,
                description="Provisioning Type of the Disk.\n [thin | eagerZeroedThick | lazyZeroedThick | virtualMode | physicalMode]")
        public void setProvisioningType​(java.lang.String provisioningType)
        Parameters:
        provisioningType - the provisioningType to set
      • setDeviceName

        @Option(name="devicename",
                required=false,
                description="Canonical name of the LUN to use for RDM provisioning type.")
        public void setDeviceName​(java.lang.String deviceName)
        Parameters:
        deviceName - the deviceName to set
      • init

        @Before
        public void init()
      • isSnapshotIdInSnapshotList

        public static boolean isSnapshotIdInSnapshotList​(com.vmware.vim25.VStorageObjectSnapshotInfo retrievedSnapshotInfo,
                                                         com.vmware.vim25.ID snapshotId)
        Verify if Snapshot Id is included in retrievedSnapshotInfo
        Parameters:
        retrievedSnapshotInfo - VStorageObjectSnapshotInfo containing snapshot list of VStorageObject
        snapshotId - Snapshot Id of VStorageObject
        Returns:
        true if retrievedSnapshotInfo contains snapshotId details
      • generateVslmCreateSpec

        public com.vmware.vim25.VslmCreateSpec generateVslmCreateSpec​(com.vmware.vim25.ManagedObjectReference dsMor,
                                                                      com.vmware.fcd.FcdMetadataOperations.DiskProvisioningTypes provisioningType)
                                                               throws java.lang.IllegalArgumentException
        This method constructs a VslmCreateSpec for the vStorageObject
        Parameters:
        dsMor - The ManagedObjectReferece of the datastore
        provisioningType - The provisioningType of the disk
        Returns:
        VslmCreateSpec
        Throws:
        java.lang.IllegalArgumentException
      • generateMetadataPair

        public java.util.List<com.vmware.vim25.KeyValue> generateMetadataPair​(int numberOfMetadataToCreate)
        This method creates metadata key-value pairs
        Parameters:
        numberOfMetadataToCreate -
        Returns:
      • getFcdFilePath

        public static java.lang.String getFcdFilePath​(com.vmware.vim25.VStorageObject vStorageObject)
        Util method to get the FilePath of a given VStorageObject.
        Parameters:
        vStorageObject - The vStorageObject whose path is to be found.
        Returns:
        filePath of vStorageObject
      • run

        @Action
        public void run()
                 throws java.lang.Exception
        Throws:
        java.lang.Exception