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

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

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

Q.findTuple介绍

暂无

代码示例

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

@Override
  protected CanDoAnswer canDoReconnect() {
    if (CoreGlobalProperty.UNIT_TEST_ON) {
      return CanDoAnswer.Ready;
    }

    Tuple t = Q.New(KVMHostVO.class).select(KVMHostVO_.managementIp, KVMHostVO_.port).eq(KVMHostVO_.uuid, uuid).findTuple();
    if (t == null) {
      return CanDoAnswer.NoReconnect;
    }

    String ip = t.get(0, String.class);
    int port = t.get(1, Integer.class);

    return NetworkUtils.isRemotePortOpen(ip, port, (int) TimeUnit.SECONDS.toMillis(2)) ?
        CanDoAnswer.Ready : CanDoAnswer.NotReady;
  }
}

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

private void validate(APIUpdatePrimaryStorageMsg msg){
    Tuple t = Q.New(PrimaryStorageVO.class)
        .select(PrimaryStorageVO_.type, PrimaryStorageVO_.url, PrimaryStorageVO_.zoneUuid)
        .eq(PrimaryStorageVO_.uuid, msg.getUuid())
        .findTuple();

    String type = t.get(0, String.class);
    String url = t.get(1, String.class);
    String zoneUuid = t.get(2, String.class);
    if(!type.equals(NfsPrimaryStorageConstant.NFS_PRIMARY_STORAGE_TYPE)){
      return;
    }

    if (msg.getUrl() != null && !msg.getUrl().equals(url)){
      new SQLBatch(){
        @Override
        protected void scripts() {
          NfsApiParamChecker checker = new NfsApiParamChecker();
          checker.checkUrl(zoneUuid, msg.getSystemTags(), msg.getUrl());
          checker.checkRunningVmForUpdateUrl(msg.getUuid());
        }
      }.execute();
    }
  }
}

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

private void track()  {
  Tuple t = Q.New(HostVO.class).select(HostVO_.state, HostVO_.status)
      .eq(HostVO_.uuid, uuid).findTuple();

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

@Override
  public void after(APIEvent evt) {
    if (evt.isSuccess()) {
      Tuple t = Q.New(VmNicVO.class)
          .select(VmNicVO_.vmInstanceUuid, VmNicVO_.ip)
          .eq(VmNicVO_.uuid, vmNicUuid).findTuple();
      String vmUuid = t.get(0, String.class);
      String ip = t.get(1, String.class);
      ntfy("Attached port forwarding Rule[uuid:%s]", ruleUuid)
          .resource(ruleUuid, PortForwardingRuleVO.class.getSimpleName())
          .context("vmNicUuid", vmNicUuid)
          .context("vmUuid", vmUuid)
          .messageAndEvent(that, evt).done();
      ntfy("Attached a port forwarding rule[%s] to the nic[%s]", ruleUuid, vmNicUuid)
          .context("ruleUuid", ruleUuid)
          .resource(vmUuid, VmInstanceVO.class.getSimpleName())
          .messageAndEvent(that, evt).done();
    }
  }
};

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

@Override
  public void after(APIEvent evt) {
    if (evt.isSuccess()) {
      for (String vmNicUuid : vmNicUuids) {
        Tuple t = Q.New(VmNicVO.class)
            .select(VmNicVO_.vmInstanceUuid, VmNicVO_.ip)
            .eq(VmNicVO_.uuid, vmNicUuid).findTuple();
        String vmUuid = t.get(0, String.class);
        String ip = t.get(1, String.class);
        ntfy("Added load balancer[uuid:%s]", loadBalancerUuid)
            .resource(loadBalancerUuid, LoadBalancerVO.class.getSimpleName())
            .context("vmNicUuid", vmNicUuid)
            .context("vmUuid", vmUuid)
            .messageAndEvent(that, evt).done();
        ntfy("Add a load balancer[%s] to the nic[ip:%s]", loadBalancerUuid, ip)
            .context("loadBalancerUuid", loadBalancerUuid)
            .resource(vmUuid, VmInstanceVO.class.getSimpleName())
            .messageAndEvent(that, evt).done();
        ntfy("Added to the nic[ip:%s]", vmUuid, ip)
            .resource(listenerUuid, LoadBalancerListenerVO.class.getSimpleName())
            .context("vmUuid", vmUuid)
            .messageAndEvent(that, evt).done();
      }
    }
  }
};

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

@Override
  public void after(APIEvent evt) {
    Tuple t = Q.New(VmNicVO.class)
        .select(VmNicVO_.vmInstanceUuid, VmNicVO_.ip)
        .eq(VmNicVO_.uuid, vmNicUuid).findTuple();
    String vmUuid = t.get(0, String.class);
    String ip = t.get(1, String.class);
    ntfy("Attached to the nic[%s]", ip)
        .resource(eipUuid, EipVO.class.getSimpleName())
        .context("vmNicUuid", vmNicUuid)
        .context("vmUuid", vmUuid)
        .messageAndEvent(that, evt).done();
    String eip = Q.New(EipVO.class)
        .select(EipVO_.vipIp)
        .eq(EipVO_.uuid, eipUuid).findValue();
    ntfy("Attached an Eip[%s] to the nic[%s]", eip, ip)
        .context("eipUuid", eipUuid)
        .resource(vmUuid, VmInstanceVO.class.getSimpleName())
        .messageAndEvent(that, evt).done();
  }
};

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

if (ImageMediaType.ISO.toString().equals(imageInv.getMediaType())) {
  Tuple t = Q.New(DiskOfferingVO.class).eq(DiskOfferingVO_.uuid, msg.getRootDiskOfferingUuid())
      .select(DiskOfferingVO_.diskSize, DiskOfferingVO_.allocatorStrategy).findTuple();
  rmsg.setSize((long)t.get(0));
  rmsg.setAllocationStrategy((String)t.get(1));

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

.eq(VolumeSnapshotVO_.uuid, msg.getSnapshotUuid()).findTuple();
String volumeUuid = t.get(0, String.class);
String treeUuid = t.get(1, String.class);

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

Tuple tuple = Q.New(VmInstanceVO.class)
    .select(VmInstanceVO_.clusterUuid, VmInstanceVO_.uuid)
    .eq(VmInstanceVO_.rootVolumeUuid, msg.getVolumeUuid()).findTuple();
String originClusterUuid = tuple.get(0,String.class);
String originVmUuid = tuple.get(1,String.class);

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

.eq(VolumeSnapshotVO_.uuid, msg.getSnapshotUuid()).findTuple();
String volumeUuid = t.get(0, String.class);
String treeUuid = t.get(1, String.class);

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

.findTuple();
String vmUuid = t == null ? null : t.get(0, String.class);
String originStateEvent = t == null ? null : t.get(1, VmInstanceState.class).getDrivenEvent().toString();

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

.select(VmInstanceVO_.state, VmInstanceVO_.hostUuid)
    .eq(VmInstanceVO_.uuid, vol.getVmInstanceUuid())
    .findTuple();
VmInstanceState state = t.get(0, VmInstanceState.class);
String vmHostUuid = t.get(1, String.class);

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

.select(VmInstanceVO_.state, VmInstanceVO_.hostUuid)
    .eq(VmInstanceVO_.uuid, vol.getVmInstanceUuid())
    .findTuple();
VmInstanceState state = t.get(0, VmInstanceState.class);
String vmHostUuid = t.get(1, String.class);

相关文章