@Override public VdcActionParametersBase getParameters(VmPool incoming, vm_pools current) { int currentVmCount = current.getvm_assigned_count(); vm_pools entity = map(incoming, current); VM vm = mapToVM(map(entity)); int size = incoming.isSetSize() && incoming.getSize() > currentVmCount ? incoming.getSize() - currentVmCount : 0; if (incoming.isSetTemplate()) { vm.setvmt_guid(new Guid(incoming.getTemplate().getId())); } else { VM existing = currentVmCount > 0 ? getEntity(VM.class, SearchType.VM, "Vms: pool=" + incoming.getName()) : null; if (existing != null) { vm.setvmt_guid(existing.getvmt_guid()); } } if (vm.getvmt_guid() != null) { VmTemplate template = getEntity( VmTemplate.class, VdcQueryType.GetVmTemplate, new GetVmTemplateParameters(vm.getvm_guid()), vm.getvm_guid().toString()); vm.getStaticData().setmem_size_mb(template.getmem_size_mb()); } AddVmPoolWithVmsParameters parameters = new AddVmPoolWithVmsParameters(entity, vm, size, -1); parameters.setStorageDomainId(getStorageDomainId(vm.getvmt_guid())); return parameters; }
static void verifyModelSpecific(VmPool model, int index) { assertNotNull(model.getCluster()); assertNotNull(model.getCluster().getId()); }