@Override public void success() { logger.debug(String.format("successfully released vip[uuid:%s, name:%s, ip:%s] on service[%s]", self.getUuid(), self.getName(), self.getIp(), self.getServiceProvider())); VipUseForList useForList = new VipUseForList(self.getUseFor()); self.setUseFor(null); clearPeerL3Network(); self.setServiceProvider(null); dbf.update(self); completion.success(); }
protected boolean releaseCheckModifyVipAttributeStruct( ModifyVipAttributesStruct s) { VipUseForList useForList = new VipUseForList(self.getUseFor()); if (s.isUserFor() && s.getUseFor().equals(NetworkServiceType.SNAT.toString())) { useForList.del(s.getUseFor()); if (useForList.getUseForList().isEmpty()){ /* snat is bound to router public interface, it is created automatically, * so it should be deleted automatically, but don't need to remove from backend */ dbf.remove(self); } else { self.setUseFor(useForList.toString()); dbf.update(self); } return false; } for (VipGetServiceReferencePoint ext : pluginRgty.getExtensionList(VipGetServiceReferencePoint.class)) { VipGetServiceReferencePoint.ServiceReference service = ext.getServiceReference(self.getUuid()); if (service.useFor.equals(s.getUseFor()) && service.count <= 1){ useForList.del(s.getUseFor()); self.setUseFor(useForList.toString()); dbf.update(self); } } if (useForList.getUseForList().isEmpty()){ return true; } else { return false; } }
@Override public void success() { logger.debug(String.format("successfully acquired vip[uuid:%s, name:%s, ip:%s] on service[%s]", self.getUuid(), self.getName(), self.getIp(), s.getServiceProvider())); VipUseForList useForList = new VipUseForList(self.getUseFor()); useForList.add(s.getUseFor()); VipVO vo = Q.New(VipVO.class).eq(VipVO_.uuid, self.getUuid()).find(); vo.setUseFor(useForList.toString()); dbf.updateAndRefresh(vo); addPeerL3NetworkUuid(s.getPeerL3NetworkUuid()); completion.success(); }
protected boolean acquireCheckModifyVipAttributeStruct(ModifyVipAttributesStruct s) { if (s.isUserFor()) { VipUseForList useForList = new VipUseForList(self.getUseFor()); useForList.add(s.getUseFor()); self.setUseFor(useForList.toString()); } if (s.isServiceProvider()) { if (self.getServiceProvider() != null && s.getServiceProvider() != null && !s.getServiceProvider().equals(self.getServiceProvider())) { throw new OperationFailureException(operr("service provider of the vip[uuid:%s, name:%s, ip: %s] has been set to %s", self.getUuid(), self.getName(), self.getIp(), self.getServiceProvider())); } self.setServiceProvider(s.getServiceProvider()); } if (s.isPeerL3NetworkUuid()) { try { if (s.isServiceProvider()) { addPeerL3NetworkUuid(s.getPeerL3NetworkUuid()); } } catch (CloudRuntimeException e) { throw new OperationFailureException(operr(e.getMessage())); } } self = dbf.updateAndRefresh(self); /* snat service is bound the router interface, don't need to bound to backend */ if (s.getUseFor().equals(NetworkServiceType.SNAT.toString())) { return false; } return s.isPeerL3NetworkUuid() && s.isServiceProvider(); }
vipvo.setNetmask(nic.getNetmask()); vipvo.setUsedIpUuid(nic.getUsedIpUuid()); vipvo.setUseFor(VirtualRouterConstant.SNAT_NETWORK_SERVICE_TYPE); vipvo.setAccountUuid(accountUuid); if(!vr.getGuestL3Networks().isEmpty()){