org.zstack.core.db.Q.limit()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.zstack.core.db.Q.limit方法的一些代码示例,展示了Q.limit的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Q.limit方法的具体详情如下:
包路径:org.zstack.core.db.Q
类名称:Q
方法名:limit

Q.limit介绍

暂无

代码示例

代码示例来源:origin: zstackio/zstack

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;
}

代码示例来源:origin: zstackio/zstack

.notNull(VmNicVO_.metaData).limit(1).find();
if (nnic == null) {
  logger.debug(String.format("add peer l3[uuid:%s] to vip[uuid:%s], the l3 has no vr attached now",
      .notNull(VmNicVO_.metaData).limit(1).find();
  if (enic == null || enic.getVmInstanceUuid().equals(nnic.getVmInstanceUuid())) {
    continue;

代码示例来源:origin: zstackio/zstack

.eq(TaskProgressVO_.apiId, msg.getApiId())
.orderBy(TaskProgressVO_.time, SimpleQuery.Od.DESC)
.limit(1)
.find();
  .eq(TaskProgressVO_.taskUuid, vo.getParentUuid())
  .orderBy(TaskProgressVO_.time, SimpleQuery.Od.DESC)
  .limit(1)
  .find();

代码示例来源:origin: zstackio/zstack

private void validateIpRangeOverlapWithVm(String l3NetworkUuid, String vmInstanceUuid) {
  List<VmNicVO> vmNicVOS = Q.New(VmNicVO.class).eq(VmNicVO_.vmInstanceUuid, vmInstanceUuid).list();
  List<IpRangeVO> newIpRangeVOS = Q.New(IpRangeVO.class).eq(IpRangeVO_.l3NetworkUuid, l3NetworkUuid).list();
  if (newIpRangeVOS == null || newIpRangeVOS.isEmpty()) {
    throw new ApiMessageInterceptionException(operr("no ip ranges attached with l3 network[uuid:%s]", l3NetworkUuid));
  }
  for (VmNicVO vmNicVO: vmNicVOS) {
    List<IpRangeVO> ipRangeVOS = Q.New(IpRangeVO.class).eq(IpRangeVO_.l3NetworkUuid, vmNicVO.getL3NetworkUuid()).limit(1).list();
    if (ipRangeVOS != null && !ipRangeVOS.isEmpty()) {
      if (NetworkUtils.isCidrOverlap(ipRangeVOS.get(0).getNetworkCidr(), newIpRangeVOS.get(0).getNetworkCidr())) {
        throw new ApiMessageInterceptionException(operr("unable to attach a L3 network. The cidr of l3[%s] to attach overlapped with l3[%s] already attached to vm", l3NetworkUuid, vmNicVO.getL3NetworkUuid()));
      }
    }
  }
}

代码示例来源:origin: zstackio/zstack

@Override
public void afterAllocateDhcpServerIP(String L3NetworkUuid, String dhcpSererIp) {
  /* skip adding host route for network without host route service */
  NetworkServiceL3NetworkRefVO ref = Q.New(NetworkServiceL3NetworkRefVO.class).eq(NetworkServiceL3NetworkRefVO_.l3NetworkUuid, L3NetworkUuid)
      .eq(NetworkServiceL3NetworkRefVO_.networkServiceType, NetworkServiceType.HostRoute.toString()).find();
  if (ref == null) {
    logger.debug(String.format("L3 Network doesn't has %s service", NetworkServiceType.HostRoute.toString()));
    return;
  }
  IpRangeVO rangeVO = Q.New(IpRangeVO.class).eq(IpRangeVO_.l3NetworkUuid, L3NetworkUuid).limit(1).find();
  if (rangeVO == null) {
    return;
  }
  updateMetadataRoute(L3NetworkUuid, dhcpSererIp);
}

代码示例来源:origin: zstackio/zstack

.notNull(VmNicVO_.metaData).limit(1).find();
if (rnic == null) {
  l3Uuids.addAll(vipPeerL3Uuids);

代码示例来源:origin: zstackio/zstack

.eq(PrimaryStorageVO_.type, NfsPrimaryStorageConstant.NFS_PRIMARY_STORAGE_TYPE)
    .like(PrimaryStorageVO_.url, String.format("%s:/%%", hostIp))
    .limit(1)
    .findValue();
if (psUuid == null || psUuid.equals("")) {

代码示例来源:origin: zstackio/zstack

private void takeOverLongJob() {
  logger.debug("Starting to take over long jobs");
  final int group = 1000;
  long amount = dbf.count(LongJobVO.class);
  int times = (int) ((amount + group - 1)/group);
  int start = 0;
  for (int i = 0; i < times; i++) {
    List<String> uuids = Q.New(LongJobVO.class)
        .select(LongJobVO_.uuid)
        .isNull(LongJobVO_.managementNodeUuid)
        .limit(group).start(start).listValues();
    for (String uuid : uuids) {
      if (destinationMaker.isManagedByUs(uuid)) {
        retryTakeOverLongJob(uuid);
      }
    }
    start += group;
  }
}

代码示例来源:origin: zstackio/zstack

public void fireVolumeStatusChangedEvent(VolumeStatus oldStatus, VolumeInventory vol) {
  String accountUuid = null;
  boolean volumeAccountExists =  Q.New(AccountResourceRefVO.class).eq(AccountResourceRefVO_.resourceUuid, vol.getUuid()).isExists();
  if (volumeAccountExists) {
    accountUuid = Q.New(AccountResourceRefVO.class)
        .select(AccountResourceRefVO_.ownerAccountUuid)
        .eq(AccountResourceRefVO_.resourceUuid, vol.getUuid()).limit(1).findValue();
  }
  VolumeCanonicalEvents.VolumeStatusChangedData d = new VolumeCanonicalEvents.VolumeStatusChangedData();
  d.setInventory(vol);
  d.setDate(new Date());
  d.setNewStatus(vol.getStatus());
  d.setOldStatus(oldStatus == null ? null : oldStatus.toString());
  d.setVolumeUuid(vol.getUuid());
  d.setAccountUuid(accountUuid);
  evtf.fire(VolumeCanonicalEvents.VOLUME_STATUS_CHANGED_PATH, d);
}

代码示例来源:origin: zstackio/zstack

.notNull(VmNicVO_.metaData).limit(1).find();
if (rnic != null) {
  List<String> vrAttachedL3Uuids = Q.New(VmNicVO.class)

代码示例来源:origin: zstackio/zstack

.eq(CephPrimaryStoragePoolVO_.primaryStorageUuid, primaryStorageUuid)
.eq(CephPrimaryStoragePoolVO_.type, CephPrimaryStoragePoolType.Root.toString())
.limit(1)
.findValue();

代码示例来源:origin: zstackio/zstack

.eq(LoadBalancerListenerCertificateRefVO_.certificateUuid, msg.getCertificateUuid()).limit(1).find();
final LoadBalancerListenerCertificateRefVO original_ref = ref;
if (ref == null) {

代码示例来源:origin: zstackio/zstack

.eq(LoadBalancerListenerCertificateRefVO_.certificateUuid, msg.getCertificateUuid()).limit(1).find();
if (ref != null) {
  LoadBalancerListenerInventory inv = LoadBalancerListenerInventory.valueOf(dbf.findByUuid(msg.getListenerUuid(), LoadBalancerListenerVO.class));

相关文章