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

x33g5p2x  于2022-01-21 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(150)

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

Instance.getMemoryMb介绍

[英]Getter for cattle.instance.memory_mb.
[中]cattle.instance.memory_mb的Getter。

代码示例

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

protected String getInstanceType(Instance instance) {
  Long mem = instance.getMemoryMb();
  if (mem == null) {
    mem = 64L;
  }
  Long cpu = DataAccessor.fieldLong(instance, InstanceConstants.FIELD_VCPU);
  if (cpu == null) {
    cpu = 1L;
  }
  StringBuilder buffer = new StringBuilder();
  if (mem < 1024) {
    buffer.append(mem).append("mb-");
  } else {
    buffer.append(mem.floatValue() / 1024).append("gb-");
  }
  buffer.append(cpu).append("cpu");
  return buffer.toString();
}

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

labels.put(SystemLabels.LABEL_VM, "true");
long mem = 512L;
if (instance.getMemoryMb() == null) {
  labels.put(SystemLabels.LABEL_VM_MEMORY, "512");
} else {
  mem = instance.getMemoryMb();
  labels.put(SystemLabels.LABEL_VM_MEMORY, instance.getMemoryMb().toString());

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

setAllocationState(from.getAllocationState());
setCompute(from.getCompute());
setMemoryMb(from.getMemoryMb());
setImageId(from.getImageId());
setHostname(from.getHostname());

相关文章