]> review.fuel-infra Code Review - openstack-build/neutron-build.git/blob
e673115b1a46c5a968b0ba645ed3d9e105ce1968
[openstack-build/neutron-build.git] /
1 \r
2 #property("summary", "Init Indexes - date: [2013-05-08]")\r
3 \r
4 #param("vip", "ip", "in", "prompt = IP address for the virtual service")\r
5 #param("virtSvcPort", "int", "in", "prompt = Virtual service tcp port")\r
6 \r
7 ## The index of the real server group\r
8 #param("groupId", "int", "out")\r
9 \r
10 ## The index of the virtual server\r
11 #param("virtId", "int", "out")\r
12 \r
13 ## If values are new or were pre-exsiting\r
14 #param("newValues", "bool", "out")\r
15 \r
16 #set($newValues=true)\r
17 #set($virt = $adc.newBean("/c/slb/virt"))\r
18 #set($virt.ipAddress = $vip)\r
19 #set($virts = $adc.findAll($virt))\r
20 #foreach($virt in $virts)\r
21     #set($groupId = 0)\r
22     #set($virtId = $virt.index)\r
23     #set($virse=$adc.newBean("/c/slb/virt/service"))\r
24     #set($virse.VirtualServerIndex=$virtId)\r
25     #set($virse.VirtPort=$virtSvcPort)\r
26     ##consider to also set $virse.Index=0 and do $adc.Read\r
27     #set($service=$adc.findFirst($virse))\r
28     #if($adc.isNotNull($service))\r
29         #set($newValues = false)\r
30         #set($virtId = $service.VirtualServerIndex)\r
31         #set($groupId = $service.RealGroup)\r
32         #break\r
33     #end\r
34 #end\r
35 #if($newValues)\r
36     #set($virtId = $adc.getFreeIndexWithDefault("/c/slb/virt", 1))\r
37     #set($groupId = $adc.getFreeIndexWithDefault("/c/slb/group", 1))\r
38 #end\r