throw new CannotTranslateException("vm may not be null");
}
final ResourceAllocation_Type alloc = new ResourceAllocation_Type();
final ResourceAllocation ra = vm.getResourceAllocation();
if (ra == null) {
return alloc; // *** EARLY RETURN ***
}
this.setCPU(ra, alloc);
final int raMem = ra.getMemory();
if (raMem > -1) {
final Exact_Type ex = new Exact_Type(raMem);
final Exact_Type[] exacts = {ex};
alloc.setIndividualPhysicalMemory(
new RangeValue_Type(exacts,null,null,null));
}
final int raCpus = ra.getIndCpuCount();
if (raCpus > -1) {
final Exact_Type ex = new Exact_Type(raCpus);
final Exact_Type[] exacts = {ex};
alloc.setIndividualCPUCount(
new RangeValue_Type(exacts,null,null,null));
}
final int raCpuPercent = ra.getCpuPercentage();
if (raCpuPercent > -1) {
final Exact_Type ex = new Exact_Type(raCpuPercent);
final Exact_Type[] exacts = {ex};
alloc.setCPUPercentage(
new RangeValue_Type(exacts,null,null,null));