mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
(#9241) Add ability to find VMs by UUID
This patch adds two request methods to the compute service for VMware. First, finding a VM by it's own UUID (from the vmx file) is supported. This UUID is not guaranteed to be unique so this patch also implements finding by instance UUID which is guaranteed to be unique. The server models will primarily use these requests to obtain VM managed objects to issue commands against.
This commit is contained in:
parent
00fbdaa932
commit
d6fed7e4e4
3 changed files with 45 additions and 0 deletions
|
@ -15,6 +15,8 @@ module Fog
|
|||
request_path 'fog/vsphere/requests/compute'
|
||||
request :current_time
|
||||
request :list_virtual_machines
|
||||
request :find_all_by_uuid
|
||||
request :find_all_by_instance_uuid
|
||||
|
||||
class Mock
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Vsphere
|
||||
class Real
|
||||
|
||||
def find_all_by_instance_uuid(uuid)
|
||||
@connection.searchIndex.FindAllByUuid(:uuid => uuid, 'vmSearch' => true, 'instanceUuid' => true)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def find_all_by_instance_uuid(uuid)
|
||||
Fog::Mock.not_implmented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
22
lib/fog/vsphere/requests/compute/find_all_by_uuid.rb
Normal file
22
lib/fog/vsphere/requests/compute/find_all_by_uuid.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Vsphere
|
||||
class Real
|
||||
|
||||
def find_all_by_uuid(uuid)
|
||||
@connection.searchIndex.FindAllByUuid(:uuid => uuid, 'vmSearch' => true)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def find_all_by_uuid(uuid)
|
||||
Fog::Mock.not_implmented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Add table
Reference in a new issue