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

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

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

Volume.getHostId介绍

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

代码示例

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

@Override
protected Object getAgentResource(ProcessState state, ProcessInstance process, Object dataResource) {
  Volume v = (Volume)state.getResource();
  return objectManager.loadResource(Host.class, v.getHostId());
}

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

&& testVolume.getHostId() != null
    && !hostIdsToDeploy.contains(testVolume.getHostId());
if (invalidHost) {
  continue;

代码示例来源: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

@Override
public HandlerResult handle(ProcessState state, ProcessInstance process) {
  Volume volume = (Volume)state.getResource();
  deallocate(volume, state.getData());
  boolean maps = false;
  boolean mounts = false;
  for (VolumeStoragePoolMap map : mapDao.findToRemove(VolumeStoragePoolMap.class, Volume.class, volume.getId())) {
    maps = true;
    deactivateThenScheduleRemove(map, null);
  }
  for (Mount mount : mapDao.findToRemove(Mount.class, Volume.class, volume.getId())) {
    mounts = true;
    deactivateThenRemove(mount, null);
  }
  Image image = objectManager.loadResource(Image.class, volume.getImageId());
  if (image != null) {
    remove(image, null);
  }
  if (maps && !mounts && volume.getHostId() != null) {
    /* HostId != null means this volume was created from a host, but no mounts also means it won't be deleted,
     * so we delete.
     */
    return super.handle(state, process);
  }
  return new HandlerResult();
}

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

setExternalId(from.getExternalId());
setAccessMode(from.getAccessMode());
setHostId(from.getHostId());
setDeploymentUnitId(from.getDeploymentUnitId());
setStackId(from.getStackId());

相关文章