Hi there
I have the following scenario:
Each user have two VLANs for his own use and should choose one of them during the VM provisioning Service Dialogue. At the moment the user can see all VLANs from vSphere. Is there any way that he can only see only his VLANs?
VLAN Naming example:
VLAN_A_johndoe
VLAN_B_johndoe
VLAN_A_chris
VLAN_B_chris
I have created a method, which lists all available VLANs from the vSphere with the following Script. Is there any way to get only the user owned VLANs by filter something like "vlan = vlan.where(:name=>$username)?
Script
begin
lans = {}
cluster = $evm.vmdb(:ems_cluster).where(:name =>My Cluster).first
cluster.hosts.each do |host|
lans[’!’] = ‘-- select from list --’
host.lans.each do |lan|
lans[“dvs_#{lan.name}”] = “dvs_#{lan.name}”
end
end
list_values = {
‘sort_by’ => :value,
‘data_type’ => :string,
‘required’ => true,
‘values’ => lans
}
list_values.each { |key, value| $evm.object[key] = value }
rescue => err
$evm.log(:error, “[#{err}]\n#{err.backtrace.join(”\n")}")
exit MIQ_STOP
end