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
In the current implementation, it stores the name of the RbVmomi object in props_to_attr_hash method. However, in my vCenter, some RbVmomi objects have the same name like datacenter, cluster, resource pool etc as they are stored in different folders. It will be hard to distinguish for those RbVmomi objects with the same name. Therefore, I suggest to store the ID or the object itself for differentiation.
Below is my code suggestion:
attrs['datacenter'] = proc {
begin
if has_permission_to_access_host
parent_attribute(host.path, :datacenter)[0] # or parent_attribute(host.path, :datacenter)[0]._ref
else
parent_attribute(vm_mob_ref.path, :datacenter)[0] # or parent_attribute(vm_mob_ref.path, :datacenter)[0]._ref
end
rescue
nil
end
}
attrs['cluster'] = proc {
begin
parent_attribute(host.path, :cluster)[0] # or parent_attribute(host.path, :cluster)[0]._ref
rescue
nil
end
}
attrs['hypervisor'] = proc {
begin
host._ref
rescue
nil
end
}
attrs['resource_pool'] = proc {
begin
(vm_mob_ref.resourcePool || host.resourcePool)._ref
rescue
nil
end
}
The text was updated successfully, but these errors were encountered:
In the current implementation, it stores the name of the RbVmomi object in props_to_attr_hash method. However, in my vCenter, some RbVmomi objects have the same name like datacenter, cluster, resource pool etc as they are stored in different folders. It will be hard to distinguish for those RbVmomi objects with the same name. Therefore, I suggest to store the ID or the object itself for differentiation.
Below is my code suggestion:
The text was updated successfully, but these errors were encountered: