@Override public VirtualMachineTO implement(VirtualMachineProfile vm) { VirtualMachineTO to = toVirtualMachineTO(vm); // Determine the VM's OS description GuestOSVO guestOS = _guestOsDao.findByIdIncludingRemoved(vm.getVirtualMachine().getGuestOSId()); to.setOs(guestOS.getDisplayName()); HostVO host = _hostDao.findById(vm.getVirtualMachine().getHostId()); GuestOSHypervisorVO guestOsMapping = null; if (host != null) { guestOsMapping = _guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), getHypervisorType().toString(), host.getHypervisorVersion()); } if (guestOsMapping == null || host == null) { to.setPlatformEmulator("Other"); } else { to.setPlatformEmulator(guestOsMapping.getGuestOsName()); } return to; }
protected String getTemplateGuestOSCategory(VMTemplateVO template) { long guestOSId = template.getGuestOSId(); GuestOSVO guestOS = _guestOSDao.findById(guestOSId); if (guestOS == null) { return null; } long guestOSCategoryId = guestOS.getCategoryId(); GuestOSCategoryVO guestOSCategory = _guestOSCategoryDao.findById(guestOSCategoryId); return guestOSCategory.getName(); }
@Override @DB @ActionEvent(eventType = EventTypes.EVENT_GUEST_OS_ADD, eventDescription = "Adding new guest OS type", create = true) public GuestOS addGuestOs(final AddGuestOsCmd cmd) { final Long categoryId = cmd.getOsCategoryId(); final String displayName = cmd.getOsDisplayName(); final String name = cmd.getOsName(); final GuestOSCategoryVO guestOsCategory = ApiDBUtils.findGuestOsCategoryById(categoryId); if (guestOsCategory == null) { throw new InvalidParameterValueException("Guest OS category not found. Please specify a valid Guest OS category"); } final GuestOS guestOs = ApiDBUtils.findGuestOSByDisplayName(displayName); if (guestOs != null) { throw new InvalidParameterValueException("The specified Guest OS name : " + displayName + " already exists. Please specify a unique name"); } s_logger.debug("GuestOSDetails"); final GuestOSVO guestOsVo = new GuestOSVO(); guestOsVo.setCategoryId(categoryId.longValue()); guestOsVo.setDisplayName(displayName); guestOsVo.setName(name); guestOsVo.setIsUserDefined(true); final GuestOS guestOsPersisted = _guestOSDao.persist(guestOsVo); if (cmd.getDetails() != null && !cmd.getDetails().isEmpty()) { Map<String, String> detailsMap = cmd.getDetails(); for (Object key : detailsMap.keySet()) { _guestOsDetailsDao.addDetail(guestOsPersisted.getId(), (String)key, detailsMap.get(key), false); } } return guestOsPersisted; }
protected GuestOSDaoImpl() { Search = createSearchBuilder(); Search.and("display_name", Search.entity().getDisplayName(), SearchCriteria.Op.EQ); Search.done(); }
long guestOSCategoryId = guestOS.getCategoryId(); GuestOSCategoryVO guestOSCategory = _guestOSCategoryDao.findById(guestOSCategoryId); if (guestOS.getDisplayName().toLowerCase().contains("apple mac os")) { vm.setDetail("smc.present", "TRUE"); vm.setDetail(VmDetailConstants.ROOT_DISK_CONTROLLER, "scsi");
passwordEnabledValue, guestOS.getId(), true, hyperType, templateTag, cmd.getDetails(), sshKeyEnabledValue, isDynamicScalingEnabled, false);
@Override public VirtualMachineTO implement(VirtualMachineProfile vm) { VirtualMachineTO to = toVirtualMachineTO(vm); to.setBootloader(vm.getBootLoaderType()); // Determine the VM's OS description GuestOSVO guestOS = _guestOsDao.findById(vm.getVirtualMachine().getGuestOSId()); to.setOs(guestOS.getDisplayName()); return to; }
@Override public VirtualMachineTO implement(VirtualMachineProfile vm) { VirtualMachineTO to = toVirtualMachineTO(vm); setVmQuotaPercentage(to, vm); // Determine the VM's OS description GuestOSVO guestOS = _guestOsDao.findByIdIncludingRemoved(vm.getVirtualMachine().getGuestOSId()); to.setOs(guestOS.getDisplayName()); HostVO host = _hostDao.findById(vm.getVirtualMachine().getHostId()); GuestOSHypervisorVO guestOsMapping = null; if (host != null) { guestOsMapping = _guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), getHypervisorType().toString(), host.getHypervisorVersion()); } if (guestOsMapping == null || host == null) { to.setPlatformEmulator("Other"); } else { to.setPlatformEmulator(guestOsMapping.getGuestOsName()); } return to; }
@Override public VirtualMachineTO implement(VirtualMachineProfile vm) { VirtualMachineTO to = toVirtualMachineTO(vm); to.setBootloader(vm.getBootLoaderType()); GuestOSVO guestOS = guestOsDao.findById(vm.getVirtualMachine() .getGuestOSId()); to.setOs(guestOS.getDisplayName()); return to; }
boolean isWindows = _guestOSCategoryDao.findById(_guestOSDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows");
List<VolumeObjectTO> volumeTOs = vmSnapshotHelper.getVolumeTOList(virtualMachine.getId()); CreateVMSnapshotCommand ccmd = new CreateVMSnapshotCommand(virtualMachine.getInstanceName(), virtualMachine.getUuid(), vmSnapshotTO, volumeTOs, guestOS.getDisplayName()); HostVO host = hostDao.findById(hostId); GuestOSHypervisorVO guestOsMapping = guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), host.getHypervisorType().toString(), host.getHypervisorVersion()); ccmd.setPlatformEmulator(guestOsMapping.getGuestOsName()); ccmd.setWait(wait);
@Override public VirtualMachineTO implement(VirtualMachineProfile vm) { VirtualMachineTO to = toVirtualMachineTO(vm); VMInstanceVO vo = _vmDao.findById(vm.getId()); if (vo.getLastHostId() == null) { to.setBootArgs(BaremetalManager.DO_PXE); } Map<String, String> details = new HashMap<String, String>(); details.put("template", vm.getTemplate().getUrl()); to.setDetails(details); // Determine the VM's OS description GuestOSVO guestOS = _guestOsDao.findById(vm.getVirtualMachine().getGuestOSId()); to.setOs(guestOS.getDisplayName()); return to; }
if (guestOsVo.getCategoryId() == 6) sb.append("&guest=windows");
Long hostId = vmSnapshotHelper.pickRunningHost(vmSnapshot.getVmId()); GuestOSVO guestOS = guestOSDao.findById(userVm.getGuestOSId()); RevertToVMSnapshotCommand revertToSnapshotCommand = new RevertToVMSnapshotCommand(vmInstanceName, userVm.getUuid(), vmSnapshotTO, volumeTOs, guestOS.getDisplayName()); HostVO host = hostDao.findById(hostId); GuestOSHypervisorVO guestOsMapping = guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), host.getHypervisorType().toString(), host.getHypervisorVersion()); if (guestOsMapping == null) { revertToSnapshotCommand.setPlatformEmulator(null);
List<VolumeObjectTO> volumeTOs = getVolumeTOList(userVm.getId()); GuestOSVO guestOS = _guestOSDao.findById(userVm.getGuestOSId()); RestoreVMSnapshotCommand restoreSnapshotCommand = new RestoreVMSnapshotCommand(vmInstanceName, null, volumeTOs, guestOS.getDisplayName()); restoreSnapshotCommand.setSnapshots(snapshots); restoreSnapshotCommand.setSnapshotAndParents(snapshotAndParents);
private boolean configureConfigDriveData(final VirtualMachineProfile profile, final NicProfile nic) { final UserVmVO vm = _userVmDao.findById(profile.getId()); if (vm.getType() != VirtualMachine.Type.User) { return false; } final Nic defaultNic = _networkModel.getDefaultNic(vm.getId()); if (defaultNic != null) { final String sshPublicKey = getSshKey(profile); final String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getId(), vm.getServiceOfferingId()).getDisplayText(); boolean isWindows = _guestOSCategoryDao.findById(_guestOSDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows"); final List<String[]> vmData = _networkModel.generateVmData(vm.getUserData(), serviceOffering, vm.getDataCenterId(), vm.getInstanceName(), vm.getHostName(), vm.getId(), vm.getUuid(), nic.getIPv4Address(), sshPublicKey, (String) profile.getParameter(VirtualMachineProfile.Param.VmPassword), isWindows); profile.setVmData(vmData); profile.setConfigDriveLabel(VirtualMachineManager.VmConfigDriveLabel.value()); } return true; }
to.setOs(guestOS.getDisplayName()); HostVO host = hostDao.findById(vm.getVirtualMachine().getHostId()); GuestOSHypervisorVO guestOsMapping = null; if (host != null) { guestOsMapping = guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), getHypervisorType().toString(), host.getHypervisorVersion());
@Override public boolean unquiesceVM(VirtualMachine virtualMachine, VMSnapshotTO vmSnapshotTO) { Long hostId = vmSnapshotHelper.pickRunningHost(virtualMachine.getId()); List<VolumeObjectTO> volumeTOs = vmSnapshotHelper.getVolumeTOList(virtualMachine.getId()); GuestOSVO guestOS = guestOSDao.findById(virtualMachine.getGuestOSId()); DeleteVMSnapshotCommand deleteSnapshotCommand = new DeleteVMSnapshotCommand(virtualMachine.getInstanceName(), vmSnapshotTO, volumeTOs, guestOS.getDisplayName()); try { Answer answer = agentMgr.send(hostId, deleteSnapshotCommand); if (answer != null && answer.getResult()) { return true; } else { String errMsg = (answer != null) ? answer.getDetails() : null; throw new CloudRuntimeException("Failed to unquiesce vm, due to " + errMsg); } } catch (AgentUnavailableException e) { throw new CloudRuntimeException("Failed to unquiesce vm", e); } catch (OperationTimedoutException e) { throw new CloudRuntimeException("Failed to unquiesce vm", e); } } }
final boolean isWindows = _guestOsCategoryDao.findById(_guestOsDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows"); final MigrateCommand mc = new MigrateCommand(vm.getInstanceName(), dest.getHost().getPrivateIpAddress(), isWindows, to, getExecuteInSequence(vm.getHypervisorType()));
GuestOSHypervisorVO guestOsMapping = guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), host.getHypervisorType().toString(), host.getHypervisorVersion()); CreateVMSnapshotCommand ccmd = new CreateVMSnapshotCommand(userVm.getInstanceName(), userVm.getUuid(), target, volumeTOs, guestOS.getDisplayName()); if (guestOsMapping == null) { ccmd.setPlatformEmulator(null);