@Override public void run(FlowTrigger trigger, Map data) { StringSimilarity.refreshErrorTemplates(); eliminateErrors(); List<ElaborationVO> vos = Q.New(ElaborationVO.class).gte(ElaborationVO_.repeats, 1).eq(ElaborationVO_.matched, false).orderBy(ElaborationVO_.lastOpDate, SimpleQuery.Od.DESC).list(); if (!vos.isEmpty()) { List<String> messages = StringSimilarity.getElaborations().stream().map(ErrorCodeElaboration::getMessage_cn).collect(Collectors.toList()); for (ElaborationVO vo: vos) { if (messages.contains(vo.getErrorInfo())) { vo.setMatched(true); dbf.updateAndRefresh(vo); } } } StringSimilarity.resetCachedErrors(); trigger.next(); } }).done(new FlowDoneHandler(completion) {
static VmCdRomVO getEmptyCdRom(String vmUuid) { VmCdRomVO cdRomVO = Q.New(VmCdRomVO.class) .eq(VmCdRomVO_.vmInstanceUuid, vmUuid) .isNull(VmCdRomVO_.isoUuid) .orderBy(VmCdRomVO_.deviceId, SimpleQuery.Od.ASC) .limit(1) .find(); return cdRomVO; }
private List<String> getL3NetworkDns(String l3NetworkUuid){ List<String> dns = Q.New(L3NetworkDnsVO.class).eq(L3NetworkDnsVO_.l3NetworkUuid, l3NetworkUuid) .select(L3NetworkDnsVO_.dns).orderBy(L3NetworkDnsVO_.id, SimpleQuery.Od.ASC).listValues(); if (dns == null) { dns = new ArrayList<String>(); } L3NetworkVO l3VO = Q.New(L3NetworkVO.class).eq(L3NetworkVO_.uuid, l3NetworkUuid).find(); if (FlatNetwordProviderGlobalConfig.ALLOW_DEFAULT_DNS.value(Boolean.class) && l3VO.getIpVersion() == IPv6Constants.IPv4) { String dhcpIp = getDHCPServerIP(l3NetworkUuid); if (dhcpIp != null) { dns.add(dhcpIp); } } return dns; }
.orderBy(VmCdRomVO_.deviceId, SimpleQuery.Od.ASC) .list(); if (cdRomVOS.size() <= 1) {
private void replyLastProgress() { TaskProgressVO vo = Q.New(TaskProgressVO.class) .eq(TaskProgressVO_.apiId, msg.getApiId()) .orderBy(TaskProgressVO_.time, SimpleQuery.Od.DESC) .limit(1) .find(); .eq(TaskProgressVO_.apiId, msg.getApiId()) .eq(TaskProgressVO_.taskUuid, vo.getParentUuid()) .orderBy(TaskProgressVO_.time, SimpleQuery.Od.DESC) .limit(1) .find();
@Override public void afterDelIpAddress(String vmNicUUid, String usedIpUuid) { VmNicVO nic = Q.New(VmNicVO.class).eq(VmNicVO_.uuid, vmNicUUid).find(); if (nic.getUsedIpUuid() != null && !nic.getUsedIpUuid().equals(usedIpUuid)) { return; } UsedIpVO temp = null; /* if there is ipv4 addresses, we put the first attached ipv4 address to VmNic.ip * or we put the first attached ipv6 address to vmNic.Ip */ List<UsedIpVO> refs = Q.New(UsedIpVO.class).eq(UsedIpVO_.ipVersion, IPv6Constants.IPv4) .eq(UsedIpVO_.vmNicUuid, vmNicUUid).orderBy(UsedIpVO_.createDate, SimpleQuery.Od.ASC).list(); if (refs != null && !refs.isEmpty()) { temp = refs.get(0); } else { refs = Q.New(UsedIpVO.class).eq(UsedIpVO_.ipVersion, IPv6Constants.IPv6) .eq(UsedIpVO_.vmNicUuid, vmNicUUid).orderBy(UsedIpVO_.createDate, SimpleQuery.Od.ASC).list(); if (refs != null && !refs.isEmpty()) { temp = refs.get(0); } } if (temp != null) { SQL.New(VmNicVO.class).eq(VmNicVO_.uuid, vmNicUUid) .set(VmNicVO_.ip, temp.getIp()) .set(VmNicVO_.netmask, temp.getNetmask()) .set(VmNicVO_.gateway, temp.getGateway()) .set(VmNicVO_.usedIpUuid, temp.getUuid()) .set(VmNicVO_.ipVersion, temp.getIpVersion()) .set(VmNicVO_.l3NetworkUuid, temp.getL3NetworkUuid()).update(); } }
@Override public void afterAddIpAddress(String vmNicUUid, String usedIpUuid) { /* update UsedIpVO */ SQL.New(UsedIpVO.class).eq(UsedIpVO_.uuid, usedIpUuid).set(UsedIpVO_.vmNicUuid, vmNicUUid).update(); VmNicVO nic = Q.New(VmNicVO.class).eq(VmNicVO_.uuid, vmNicUUid).find(); UsedIpVO temp = null; /* if there is ipv4 addresses, we put the first attached ipv4 address to VmNic.ip * or we put the first attached ipv6 address to vmNic.Ip */ List<UsedIpVO> refs = Q.New(UsedIpVO.class).eq(UsedIpVO_.ipVersion, IPv6Constants.IPv4) .eq(UsedIpVO_.vmNicUuid, vmNicUUid).orderBy(UsedIpVO_.createDate, SimpleQuery.Od.ASC).list(); if (refs != null && !refs.isEmpty()) { temp = refs.get(0); } else { refs = Q.New(UsedIpVO.class).eq(UsedIpVO_.ipVersion, IPv6Constants.IPv6) .eq(UsedIpVO_.vmNicUuid, vmNicUUid).orderBy(UsedIpVO_.createDate, SimpleQuery.Od.ASC).list(); if (refs != null && !refs.isEmpty()) { temp = refs.get(0); } } if (!temp.getUuid().equals(nic.getUsedIpUuid())) { SQL.New(VmNicVO.class).eq(VmNicVO_.uuid, vmNicUUid) .set(VmNicVO_.ip, temp.getIp()) .set(VmNicVO_.netmask, temp.getNetmask()) .set(VmNicVO_.gateway, temp.getGateway()) .set(VmNicVO_.usedIpUuid, temp.getUuid()) .set(VmNicVO_.ipVersion, temp.getIpVersion()) .set(VmNicVO_.l3NetworkUuid, temp.getL3NetworkUuid()).update(); } }
List<VmCdRomVO> cdRomVOS = q(VmCdRomVO.class) .eq(VmCdRomVO_.vmInstanceUuid, self.getUuid()) .orderBy(VmCdRomVO_.deviceId, SimpleQuery.Od.ASC) .list();
.orderBy(VmCdRomVO_.deviceId, SimpleQuery.Od.ASC) .list(); for (VmCdRomVO cdRomVO : cdRomVOS) {