@Override public String call(L3NetworkInventory arg) { return arg.getUuid(); } });
@Override public String call(L3NetworkInventory arg) { return arg.getUuid(); } }));
@Override public String call(L3NetworkInventory arg) { return arg.getUuid(); } }));
@Override public String call(L3NetworkInventory arg) { return arg.getUuid(); } }));
@Override public String call(L3NetworkInventory arg) { return arg.getUuid(); } }));
@Override public String call(L3NetworkInventory arg) { return arg.getUuid(); } });
public static List<String> getL3UuidsOfSpec(List<VmNicSpec> specs) { List<String> res = new ArrayList<>(); for (VmNicSpec spec: specs) { for (L3NetworkInventory inv : spec.l3Invs) { res.add(inv.getUuid()); } } return res; } }
@Override public String toString() { StringBuilder sb = new StringBuilder("["); sb.append(String.format("dns: %s", dns)); sb.append(String.format("l3NetworkUuid: %s,", l3Network.getUuid())); sb.append("]"); return sb.toString(); }
@Override @Transactional public List<EipVO> call() { String sql = "select eip from EipVO eip, VmNicVO nic, UsedIpVO ip where nic.uuid = ip.vmNicUuid and ip.l3NetworkUuid = :l3uuid and nic.uuid = eip.vmNicUuid and nic.uuid = :nicUuid"; Query q = dbf.getEntityManager().createQuery(sql); q.setParameter("l3uuid", l3.getUuid()); q.setParameter("nicUuid", nic.getUuid()); return q.getResultList(); } }.call();
@Override public L3NetworkInventory call(L3NetworkInventory arg) { return arg.getUuid().equals(spec.getVmInventory().getDefaultL3NetworkUuid()) ? arg : null; } });
@Override public String call(HostName arg) { return arg.getL3NetworkUuid().equals(l3.getUuid()) ? arg.getHostname() : null; } });
@Override public VmNicInventory call(VmNicInventory arg) { if (arg.getL3NetworkUuid().equals(struct.getL3Network().getUuid())) { return arg; } return null; } });
@Override public String call(VmNicInventory arg) { if (arg.getL3NetworkUuid().equals(struct.getGuestL3Network().getUuid())) { return arg.getMac(); } return null; } });
@Override public Result audit(APIMessage msg, APIEvent rsp) { return new Result(rsp.isSuccess() ? ((APICreateL3NetworkEvent) rsp).getInventory().getUuid() : "", L3NetworkVO.class); } }
@Override public void validate(VirtualRouterOfferingInventory offering) throws OperationFailureException { if (offering.getPublicNetworkUuid().equals(guestL3.getUuid())) { throw new OperationFailureException(operr("guest l3Network[uuid:%s, name:%s] needs SNAT service provided by virtual router, but public l3Network[uuid:%s] of virtual router offering[uuid: %s, name:%s] is the same to this guest l3Network", guestL3.getUuid(), guestL3.getName(), offering.getPublicNetworkUuid(), offering.getUuid(), offering.getName())); } } });
private DnsStruct makeDnsStruct(VmInstanceSpec spec, L3NetworkInventory l3) { List<String> dns = getDnsOnL3(l3.getUuid()); DnsStruct struct = new DnsStruct(); struct.setDns(dns); struct.setL3Network(l3); return struct; }
@Override public void fail(ErrorCode errorCode) { N.New(VmInstanceVO.class, spec.getVmInventory().getUuid()).warn_("unable to release a network service of the VM[uuid:%s] when rolling back an attached" + " L3 network[uuid: %s], %s. You may need to reboot the VM to fix the issue", spec.getVmInventory().getUuid(), l3.getUuid(), errorCode); completion.done(); } });
@Override public void validate(VirtualRouterOfferingInventory offering) throws OperationFailureException { if (!offering.getPublicNetworkUuid().equals(struct.getVip().getL3NetworkUuid())) { throw new OperationFailureException(operr("found a virtual router offering[uuid:%s] for L3Network[uuid:%s] in zone[uuid:%s]; however, the network's public network[uuid:%s] is not the same to EIP[uuid:%s]'s; you may need to use system tag" + " guestL3Network::l3NetworkUuid to specify a particular virtual router offering for the L3Network", offering.getUuid(), l3inv.getUuid(), l3inv.getZoneUuid(), struct.getVip().getL3NetworkUuid(), struct.getEip().getUuid())); } } });
@Override public VirtualRouterVmInventory call() { VirtualRouterVmVO vr = findVR(); if (vr != null && !VmInstanceState.Running.equals(vr.getState())) { throw new OperationFailureException(operr("virtual router[uuid:%s] for l3 network[uuid:%s] is not in Running state, current state is %s. We don't have HA feature now(it's coming soon), please restart it from UI and then try starting this vm again", vr.getUuid(), l3Nw.getUuid(), vr.getState())); } return vr == null ? null : new VirtualRouterVmInventory(vr); } }.call();