Class PutVMFiles


  • @Sample(name="put-vm-files",
            description="This sample puts VM files in specified Datacenter and Datastore and register and reconfigure the particular VM. The VM you use, should be downloaded from the vSphere you are uploading to. The name of the VM, VM folder, and VM disk files should all be the same. The name of the VM should be unique and unused on the Host. This works best if you use a VM you obtained through GetVMFiles.")
    public class PutVMFiles
    extends ConnectedVimServiceBase
     PutVMFiles
    
     This sample puts VM files in specified Datacenter and
     Datastore and register and reconfigure the particular VM
    
     Parameters:
     url              [required]: url of the web service.
     username         [required]: username for the authentication
     password         [required]: password for the authentication
     vmname           [required]: Name of the virtual machine
     localpath        [required]: Local path containing virtual machine files
     datacentername   [required]: Name of the target datacenter
     datastorename    [required]: Name of the target datastore
    
     Command Line:
     run.bat com.vmware.httpfileaccess.PutVMFiles
     --url [URLString] --username [username] --password [password]
     --vmname [VM name] --localpath [local path]
     --datacentername [datacenter name]
     --datastorename [datastore name]
     
    • Constructor Detail

      • PutVMFiles

        public PutVMFiles()
    • Method Detail

      • setVmName

        @Option(name="vmname",
                description="Name of the virutal machine to upload. Should be unique and unused. Should be the same as the name of the vm folder and vm file names.")
        public void setVmName​(java.lang.String vmName)
      • setLocalPath

        @Option(name="localpath",
                description="Local path from which files will be copied. This should be the path holding the virtual machine folder but not the vm folder itself.")
        public void setLocalPath​(java.lang.String localPath)
      • setDatacenter

        @Option(name="datacentername",
                description="Name of the target datacenter")
        public void setDatacenter​(java.lang.String datacenter)
      • setDatastore

        @Option(name="datastorename",
                description="Name of the target datastore")
        public void setDatastore​(java.lang.String datastore)
      • setVerbose

        @Option(name="verbose",
                required=false,
                description="defaults to \'true\' and prints more information, set to \'false\' to print less.")
        public void setVerbose​(java.lang.Boolean verbosity)
      • copyDir

        public void copyDir​(java.lang.String dirName)
                     throws java.io.UnsupportedEncodingException
        Copy contents of this directory up to the datastore
        Parameters:
        dirName -
        Throws:
        java.io.UnsupportedEncodingException
      • run

        @Action
        public void run()
                 throws com.vmware.vim25.RuntimeFaultFaultMsg,
                        com.vmware.vim25.InvalidPropertyFaultMsg,
                        java.io.UnsupportedEncodingException
        main method
        Throws:
        com.vmware.vim25.RuntimeFaultFaultMsg
        com.vmware.vim25.InvalidPropertyFaultMsg
        java.io.UnsupportedEncodingException