io.cattle.platform.core.model.Volume.getAccountId()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(132)

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

Volume.getAccountId介绍

[英]Getter for cattle.volume.account_id.
[中][$0$]的Getter。

代码示例

代码示例来源:origin: rancher/cattle

@Override
  public HandlerResult handle(ProcessState state, ProcessInstance process) {
    Volume v = (Volume)state.getResource();
    String driver = DataAccessor.fieldString(v, VolumeConstants.FIELD_VOLUME_DRIVER);
    if (StringUtils.isEmpty(driver) || VolumeConstants.LOCAL_DRIVER.equals(driver)) {
      return null;
    }

    List<? extends StoragePool> pools = storagePoolDao.findStoragePoolByDriverName(v.getAccountId(), driver);
    if (pools.size() == 0) {
      return null;
    }
    StoragePool sp = pools.get(0);

    Map<String, Object> data = new HashMap<>();
    List<String> volumeCap = DataAccessor.fieldStringList(sp, StoragePoolConstants.FIELD_VOLUME_CAPABILITIES);
    if (volumeCap != null && volumeCap.size() > 0) {
      data.put(ObjectMetaDataManager.CAPABILITIES_FIELD, volumeCap);
    }

    return new HandlerResult(data);
  }
}

代码示例来源:origin: rancher/cattle

String driver = DataAccessor.fieldString(v, VolumeConstants.FIELD_VOLUME_DRIVER);
if (StringUtils.isNotEmpty(driver) && !VolumeConstants.LOCAL_DRIVER.equals(driver)) {
  List<? extends StoragePool> pools = storagePoolDao.findStoragePoolByDriverName(v.getAccountId(), driver);
  if (pools.size() == 0) {
    continue;

代码示例来源:origin: rancher/cattle

restrictToUnmanagedPool = true;
if (StringUtils.isNotEmpty(driver) && !VolumeConstants.LOCAL_DRIVER.equals(driver)) {
  List<? extends StoragePool> pools = storagePoolDao.findStoragePoolByDriverName(volume.getAccountId(), driver);
  if (pools.size() > 0) {
    Set<Long> poolIds = new HashSet<>();

代码示例来源:origin: rancher/cattle

@Override
  public Object perform(String name, Object obj, ApiRequest request) {
    if (!(obj instanceof Volume)) {
      return null;
    }
    Volume volume = (Volume)obj;
    Snapshot snapshot = objectManager.newRecord(Snapshot.class);
    snapshot.setKind(SnapshotConstants.TYPE);
    snapshot.setAccountId(volume.getAccountId());
    snapshot.setVolumeId(volume.getId());

    String snapshotName = DataAccessor.fromMap(request.getRequestObject()).withKey("name").as(String.class);
    if (StringUtils.isNotBlank(snapshotName)) {
      snapshot.setName(snapshotName);
    }

    snapshot = objectManager.create(snapshot);
    processManager.scheduleStandardProcess(StandardProcess.CREATE, snapshot, null);
    return objectManager.reload(snapshot);
  }
}

代码示例来源:origin: rancher/cattle

@Override
public HandlerResult handle(ProcessState state, ProcessInstance process) {
  Volume volume = (Volume) state.getResource();
  String driver = DataAccessor.fieldString(volume, VolumeConstants.FIELD_VOLUME_DRIVER);
  Long driverId = volume.getStorageDriverId();
  Integer deviceNum = volume.getDeviceNumber();
  StorageDriver storageDriver = objectManager.loadResource(StorageDriver.class, driverId);
  if (storageDriver == null && StringUtils.isNotBlank(driver)) {
    storageDriver = objectManager.findAny(StorageDriver.class,
        STORAGE_DRIVER.ACCOUNT_ID, volume.getAccountId(),
        STORAGE_DRIVER.REMOVED, null,
        STORAGE_DRIVER.NAME, driver);
  }
  if (storageDriver != null) {
    driver = storageDriver.getName();
    driverId = storageDriver.getId();
    deviceNum = -1;
  }
  HandlerResult result = new HandlerResult(VolumeConstants.FIELD_VOLUME_DRIVER, driver,
      VOLUME.DEVICE_NUMBER, deviceNum,
      VOLUME.STORAGE_DRIVER_ID, driverId);
  Long hostId = volume.getHostId();
  if (storageDriver != null && hostId != null) {
    if (storagePoolDao.associateVolumeToPool(volume.getId(), storageDriver.getId(), hostId) != null) {
      result.withShouldContinue(false)
      .withChainProcessName(objectProcessManager.getStandardProcessName(StandardProcess.DEACTIVATE, volume));
    }
  }
  return result;
}

代码示例来源:origin: rancher/cattle

setId(from.getId());
setName(from.getName());
setAccountId(from.getAccountId());
setKind(from.getKind());
setUuid(from.getUuid());

相关文章