本文整理了Java中org.zstack.core.db.Q.notEq
方法的一些代码示例,展示了Q.notEq
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Q.notEq
方法的具体详情如下:
包路径:org.zstack.core.db.Q
类名称:Q
方法名:notEq
暂无
代码示例来源:origin: zstackio/zstack
public static Collection<String> queryVmInGC(final String hostUuid, final Collection<String> vmUuids) {
Collection<String> vmUuidsInGC = new HashSet<>();
List<String> gcNames = Q.New(GarbageCollectorVO.class).select(GarbageCollectorVO_.name)
.eq(GarbageCollectorVO_.runnerClass, DeleteVmGC.class.getName())
.like(GarbageCollectorVO_.name, String.format("%%on-host-%s%%", hostUuid))
.notEq(GarbageCollectorVO_.status, GCStatus.Done).listValues();
if (gcNames != null && !gcNames.isEmpty()) {
vmUuidsInGC = vmUuids.stream().filter(uuid ->
gcNames.contains(String.format("gc-vm-%s-on-host-%s", uuid, hostUuid))).collect(Collectors.toSet());
}
return vmUuidsInGC;
}
}
代码示例来源:origin: zstackio/zstack
@Override
public List<HostVO> filter(List<HostVO> candidates) {
List<String> toRemoveHuuids = Q.New(HostVO.class).notEq(KVMHostVO_.username, "root").select(KVMHostVO_.uuid).listValues();
if (!toRemoveHuuids.isEmpty()){
candidates = CollectionUtils.transformToList(candidates, new Function<HostVO, HostVO>() {
@Override
public HostVO call(HostVO arg) {
return toRemoveHuuids.contains(arg.getUuid()) ? null : arg;
}
});
}
return candidates;
}
}
代码示例来源:origin: zstackio/zstack
private boolean checkCpuModelOfHost() {
List<String> hostUuidsInCluster = Q.New(HostVO.class)
.select(HostVO_.uuid)
.eq(HostVO_.clusterUuid, self.getClusterUuid())
.notEq(HostVO_.uuid, self.getUuid())
.listValues();
if (hostUuidsInCluster.isEmpty()) {
return true;
}
Map<String, List<String>> cpuModelNames = KVMSystemTags.CPU_MODEL_NAME.getTags(hostUuidsInCluster);
if (cpuModelNames != null && cpuModelNames.size() != 0) {
String clusterCpuModelName = KVMSystemTags.CPU_MODEL_NAME.getTokenByTag(
cpuModelNames.values().iterator().next().get(0),
KVMSystemTags.CPU_MODEL_NAME_TOKEN
);
String hostCpuModelName = KVMSystemTags.CPU_MODEL_NAME.getTokenByResourceUuid(
self.getUuid(), KVMSystemTags.CPU_MODEL_NAME_TOKEN
);
if (clusterCpuModelName != null && !clusterCpuModelName.equals(hostCpuModelName)) {
return false;
}
}
return true;
}
代码示例来源:origin: zstackio/zstack
.select(HostVO_.uuid)
.eq(HostVO_.clusterUuid, self.getClusterUuid())
.notEq(HostVO_.uuid, self.getUuid())
.listValues();
if (hostUuidsInCluster.isEmpty()) {
代码示例来源:origin: zstackio/zstack
private void handle(APIGetAttachablePublicL3ForVRouterMsg msg) {
APIGetAttachablePublicL3ForVRouterReply reply = new APIGetAttachablePublicL3ForVRouterReply();
List<L3NetworkVO> l3NetworkVOS = Q.New(L3NetworkVO.class).notEq(L3NetworkVO_.category, L3NetworkCategory.Private).list();
List<VmNicVO> vmNicVOS = Q.New(VmNicVO.class).eq(VmNicVO_.vmInstanceUuid, msg.getVmInstanceUuid()).list();
if (l3NetworkVOS == null || l3NetworkVOS.isEmpty()) {
reply.setInventories(new ArrayList<L3NetworkInventory>());
bus.reply(msg, reply);
return;
}
Set<L3NetworkVO> attachableL3NetworkVOS = new HashSet<>(l3NetworkVOS);
for (L3NetworkVO l3NetworkVO : l3NetworkVOS) {
for (VmNicVO vmNicVO : vmNicVOS) {
if (l3NetworkVO.getIpRanges() == null || l3NetworkVO.getIpRanges().isEmpty()) {
attachableL3NetworkVOS.remove(l3NetworkVO);
}
String vmNicCidr = NetworkUtils.getCidrFromIpMask(vmNicVO.getIp(), vmNicVO.getNetmask());
if (NetworkUtils.isCidrOverlap(l3NetworkVO.getIpRanges().stream().findFirst().get().getNetworkCidr(), vmNicCidr)) {
attachableL3NetworkVOS.remove(l3NetworkVO);
}
attachableL3NetworkVOS.removeAll(attachableL3NetworkVOS.stream()
.filter(vo -> vo.getUuid().equals(vmNicVO.getL3NetworkUuid()))
.collect(Collectors.toSet()));
}
}
reply.setInventories(L3NetworkInventory.valueOf(attachableL3NetworkVOS));
bus.reply(msg, reply);
}
代码示例来源:origin: zstackio/zstack
@Override
public void afterDeleteHost(HostInventory inventory) {
String clusterUuid = inventory.getClusterUuid();
List<String> psUuids = getNfsPrimaryStorageInCluster(clusterUuid);
if(psUuids == null || psUuids.isEmpty()) {
return;
}
if (Q.New(HostVO.class).eq(HostVO_.clusterUuid, clusterUuid).notEq(HostVO_.uuid, inventory.getUuid()).isExists()) {
return;
}
for(String psUuid : psUuids) {
releasePrimaryStorageCapacity(psUuid);
}
}
代码示例来源:origin: zstackio/zstack
@Override
public void afterDeleteHost(HostInventory inventory) {
String clusterUuid = inventory.getClusterUuid();
if (Q.New(HostVO.class).eq(HostVO_.clusterUuid, clusterUuid).notEq(HostVO_.uuid, inventory.getUuid()).isExists()) {
return;
}
final List<String> psUuids = getSMPPrimaryStorageInCluster(clusterUuid);
if(psUuids == null || psUuids.isEmpty()) {
return;
}
for (String psUuid : psUuids) {
releasePrimaryStorageCapacity(psUuid);
}
}
代码示例来源:origin: zstackio/zstack
for (String eipUuid : eipUuids) {
VirtualRouterEipRefVO oldRef = Q.New(VirtualRouterEipRefVO.class)
.eq(VirtualRouterEipRefVO_.eipUuid, eipUuid).notEq(VirtualRouterEipRefVO_.virtualRouterVmUuid, vr.getUuid()).find();
if (oldRef != null) {
throw new OperationFailureException(operr("Eip [uuid:%s] already bound to router [uuid:%s]", oldRef.getEipUuid(), oldRef.getVirtualRouterVmUuid()));
代码示例来源:origin: zstackio/zstack
.select(VmInstanceVO_.uuid)
.eq(VmInstanceVO_.hostUuid, self.getUuid())
.notEq(VmInstanceVO_.state, VmInstanceState.Unknown)
.listValues();
代码示例来源:origin: zstackio/zstack
private List<Tuple> findEipOnVmNic(VmNicInventory nic) throws OperationFailureException {
List<Tuple> eips = findEipTuplesOnVmNic(nic);
if (eips == null || eips.isEmpty()) {
return new ArrayList<>();
}
List<VirtualRouterEipRefVO> refs = new ArrayList<VirtualRouterEipRefVO>();
for (Tuple eipTuple : eips) {
/* eip can be bound to only 1 router */
VirtualRouterEipRefVO oldRef = Q.New(VirtualRouterEipRefVO.class).
eq(VirtualRouterEipRefVO_.eipUuid, eipTuple.get(5, String.class))
.notEq(VirtualRouterEipRefVO_.virtualRouterVmUuid, nic.getVmInstanceUuid()).find();
if (oldRef != null) {
throw new OperationFailureException(operr("Eip [uuid:%s] already bound to router [uuid:%s]", oldRef.getEipUuid(), oldRef.getVirtualRouterVmUuid()));
}
if (!Q.New(VirtualRouterEipRefVO.class)
.eq(VirtualRouterEipRefVO_.eipUuid, eipTuple.get(5, String.class))
.eq(VirtualRouterEipRefVO_.virtualRouterVmUuid, nic.getVmInstanceUuid())
.isExists()) {
VirtualRouterEipRefVO ref = new VirtualRouterEipRefVO();
ref.setEipUuid(eipTuple.get(5, String.class));
ref.setVirtualRouterVmUuid(nic.getVmInstanceUuid());
refs.add(ref);
}
}
if (!refs.isEmpty()) {
dbf.persistCollection(refs);
}
return eips;
}
代码示例来源:origin: zstackio/zstack
.notEq(VmInstanceVO_.state, VmInstanceState.Stopped)
.in(VmInstanceVO_.rootVolumeUuid, volumes)
.isExists();
代码示例来源:origin: zstackio/zstack
@Override
protected void scripts() {
VirtualRouterOfferingVO offering = findByUuid(offeringUuid, VirtualRouterOfferingVO.class);
if (!Q.New(VirtualRouterOfferingVO.class).eq(VirtualRouterOfferingVO_.zoneUuid, zoneUuid)
.notEq(VirtualRouterOfferingVO_.uuid, offeringUuid).isExists()
&& created) {
// the first offering is always the default one
offering.setDefault(true);
merge(offering);
return;
}
if (preferToBeDefault != null && preferToBeDefault) {
sql(VirtualRouterOfferingVO.class).set(VirtualRouterOfferingVO_.isDefault, false)
.eq(VirtualRouterOfferingVO_.zoneUuid, zoneUuid).update();
reload(offering);
offering.setDefault(true);
merge(offering);
} else if (preferToBeDefault != null) {
offering.setDefault(false);
merge(offering);
}
flush();
}
}.execute();
代码示例来源:origin: zstackio/zstack
.notEq(HostVO_.status, HostStatus.Connected)
.count();
if (notConnected != 0) {
内容来源于网络,如有侵权,请联系作者删除!