Object
# File lib/fog/vsphere/compute.rb, line 87 def initialize(options={}) require 'rbvmomi' @vsphere_username = options[:vsphere_username] @vsphere_password = 'REDACTED' @vsphere_server = options[:vsphere_server] @vsphere_expected_pubkey_hash = options[:vsphere_expected_pubkey_hash] @vsphere_is_vcenter = true @vsphere_rev = '4.0' end
# File lib/fog/vsphere/requests/compute/current_time.rb, line 15 def current_time { 'current_time' => Time.now.utc } end
# File lib/fog/vsphere/requests/compute/datacenters.rb, line 28 def datacenters [ "Solutions", "Solutions2", "Solutions3" ] end
# File lib/fog/vsphere/requests/compute/list_virtual_machines.rb, line 133 def get_folder_path(folder, root = nil) nil end
# File lib/fog/vsphere/requests/compute/list_virtual_machines.rb, line 137 def list_virtual_machines(options = {}) case options['instance_uuid'] when nil rval = YAML.load ---virtual_machines:- name: centos56gm hypervisor: gunab.puppetlabs.lan tools_version: guestToolsCurrent ipaddress: mo_ref: vm-698 power_state: poweredOff uuid: 42322347-d791-cd34-80b9-e25fe28ad37c is_a_template: true id: 50323f93-6835-1178-8b8f-9e2109890e1a tools_state: toolsNotRunning connection_state: connected instance_uuid: 50323f93-6835-1178-8b8f-9e2109890e1a hostname: mac_addresses: Network adapter 1: 00:50:56:b2:00:a1 operatingsystem:- name: centos56gm2 hypervisor: gunab.puppetlabs.lan tools_version: guestToolsCurrent ipaddress: mo_ref: vm-640 power_state: poweredOff uuid: 564ddcbe-853a-d29a-b329-a0a3693a004d is_a_template: true id: 5257dee8-050c-cbcd-ae25-db0e582ab530 tools_state: toolsNotRunning connection_state: connected instance_uuid: 5257dee8-050c-cbcd-ae25-db0e582ab530 hostname: mac_addresses: Network adapter 1: 00:0c:29:3a:00:4d operatingsystem:- name: dashboard_gm hypervisor: gunab.puppetlabs.lan tools_version: guestToolsCurrent ipaddress: 192.168.100.184 mo_ref: vm-669 power_state: poweredOn uuid: 564d3f91-3452-a509-a678-1246f7897979 is_a_template: false id: 5032739c-c871-c0d2-034f-9700a0b5383e tools_state: toolsOk connection_state: connected instance_uuid: 5032739c-c871-c0d2-034f-9700a0b5383e hostname: compliance.puppetlabs.vm mac_addresses: Network adapter 1: 00:50:56:b2:00:96 operatingsystem: Red Hat Enterprise Linux 6 (64-bit)- name: jefftest hypervisor: gunab.puppetlabs.lan tools_version: guestToolsCurrent ipaddress: 192.168.100.187 mo_ref: vm-715 power_state: poweredOn uuid: 42329da7-e8ab-29ec-1892-d6a4a964912a is_a_template: false id: 5032c8a5-9c5e-ba7a-3804-832a03e16381 tools_state: toolsOk connection_state: connected instance_uuid: 5032c8a5-9c5e-ba7a-3804-832a03e16381 hostname: centos56gm.localdomain mac_addresses: Network adapter 1: 00:50:56:b2:00:af operatingsystem: CentOS 4/5 (32-bit) when '5032c8a5-9c5e-ba7a-3804-832a03e16381' YAML.load ---virtual_machines:- name: jefftest hypervisor: gunab.puppetlabs.lan tools_version: guestToolsCurrent ipaddress: 192.168.100.187 mo_ref: vm-715 power_state: poweredOn uuid: 42329da7-e8ab-29ec-1892-d6a4a964912a is_a_template: false id: 5032c8a5-9c5e-ba7a-3804-832a03e16381 tools_state: toolsOk connection_state: connected instance_uuid: 5032c8a5-9c5e-ba7a-3804-832a03e16381 hostname: centos56gm.localdomain mac_addresses: Network adapter 1: 00:50:56:b2:00:af operatingsystem: CentOS 4/5 (32-bit) when 'does-not-exist-and-is-not-a-uuid', '50323f93-6835-1178-8b8f-9e2109890e1a' { 'virtual_machines' => [] } end end
# File lib/fog/vsphere/requests/compute/vm_clone.rb, line 120 def vm_clone(options = {}) # Option handling options = vm_clone_check_options(options) notfound = lambda { raise Fog::Compute::Vsphere::NotFound, "Cloud not find VM template" } vm_mob_ref = list_virtual_machines['virtual_machines'].find(notfound) do |vm| vm['name'] == options['path'].split("/")[-1] end { 'vm_ref' => 'vm-123', 'task_ref' => 'task-1234' } end
# File lib/fog/vsphere/requests/compute/vm_destroy.rb, line 26 def vm_destroy(options = {}) raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' { 'task_state' => 'success' } end
# File lib/fog/vsphere/requests/compute/vm_power_off.rb, line 30 def vm_power_off(options = {}) raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' { 'task_state' => "running", 'power_off_type' => options['force'] ? 'cut_power' : 'shutdown_guest', } end
# File lib/fog/vsphere/requests/compute/vm_power_on.rb, line 22 def vm_power_on(options = {}) raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' { 'task_state' => 'success' } end
# File lib/fog/vsphere/requests/compute/vm_reboot.rb, line 27 def vm_reboot(options = {}) raise ArgumentError, "instance_uuid is a required parameter" unless options.has_key? 'instance_uuid' { 'task_state' => "running", 'reboot_type' => options['force'] ? 'reset_power' : 'reboot_guest' } end
Generated with the Darkfish Rdoc Generator 2.