本文整理了Java中io.cattle.platform.core.model.Volume.getState()
方法的一些代码示例,展示了Volume.getState()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Volume.getState()
方法的具体详情如下:
包路径:io.cattle.platform.core.model.Volume
类名称:Volume
方法名:getState
[英]Getter for cattle.volume.state
.
[中][$0$]的Getter。
代码示例来源:origin: rancher/cattle
@Override
protected void doRun() throws Exception {
log.warn("Removing invalid volume [{}]", ObjectUtils.toStringWrapper(vol));
if (VolumeConstants.STATE_DETACHED.equals(vol.getState())) {
processManager.scheduleStandardProcessAsync(StandardProcess.REMOVE, vol, null);
} else {
processManager.scheduleStandardChainedProcessAsync(StandardProcess.DEACTIVATE, StandardProcess.REMOVE, vol, null);
}
}
});
代码示例来源:origin: rancher/cattle
@Override
public HandlerResult handle(final ProcessState state, ProcessInstance process) {
Mount mount = (Mount)state.getResource();
Volume volume = objectManager.loadResource(Volume.class, mount.getVolumeId());
/* This is an upgrade issue with old data from <= 1.1.x */
if (volume.getRemoved() != null) {
return null;
}
if (!CommonStatesConstants.ACTIVE.equals(volume.getState()) && !CommonStatesConstants.ACTIVATING.equals(volume.getState())
&& !CommonStatesConstants.RESTORING.equals(volume.getState())) {
if (CommonStatesConstants.REQUESTED.equals(volume.getState()) || CommonStatesConstants.REGISTERING.equals(volume.getState())) {
objectProcessManager.scheduleStandardProcess(StandardProcess.CREATE, volume,
ProcessUtils.chainInData(state.getData(), VolumeConstants.PROCESS_CREATE, VolumeConstants.PROCESS_ACTIVATE));
} else {
objectProcessManager.scheduleStandardProcess(StandardProcess.ACTIVATE, volume, state.getData());
}
}
return null;
}
}
代码示例来源:origin: rancher/cattle
@Override
public void doWithLockNoResult() {
Map<Object, Object> criteria = new HashMap<Object, Object>();
criteria.put(MOUNT.ID, new Condition(ConditionType.NE, mount.getId()));
criteria.put(MOUNT.STATE, new Condition(ConditionType.NOTIN, MOUNT_STATES));
criteria.put(MOUNT.VOLUME_ID, mount.getVolumeId());
Mount mount2 = objectManager.findAny(Mount.class, criteria);
if (mount2 == null) {
Volume vol = objectManager.loadResource(Volume.class, mount.getVolumeId());
if (CommonStatesConstants.ACTIVE.equals(vol.getState()) || CommonStatesConstants.ACTIVATING.equals(vol.getState())) {
objectProcessManager.scheduleStandardProcess(StandardProcess.DEACTIVATE, vol, null);
}
}
}
});
代码示例来源:origin: rancher/cattle
protected void storage(Instance instance) {
List<Volume> volumes = getObjectManager().children(instance, Volume.class);
for (Volume volume : volumes) {
if (volume.getRemoved() == null && !volume.getState().equals(CommonStatesConstants.REMOVED)) {
deactivate(volume, null);
}
}
}
代码示例来源: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
private void removeVolumes(Stack stack) {
List<? extends Volume> volumes = objectManager.find(Volume.class, VOLUME.ACCOUNT_ID,
stack.getAccountId(), VOLUME.REMOVED, null,
VOLUME.STACK_ID, stack.getId());
for (Volume volume : volumes) {
String state = volume.getState();
if (!REMOVED.equals(state) && !REMOVING.equals(state)){
try {
objectProcessManager.scheduleStandardProcessAsync(StandardProcess.REMOVE, volume, null);
} catch (ProcessCancelException e) {
volume = resourceMonitor.waitForState(volume, STATE_DETACHED, 3000L);
objectProcessManager.scheduleStandardProcessAsync(StandardProcess.REMOVE, volume, null);
}
}
}
}
代码示例来源:origin: rancher/cattle
continue;
if (!(volume.getState().equals(CommonStatesConstants.REMOVED) || volume.getState().equals(
CommonStatesConstants.REMOVING))) {
try {
代码示例来源:origin: rancher/cattle
if (CommonStatesConstants.REQUESTED.equals(volume.getState())) {
action = "Created";
objectProcessManager.scheduleStandardProcess(StandardProcess.CREATE, volume, state.getData());
代码示例来源:origin: rancher/cattle
setUuid(from.getUuid());
setDescription(from.getDescription());
setState(from.getState());
setCreated(from.getCreated());
setRemoved(from.getRemoved());
内容来源于网络,如有侵权,请联系作者删除!