if (resource == null) {
throw new CannotTranslateException("no resource?");
}
final _VM vm = this.repr._newVM();
vm.setID(String.valueOf(resource.getID()));
vm.setGroupID(resource.getGroupId());
vm.setCoschedID(resource.getEnsembleId());
vm.setLaunchIndex(resource.getLaunchIndex());
vm.setNics(this.getNICs(resource.getVM()));
vm.setMdUserData(resource.getVM().getMdUserData());
vm.setCredentialName(resource.getVM().getCredentialName());
vm.setVMFiles(this.getStorage(resource.getVM()));
vm.setResourceAllocation(this.getRA(resource.getVM()));
vm.setSchedule(this.getSchedule(resource));
vm.setState(this.getState(resource));
vm.setCreator(this.getCreator(resource));
vm.setClientToken(resource.getClientToken());
String deets = this.getDetails(resource.getVM());
if (deets != null)
{
vm.setDetails(deets);
}
if(resource.getVM().isPreemptable()){
vm.setLifeCycle(VMConstants.LIFE_CYCLE_SPOT);
}
return vm;
}