private void addCdRomForWindowsVm(String vmUuid) { List<VmCdRomVO> cdRomVOS = new ArrayList<>(); String acntUuid = Account.getAccountUuidOfResource(vmUuid); Map<Integer, String> vmDeviceIdIsoMap = getVmIsoMap(vmUuid);
private void addCdRomForLinuxAndOthersVm(String vmUuid) { String acntUuid = Account.getAccountUuidOfResource(vmUuid); Map<Integer, String> vmDeviceIdIsoMap = getVmIsoMap(vmUuid); if (vmDeviceIdIsoMap.isEmpty()) { VmCdRomVO cdRomVO = new VmCdRomVO(); cdRomVO.setUuid(Platform.getUuid()); cdRomVO.setDeviceId(0); cdRomVO.setVmInstanceUuid(vmUuid); cdRomVO.setName(String.format("vm-%s-cdRom", vmUuid)); cdRomVO.setAccountUuid(acntUuid); dbf.persist(cdRomVO); return; } List<VmCdRomVO> cdRomVOS = new ArrayList<>(); vmDeviceIdIsoMap.forEach((deviceId, isoUuid) -> { VmCdRomVO cdRomVO = new VmCdRomVO(); cdRomVO.setUuid(Platform.getUuid()); cdRomVO.setDeviceId(deviceId); cdRomVO.setIsoUuid(isoUuid); cdRomVO.setVmInstanceUuid(vmUuid); cdRomVO.setName(String.format("vm-%s-cdRom", vmUuid)); cdRomVO.setAccountUuid(acntUuid); cdRomVOS.add(cdRomVO); }); dbf.persistCollection(cdRomVOS); }
String cdRomUuid = cdRomSpec.getUuid() != null ? cdRomSpec.getUuid() : Platform.getUuid(); cdRomSpec.setUuid(cdRomUuid); String acntUuid = Account.getAccountUuidOfResource(spec.getVmInventory().getUuid()); vmCdRomVO.setVmInstanceUuid(spec.getVmInventory().getUuid()); vmCdRomVO.setUuid(cdRomUuid);
@Override public void allocate() { throwExceptionIfIAmTheFirstFlow(); final String vmInstanceUuid = spec.getVmInstance().getUuid(); final String accountUuid = Account.getAccountUuidOfResource(vmInstanceUuid); if (accountUuid == null || AccountConstant.isAdminPermission(accountUuid)) { next(candidates); return; } if (!spec.isFullAllocate()) { new VmQuotaOperator().checkVmCupAndMemoryCapacity(accountUuid, accountUuid, spec.getCpuCapacity(), spec.getMemoryCapacity(), new QuotaUtil().makeQuotaPairs(accountUuid)); next(candidates); return; } new VmQuotaOperator().checkVmInstanceQuota( accountUuid, accountUuid, vmInstanceUuid, new QuotaUtil().makeQuotaPairs(accountUuid)); next(candidates); } }
cdRomVO.setVmInstanceUuid(msg.getVmInstanceUuid()); cdRomVO.setName(msg.getName()); String acntUuid = Account.getAccountUuidOfResource(msg.getVmInstanceUuid()); cdRomVO.setAccountUuid(acntUuid); cdRomVO.setDescription(msg.getDescription());
String accountUuid = Account.getAccountUuidOfResource(vr.getUuid()); VipVO vipvo = new VipVO(); vipvo.setUuid(Platform.getUuid());
@Override protected void scripts() { String acntUuid = Account.getAccountUuidOfResource(spec.getVmInventory().getUuid()); spec.getDestNics().forEach(nic -> { VmNicVO nvo = new VmNicVO(); nvo.setUuid(nic.getUuid()); nvo.setDeviceId(nic.getDeviceId()); nvo.setIp(nic.getIp()); nvo.setL3NetworkUuid(nic.getL3NetworkUuid()); nvo.setMac(nic.getMac()); nvo.setHypervisorType(nic.getHypervisorType()); nvo.setUsedIpUuid(nic.getUsedIpUuid()); nvo.setGateway(nic.getGateway()); nvo.setNetmask(nic.getNetmask()); nvo.setVmInstanceUuid(nic.getVmInstanceUuid()); nvo.setMetaData(nic.getMetaData()); nvo.setInternalName(nic.getInternalName()); nvo.setAccountUuid(acntUuid); nvo.setIpVersion(nic.getIpVersion()); persist(nvo); if (nic.getUsedIpUuid() != null) { SQL.New(UsedIpVO.class).eq(UsedIpVO_.uuid, nic.getUsedIpUuid()).set(UsedIpVO_.vmNicUuid, nvo.getUuid()).update(); } }); ApplianceVmVO apvm = findByUuid(spec.getVmInventory().getUuid(), ApplianceVmVO.class); apvm.setManagementNetworkUuid(mgmtNic.getL3NetworkUuid()); merge(apvm); } }.execute();