You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.
The code for searching a folder in the method findByUuid allows for searching by instanceUuid which is the only unchanging and completely unique identifier for a VM. However, this implementation of it forces the instanceUuid to always be false. It would be nice if we could pass in a parameter to allow usage of instance Uuid.
Relevant code: (In VIM/Folder.rb)
def findByUuid uuid, type=RbVmomi::VIM::VirtualMachine, dc=nil
propSpecs = {
:entity => self, :uuid => uuid, :instanceUuid => false,
:vmSearch => type == RbVmomi::VIM::VirtualMachine
}
propSpecs[:datacenter] = dc if dc
x = _connection.searchIndex.FindByUuid(propSpecs)
x if x.is_a? type
end
Note the force set of :instanceUuid to false with no option to make it true
The text was updated successfully, but these errors were encountered:
I would suggest that you simply add such a convenience function yourself. You can easily do this by adding such a construct to your code. RbVmomi is meant as a minimalist wrapper around the API. We have a few convenience functions, but overall we encourage those not to get bloated. The underlying API has what you need, so it's best to just go ahead and use it.
RbVmomi::VIM::Folder
class RbVmomi::VIM::Folder
def findByUuidEx(...)
....
end
end
Bloated? You could just modify this method to include it as an optional parameter:
def findByUuid uuid, type=RbVmomi::VIM::VirtualMachine, dc=nil, instanceUuid=false
propSpecs = {
:entity => self, :uuid => uuid, :instanceUuid => instanceUuid,
:vmSearch => type == RbVmomi::VIM::VirtualMachine
}
propSpecs[:datacenter] = dc if dc
x = _connection.searchIndex.FindByUuid(propSpecs)
x if x.is_a? type
end
Such a minor change and it's a method people use a lot in all of the various languages
The code for searching a folder in the method findByUuid allows for searching by instanceUuid which is the only unchanging and completely unique identifier for a VM. However, this implementation of it forces the instanceUuid to always be false. It would be nice if we could pass in a parameter to allow usage of instance Uuid.
Relevant code: (In VIM/Folder.rb)
def findByUuid uuid, type=RbVmomi::VIM::VirtualMachine, dc=nil
propSpecs = {
:entity => self, :uuid => uuid, :instanceUuid => false,
:vmSearch => type == RbVmomi::VIM::VirtualMachine
}
propSpecs[:datacenter] = dc if dc
x = _connection.searchIndex.FindByUuid(propSpecs)
x if x.is_a? type
end
Note the force set of :instanceUuid to false with no option to make it true
The text was updated successfully, but these errors were encountered: