protected Long destroyVM(final HaWorkVO work) { final VirtualMachine vm = _itMgr.findById(work.getInstanceId()); s_logger.info("Destroying " + vm.toString()); try { if (vm.getState() != State.Destroyed) { s_logger.info("VM is no longer in Destroyed state " + vm.toString()); return null; } if (vm.getHostId() != null) { _itMgr.destroy(vm.getUuid(), false); s_logger.info("Successfully destroy " + vm); return null; } else { if (s_logger.isDebugEnabled()) { s_logger.debug(vm + " has already been stopped"); } return null; } } catch (final AgentUnavailableException e) { s_logger.debug("Agnet is not available" + e.getMessage()); } catch (OperationTimedoutException e) { s_logger.debug("operation timed out: " + e.getMessage()); } catch (ConcurrentOperationException e) { s_logger.debug("concurrent operation: " + e.getMessage()); } return (System.currentTimeMillis() >> 10) + _stopRetryInterval; }
private void handleThumbnailRequest(HttpServletRequest req, HttpServletResponse resp, long vmId) { VirtualMachine vm = _vmMgr.findById(vmId); if (vm == null) { s_logger.warn("VM " + vmId + " does not exist, sending blank response for thumbnail request");
private void handleAuthRequest(HttpServletRequest req, HttpServletResponse resp, long vmId) { // TODO authentication channel between console proxy VM and management server needs to be secured, // the data is now being sent through private network, but this is apparently not enough VirtualMachine vm = _vmMgr.findById(vmId); if (vm == null) { s_logger.warn("VM " + vmId + " does not exist, sending failed response for authentication request from console proxy"); sendResponse(resp, "failed"); return; } if (vm.getHostId() == null) { s_logger.warn("VM " + vmId + " lost host info, failed response for authentication request from console proxy"); sendResponse(resp, "failed"); return; } HostVO host = _ms.getHostBy(vm.getHostId()); if (host == null) { s_logger.warn("VM " + vmId + "'s host does not exist, sending failed response for authentication request from console proxy"); sendResponse(resp, "failed"); return; } String sid = req.getParameter("sid"); if (sid == null || !sid.equals(vm.getVncPassword())) { s_logger.warn("sid " + sid + " in url does not match stored sid."); sendResponse(resp, "failed"); return; } sendResponse(resp, "success"); }
private void handleAccessRequest(HttpServletRequest req, HttpServletResponse resp, long vmId) { VirtualMachine vm = _vmMgr.findById(vmId); if (vm == null) { s_logger.warn("VM " + vmId + " does not exist, sending blank response for console access request");
private boolean checkSessionPermision(HttpServletRequest req, long vmId, Account accountObj) { VirtualMachine vm = _vmMgr.findById(vmId); if (vm == null) { s_logger.debug("Console/thumbnail access denied. VM " + vmId + " does not exist in system any more");
protected Long stopVM(final HaWorkVO work) throws ConcurrentOperationException { VirtualMachine vm = _itMgr.findById(work.getInstanceId()); if (vm == null) { s_logger.info("No longer can find VM " + work.getInstanceId() + ". Throwing away " + work);
VirtualMachine vm = _itMgr.findById(work.getInstanceId()); if (vm == null) { s_logger.info("Unable to find vm: " + vmId); vm = _itMgr.findById(vm.getId()); hostDesc, "The Storage is unavailable for trying to restart VM, name: " + vm.getHostName() + ", id: " + vmId + " which was running on host " + hostDesc); vm = _itMgr.findById(vm.getId()); work.setUpdateTime(vm.getUpdated()); work.setPreviousState(vm.getState());
VirtualMachine vmoi = _itMgr.findById(vm.getId()); VirtualMachineProfileImpl vmOldProfile = new VirtualMachineProfileImpl(vmoi); networks.put(networkList.get(0), new ArrayList<NicProfile>(Arrays.asList(profile))); VirtualMachine vmi = _itMgr.findById(vm.getId()); VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmi); _networkMgr.allocate(vmProfile, networks, null); VirtualMachine vmi = _itMgr.findById(vm.getId()); VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmi); VirtualMachine vmi = _itMgr.findById(vm.getId()); VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmi); _networkMgr.allocate(vmProfile, networks, null);