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

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

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

Volume.getName介绍

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

代码示例

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

@Override
  public HandlerResult handle(ProcessState state, ProcessInstance process) {
    Volume volume = (Volume)state.getResource();
    if (volume.getImageId() != null || StringUtils.isEmpty(volume.getName())) {
      return null;
    }

    Map<Object, Object> data = new HashMap<>();
    String externalId = volume.getExternalId();
    if (StringUtils.isEmpty(externalId)) {
      externalId = volume.getName();
    }
    data.put("externalId", VolumeUtils.externalId(externalId));
    return new HandlerResult(data);
  }
}

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

@Override
public HandlerResult handle(ProcessState state, ProcessInstance process) {
  Volume v = (Volume)state.getResource();
  state.getData().put("processId", process.getId().toString());
  state.getData().put("volumeName", v.getName());
  return null;
}

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

private List<String> processManagedVolumes(Instance instance) {
  List<String> dataVolumes = DataAccessor.fieldStringList(instance, InstanceConstants.FIELD_DATA_VOLUMES);
  if (dataVolumes == null) {
    dataVolumes = new ArrayList<String>();
  }
  Map<String, Object> dataVolumeMounts = DataAccessor.fieldMap(instance, InstanceConstants.FIELD_DATA_VOLUME_MOUNTS);
  if (dataVolumeMounts == null) {
    return dataVolumes;
  }
  for (Map.Entry<String, Object> mountedVols : dataVolumeMounts.entrySet()) {
    Long volId = ((Number) mountedVols.getValue()).longValue();
    Volume vol = objectManager.loadResource(Volume.class, volId);
    if (vol != null) {
      String volDescriptor = vol.getName() + ":" + mountedVols.getKey().trim();
      if (!dataVolumes.contains(volDescriptor)) {
        dataVolumes.add(volDescriptor);
      }
    }
  }
  return dataVolumes;
}

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

@Override
  public Volume doWithLock() {
    Volume existing = null;
    List<? extends Volume> volumes = context.objectManager
        .find(Volume.class, VOLUME.ACCOUNT_ID, service.getAccountId(),
            VOLUME.REMOVED, null, VOLUME.VOLUME_TEMPLATE_ID, template.getId(),
            VOLUME.STACK_ID,
            stack.getId());
    for (Volume vol : volumes) {
      if (vol.getName().startsWith(name)) {
        existing = vol;
        break;
      }
    }
    if (existing != null) {
      return existing;
    }
    return createVolume(service, template, new String(name + postfix.substring(0, 5)));
  }
});

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

private void deleteVolumes(Instance instance, ProcessState state) {
  Object b = DataAccessor.fieldMap(instance, FIELD_LABELS).get(SystemLabels.LABEL_VOLUME_CLEANUP_STRATEGY);
  String behavior = b != null ? b.toString() : VOLUME_CLEANUP_STRATEGY_UNNAMED;
  Set<? extends Volume> volumes = volumeDao.findNonremovedVolumesWithNoOtherMounts(instance.getId());
  for (Volume v : volumes) {
    String volumeBehavior = migrateVolume(instance, v, behavior);
    if (VOLUME_CLEANUP_STRATEGY_NONE.equals(volumeBehavior)
        || (!VOLUME_CLEANUP_STRATEGY_UNNAMED.equals(volumeBehavior) && !VOLUME_CLEANUP_STRATEGY_ALL.equals(volumeBehavior))) {
      continue;
    }
    if (VOLUME_CLEANUP_STRATEGY_UNNAMED.equals(volumeBehavior) &&
        ((StringUtils.length(v.getName()) != 64 || !StringUtils.isAlphanumeric(v.getName()))) && !StringUtils.startsWith(v.getName(), "/")) {
      continue;
    }
    if (CommonStatesConstants.ACTIVE.equals(v.getState()) || CommonStatesConstants.ACTIVATING.equals(v.getState())) {
      objectProcessManager.scheduleStandardProcess(StandardProcess.DEACTIVATE, v,
          ProcessUtils.chainInData(state.getData(), VolumeConstants.PROCESS_DEACTIVATE, VolumeConstants.PROCESS_REMOVE));
    } else {
      objectProcessManager.scheduleStandardProcess(StandardProcess.REMOVE, v, state.getData());
    }
  }
}

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

name = v.getName();
if (!VolumeConstants.ACCESS_MODE_SINGLE_INSTANCE_RW.equals(v.getAccessMode())) {
  objectManager.setFields(v, VOLUME.ACCESS_MODE, VolumeConstants.ACCESS_MODE_SINGLE_INSTANCE_RW);

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

Host host = objectManager.loadResource(Host.class, hostID);
String hostName = DataAccessor.fieldString(host, HostConstants.FIELD_HOSTNAME);
constraints.add(new VolumeAccessModeSingleHostConstraint(hostID, v.getId(), v.getName(), hostName, hardConstraint, idFormatter));
constraints.add(new VolumeAccessModeSingleInstanceConstraint(v.getName(), v.getId(), v.getAccessMode(), currentlyUsedBy, idFormatter));

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

VOLUME.NAME, volume.getName(),
VOLUME.REMOVED, null,
VOLUME.STORAGE_DRIVER_ID, storageDriver.getId());

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

stack.getId(), VOLUME.DEPLOYMENT_UNIT_ID, unit.getId());
for (Volume vol : volumes) {
  if (vol.getName().startsWith(name)) {
    volume = vol;
    break;

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

public void from(io.cattle.platform.core.model.Volume from) {
  setId(from.getId());
  setName(from.getName());
  setAccountId(from.getAccountId());
  setKind(from.getKind());

相关文章