mirror of
https://github.com/ctripcorp/zeus.git
synced 2024-09-22 00:26:05 +08:00
Merge branch 'hotfix_slb_addvip' into module_dev
This commit is contained in:
commit
d0072df419
|
@ -33,6 +33,8 @@ public class AppQueryImpl implements AppQuery {
|
|||
private SlbDomainDao slbDomainDao;
|
||||
@Resource
|
||||
private SlbVirtualServerDao slbVirtualServerDao;
|
||||
@Resource
|
||||
private SlbVipDao slbVipDao;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -135,10 +137,20 @@ public class AppQueryImpl implements AppQuery {
|
|||
for (AppSlbDo d : list) {
|
||||
AppSlb e = C.toAppSlb(d);
|
||||
app.addAppSlb(e);
|
||||
querySlbVips(d.getSlbName(), e);
|
||||
queryVirtualServer(d.getSlbName(), d.getSlbVirtualServerName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void querySlbVips(String slbName, AppSlb appSlb) throws DalException {
|
||||
SlbDo sd = slbDao.findByName(slbName, SlbEntity.READSET_FULL);
|
||||
List<SlbVipDo> list = slbVipDao.findAllBySlb(sd.getId(), SlbVipEntity.READSET_FULL);
|
||||
for (SlbVipDo d : list) {
|
||||
Vip e = C.toVip(d);
|
||||
appSlb.addVip(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void queryVirtualServer(String slbName, String slbVirtualServerName, AppSlb appSlb) throws DalException {
|
||||
SlbDo slbDo = slbDao.findByName(slbName, SlbEntity.READSET_FULL);
|
||||
SlbVirtualServerDo d = slbVirtualServerDao.findAllBySlbAndName(slbDo.getId(), slbVirtualServerName, SlbVirtualServerEntity.READSET_FULL);
|
||||
|
|
|
@ -183,11 +183,12 @@ public class SlbQueryImpl implements SlbQuery {
|
|||
List<AppSlb> list = new ArrayList<>();
|
||||
for (AppSlbDo asd : appSlbDao.findAllByApps(appNames, AppSlbEntity.READSET_FULL)) {
|
||||
AppSlb as = C.toAppSlb(asd);
|
||||
list.add(as);
|
||||
SlbDo sd = slbDao.findByName(as.getSlbName(), SlbEntity.READSET_FULL);
|
||||
SlbVirtualServerDo svsd = slbVirtualServerDao.findAllBySlbAndName(sd.getId(), asd.getSlbVirtualServerName(), SlbVirtualServerEntity.READSET_FULL);
|
||||
if (svsd != null)
|
||||
as.setVirtualServer(C.toVirtualServer(svsd));
|
||||
list.add(as);
|
||||
querySlbVips(sd.getId(), as);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -197,11 +198,12 @@ public class SlbQueryImpl implements SlbQuery {
|
|||
List<AppSlb> list = new ArrayList<>();
|
||||
for (AppSlbDo asd : appSlbDao.findAllBySlb(slbName, AppSlbEntity.READSET_FULL)) {
|
||||
AppSlb as = C.toAppSlb(asd);
|
||||
list.add(as);
|
||||
SlbDo sd = slbDao.findByName(slbName, SlbEntity.READSET_FULL);
|
||||
SlbVirtualServerDo svsd = slbVirtualServerDao.findAllBySlbAndName(sd.getId(), asd.getSlbVirtualServerName(), SlbVirtualServerEntity.READSET_FULL);
|
||||
if (svsd != null)
|
||||
as.setVirtualServer(C.toVirtualServer(svsd));
|
||||
list.add(as);
|
||||
querySlbVips(sd.getId(), as);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -230,6 +232,14 @@ public class SlbQueryImpl implements SlbQuery {
|
|||
}
|
||||
}
|
||||
|
||||
private void querySlbVips(long slbId, AppSlb appSlb) throws DalException {
|
||||
List<SlbVipDo> list = slbVipDao.findAllBySlb(slbId, SlbVipEntity.READSET_FULL);
|
||||
for (SlbVipDo d : list) {
|
||||
Vip e = C.toVip(d);
|
||||
appSlb.addVip(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void querySlbServers(long slbId, Slb slb) throws DalException {
|
||||
List<SlbServerDo> list = slbServerDao.findAllBySlb(slbId, SlbServerEntity.READSET_FULL);
|
||||
for (SlbServerDo d : list) {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<entity name="model" root="true">
|
||||
<entity-ref name="slb" />
|
||||
<entity-ref name="slb-list" />
|
||||
<entity-ref name="vip" />
|
||||
<entity-ref name="app" />
|
||||
<entity-ref name="archive" />
|
||||
<entity-ref name="app-list" />
|
||||
|
@ -63,6 +64,7 @@
|
|||
<element name="app-name" value-type="String" />
|
||||
<element name="slb-name" value-type="String" />
|
||||
<element name="path" value-type="String" />
|
||||
<entity-ref name="vip" type="list" names="slb-vips" xml-indent="true" />
|
||||
<entity-ref name="virtual-server" />
|
||||
</entity>
|
||||
<entity name="health-check">
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<nginx-conf>/usr/local/nginx/conf</nginx-conf>
|
||||
<nginx-worker-processes>1</nginx-worker-processes>
|
||||
<vips>
|
||||
<vip ip="192.168.1.1"/>
|
||||
<vip ip="192.168.1.2"/>
|
||||
<vip/>
|
||||
<vip/>
|
||||
</vips>
|
||||
<slb-servers>
|
||||
<slb-server slb-id="1" ip="192.168.1.1" host-name="slb001" enable="true"/>
|
||||
|
@ -38,17 +38,27 @@
|
|||
</slbs>
|
||||
</slb-list>
|
||||
|
||||
<vip ip="192.168.1.1"/>
|
||||
|
||||
<app name="gateway" app-id="app921822" version="1">
|
||||
<app-slbs>
|
||||
<app-slb>
|
||||
<app-name>gateway</app-name>
|
||||
<slb-name>default</slb-name>
|
||||
<slb-vips>
|
||||
<vip/>
|
||||
<vip/>
|
||||
</slb-vips>
|
||||
<path>/hotel</path>
|
||||
<virtual-server/>
|
||||
</app-slb>
|
||||
<app-slb>
|
||||
<app-name>gateway</app-name>
|
||||
<slb-name>default</slb-name>
|
||||
<slb-vips>
|
||||
<vip ip="192.168.1.1"/>
|
||||
<vip ip="192.168.1.2"/>
|
||||
</slb-vips>
|
||||
<path>/hotel</path>
|
||||
<virtual-server/>
|
||||
</app-slb>
|
||||
|
|
Loading…
Reference in a new issue