Class | Fog::Compute::Vsphere::Real
In: | lib/fog/vsphere/compute.rb lib/fog/vsphere/requests/compute/get_virtual_machine.rb lib/fog/vsphere/requests/compute/get_network.rb lib/fog/vsphere/requests/compute/list_vm_interfaces.rb lib/fog/vsphere/requests/compute/vm_power_off.rb lib/fog/vsphere/requests/compute/list_datacenters.rb lib/fog/vsphere/requests/compute/list_folders.rb lib/fog/vsphere/requests/compute/list_datastores.rb lib/fog/vsphere/requests/compute/get_datacenter.rb lib/fog/vsphere/requests/compute/create_vm.rb lib/fog/vsphere/requests/compute/get_cluster.rb lib/fog/vsphere/requests/compute/list_resource_pools.rb lib/fog/vsphere/requests/compute/get_datastore.rb lib/fog/vsphere/requests/compute/vm_power_on.rb lib/fog/vsphere/requests/compute/vm_reconfig_cpus.rb lib/fog/vsphere/requests/compute/get_resource_pool.rb lib/fog/vsphere/requests/compute/vm_reconfig_memory.rb lib/fog/vsphere/requests/compute/vm_destroy.rb lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb lib/fog/vsphere/requests/compute/get_folder.rb lib/fog/vsphere/requests/compute/create_folder.rb lib/fog/vsphere/requests/compute/vm_reboot.rb lib/fog/vsphere/requests/compute/current_time.rb lib/fog/vsphere/requests/compute/list_vm_volumes.rb lib/fog/vsphere/requests/compute/vm_clone.rb lib/fog/vsphere/requests/compute/list_virtual_machines.rb lib/fog/vsphere/requests/compute/vm_config_vnc.rb lib/fog/vsphere/requests/compute/vm_migrate.rb lib/fog/vsphere/requests/compute/list_networks.rb lib/fog/vsphere/requests/compute/list_clusters.rb
Parent: | Object

### Methods

child_folders cluster_attributes create_folder create_vm current_time datastore_attributes find_datacenters find_raw_datacenter folder_attributes folder_type get_cluster get_datacenter get_datastore get_folder get_network get_raw_cluster get_raw_datacenter get_raw_datastore get_raw_network get_raw_resource_pool get_raw_vmfolder get_raw_vmfolders get_resource_pool get_virtual_machine get_vm_ref list_clusters list_datacenters list_datastores list_folders list_networks list_raw_resource_pools list_resource_pools list_virtual_machines list_vm_interfaces list_vm_volumes network_attributes new raw_clusters raw_datacenters raw_datastores raw_networks resource_pool_attributes vm_clone vm_config_vnc vm_destroy vm_get_vnc vm_migrate vm_power_off vm_power_on vm_reboot vm_reconfig_cpus vm_reconfig_hardware vm_reconfig_memory

### Included Modules

Shared Shared

### Public Class methods

new(options={})

### Public Instance methods

create_folder(datacenter, path, name)
create_vm(attributes = { })
current_time()
get_cluster(name, datacenter_name)
get_datacenter(name)
get_datastore(name, datacenter_name)
get_folder(path, datacenter_name, type = nil)
get_network(name, datacenter_name)
get_resource_pool(name, cluster_name, datacenter_name)
get_virtual_machine(id, datacenter_name = nil)
list_clusters(filters = { })
list_datacenters(filters = {})
list_datastores(filters = { })
list_folders(filters = { })

Grabs all sub folders within a given path folder.

#### Parameters

- filters<~Hash>:
  - :datacenter<~String> - REQUIRED Your datacenter where you‘re looking for folders. Example: ‘my-datacenter-name’ (passed if you are using the models/collections)

          eg: vspconn.datacenters.first.vm_folders('mypath')

  - :path<~String> - Your path where you‘re looking for more folders, if return = none you will get an error. If you don‘t define it will look in the main datacenter folder for any folders in that datacenter.

Example Usage Testing Only:

     vspconn = Fog::Compute[:vsphere]
     mydc = vspconn.datacenters.first
     folders = mydc.vm_folders

list_networks(filters = { })
list_resource_pools(filters = { })
list_virtual_machines(options = { })
list_vm_interfaces(vm_id)

     => VirtualE1000(

addressType: "assigned", backing: VirtualEthernetCardNetworkBackingInfo(

      deviceName: "VM Network",
      dynamicProperty: [],
      network: Network("network-163"),
      useAutoDetect: false

), connectable: VirtualDeviceConnectInfo(

      allowGuestControl: true,
      connected: true,
      dynamicProperty: [],
      startConnected: true,
      status: "ok"

), controllerKey: 100, deviceInfo: Description(

      dynamicProperty: [],
      label: "Network adapter 1",
      summary: "VM Network"

), dynamicProperty: [], key: 4000, macAddress: "00:50:56:a9:00:28", unitNumber: 7,

list_vm_volumes(vm_id)

     [VirtualDisk(
      backing: VirtualDiskFlatVer2BackingInfo(
        contentId: "a172d19487e878e17d6b16ff2505d7eb",
        datastore: Datastore("datastore-162"),
        diskMode: "persistent",
        dynamicProperty: [],
        fileName: "[Storage1] rhel6-mfojtik/rhel6-mfojtik.vmdk",
        split: false,
        thinProvisioned: true,
        uuid: "6000C29c-a47d-4cd9-5249-c371de775f06",
        writeThrough: false
      ),
      capacityInKB: 8388608,
      controllerKey: 1000,
      deviceInfo: Description(
        dynamicProperty: [],
        label: "Hard disk 1",
        summary: "8,388,608 KB"
      ),
      dynamicProperty: [],
      key: 2001,
      shares: SharesInfo( dynamicProperty: [], level: "normal", shares: 1000 ),
      unitNumber: 1

)]

raw_clusters(datacenter)
raw_datastores(datacenter_name)
raw_networks(datacenter_name)
vm_clone(options = {})

Clones a VM from a template or existing machine on your vSphere Server.

#### Parameters

- options<~Hash>:
  - ‘datacenter’<~String> - REQUIRED Datacenter name your cloning in. Make sure this datacenter exists, should if you‘re using the clone function in server.rb model.
  - ‘template_path’<~String> - REQUIRED The path to the machine you want to clone FROM. Relative to Datacenter (Example: "FolderNameHere/VMNameHere")
  - ‘name’<~String> - REQUIRED The VMName of the Destination
  - ‘dest_folder’<~String> - Destination Folder of where ‘name’ will be placed on your cluster. Relative Path to Datacenter E.G. "FolderPlaceHere/anotherSub Folder/onemore"
  - ‘power_on’<~Boolean> - Whether to power on machine after clone. Defaults to true.
  - ‘wait’<~Boolean> - Whether the method should wait for the virtual machine to finish cloning before returning information from vSphere. Broken right now as you cannot return a model of a serer that isn‘t finished cloning. Defaults to True
  - ‘resource_pool’<~Array> - The resource pool on your datacenter cluster you want to use. Only works with clusters within same same datacenter as where you‘re cloning from. Datacenter grabbed from template_path option. Example: [‘cluster_name_here’,’resource_pool_name_here’]
  - ‘datastore’<~String> - The datastore you‘d like to use.

          (datacenterObj.datastoreFolder.find('name') in API)

  - ‘transform’<~String> - Not documented - see www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.RelocateSpec.html
  - customization_spec<~Hash>: Options are marked as required if you use this customization_spec. Static IP Settings not configured. This only support cloning and setting DHCP on the first interface
    - ‘domain’<~String> - REQUIRED This is put into /etc/resolve.conf (we hope)
    - ‘hostname’<~String> - Hostname of the Guest Os - default is options[‘name’]
    - ‘hw_utc_clock’<~Boolean> - REQUIRED Is hardware clock UTC? Default true
    - ‘time_zone’<~String> - REQUIRED Only valid linux options are valid - example: ‘America/Denver‘

vm_config_vnc(options = { })
vm_destroy(options = {})
vm_get_vnc(uuid)

return a hash of VNC attributes required to view the console

vm_migrate(options = {})
vm_power_off(options = {})
vm_power_on(options = {})
vm_reboot(options = {})
vm_reconfig_cpus(options = {})
vm_reconfig_hardware(options = {})
vm_reconfig_memory(options = {})

### Protected Instance methods

child_folders(folder)
cluster_attributes(cluster, datacenter_name)
datastore_attributes(datastore, datacenter)
find_datacenters(name=nil)
find_raw_datacenter(name)
folder_attributes(folder, datacenter_name)
folder_type(folder)
get_raw_cluster(name, datacenter_name)
get_raw_datacenter(name)
get_raw_datastore(name, datacenter_name)
get_raw_network(name, datacenter_name)
get_raw_resource_pool(name, cluster_name, datacenter_name)
get_raw_vmfolder(path, datacenter_name)
get_raw_vmfolders(path, datacenter_name)
get_vm_ref(id, dc = nil)
list_raw_resource_pools(cluster)

root ResourcePool + Children if they exists

network_attributes(network, datacenter)
raw_datacenters()
resource_pool_attributes(resource_pool, cluster, datacenter)

[Validate]