Class VMCreate


  • @Sample(name="vm-create",
            description="This sample creates a VM based on a storage profile.")
    public class VMCreate
    extends ConnectedServiceBase
     VMCreate
    
     This sample creates a VM with a storage policy based management profile.
     The VM uses the datastores configured with the host.
    
     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
     datacentername   [required] : Name of the datacenter
     hostname         [required] : Name of the host
     profilename      [required] : Name of the storage profile
     guestosid        [optional] : Type of Guest OS
     cpucount         [optional] : Total cpu count
     disksize         [optional] : Size of the Disk
     memorysize       [optional] : Size of the Memory in 1024MB blocks
     datastorename    [optional] : Name of dataStore
    
     Command Line:
     Create a VM given datacenter, host names and storage profile name
     run.bat com.vmware.vm.VMCreate --url [webserviceurl]
     --username [username] --password [password] --vmname [vmname]
     --datacentername [DataCenterName] --hostname [hostname]
     --profilename [Storage Profile Name]
    
     Create a VM given its name, Datacenter name, storage profile name and GuestOsId
     run.bat com.vmware.vm.VMCreate --url [webserviceurl]
     --username [username] --password [password] --vmname [vmname]
     --datacentername [DataCenterName] --guestosid [GuestOsId]
     --profilename [Storage Profile Name]
    
     Create a VM given its name, Datacenter name, storage profile name and its cpucount
     run.bat com.vmware.vm.VMCreate --url [webserviceurl]
     --username [username] --password [password] --vmname [vmname]
     --datacentername [DataCenterName] --cpucount [cpucount]
     --profilename [Storage Profile Name]
     
    • Constructor Detail

      • VMCreate

        public VMCreate()
    • Method Detail

      • run

        @Action
        public void run()
                 throws com.vmware.vim25.RuntimeFaultFaultMsg,
                        com.vmware.vim25.VmConfigFaultFaultMsg,
                        com.vmware.vim25.AlreadyExistsFaultMsg,
                        com.vmware.vim25.InvalidDatastoreFaultMsg,
                        com.vmware.vim25.FileFaultFaultMsg,
                        com.vmware.vim25.InvalidStateFaultMsg,
                        com.vmware.vim25.InvalidCollectorVersionFaultMsg,
                        com.vmware.vim25.InvalidNameFaultMsg,
                        com.vmware.vim25.OutOfBoundsFaultMsg,
                        com.vmware.vim25.DuplicateNameFaultMsg,
                        com.vmware.vim25.InsufficientResourcesFaultFaultMsg,
                        com.vmware.vim25.InvalidPropertyFaultMsg,
                        java.rmi.RemoteException,
                        com.vmware.vim25.TaskInProgressFaultMsg,
                        com.vmware.pbm.InvalidArgumentFaultMsg,
                        com.vmware.pbm.RuntimeFaultFaultMsg
        Throws:
        com.vmware.vim25.RuntimeFaultFaultMsg
        com.vmware.vim25.VmConfigFaultFaultMsg
        com.vmware.vim25.AlreadyExistsFaultMsg
        com.vmware.vim25.InvalidDatastoreFaultMsg
        com.vmware.vim25.FileFaultFaultMsg
        com.vmware.vim25.InvalidStateFaultMsg
        com.vmware.vim25.InvalidCollectorVersionFaultMsg
        com.vmware.vim25.InvalidNameFaultMsg
        com.vmware.vim25.OutOfBoundsFaultMsg
        com.vmware.vim25.DuplicateNameFaultMsg
        com.vmware.vim25.InsufficientResourcesFaultFaultMsg
        com.vmware.vim25.InvalidPropertyFaultMsg
        java.rmi.RemoteException
        com.vmware.vim25.TaskInProgressFaultMsg
        com.vmware.pbm.InvalidArgumentFaultMsg
      • setCpuCount

        @Option(name="cpucount",
                required=false,
                description="Total cpu count")
        public void setCpuCount​(java.lang.String cpuCount)
      • setDataCenterName

        @Option(name="datacentername",
                description="Name of the datacenter")
        public void setDataCenterName​(java.lang.String dcname)
      • setDataStore

        @Option(name="datastorename",
                required=false,
                description="Name of dataStore")
        public void setDataStore​(java.lang.String dsname)
      • setDiskSize

        @Option(name="disksize",
                required=false,
                description="Size of the Disk")
        public void setDiskSize​(java.lang.String size)
      • setGuestOsId

        @Option(name="guestosid",
                required=false,
                description="Type of Guest OS [Windows|Posix]")
        public void setGuestOsId​(java.lang.String guestOsId)
      • setHostname

        @Option(name="hostname",
                description="Name of the host")
        public void setHostname​(java.lang.String hostname)
      • setMemorySize

        @Option(name="memorysize",
                required=false,
                description="Size of Memory in 1024MB blocks. eg. 2048")
        public void setMemorySize​(java.lang.String memorySize)
      • setProfileName

        @Option(name="profilename",
                description="Name of the storage profile",
                required=true)
        public void setProfileName​(java.lang.String profileName)
      • setVirtualMachineName

        @Option(name="vmname",
                description="Name of the virtual machine")
        public void setVirtualMachineName​(java.lang.String vmname)