|
119 | 119 | import com.cloud.network.router.VirtualRouter.Role; |
120 | 120 | import com.cloud.network.rules.FirewallRule; |
121 | 121 | import com.cloud.network.rules.PortForwardingRule; |
122 | | -import com.cloud.network.rules.PortForwardingRuleVO; |
123 | 122 | import com.cloud.network.rules.RulesManager; |
124 | 123 | import com.cloud.network.rules.dao.PortForwardingRulesDao; |
125 | 124 | import com.cloud.offering.NetworkOffering; |
@@ -651,106 +650,6 @@ public Long convertToId(final String vmName) { |
651 | 650 | return VirtualMachineName.getRouterId(vmName); |
652 | 651 | } |
653 | 652 |
|
654 | | -// @Override |
655 | | -// public HostVO prepareForMigration(final DomainRouterVO router) throws StorageUnavailableException { |
656 | | -// final long routerId = router.getId(); |
657 | | -// final boolean mirroredVols = router.isMirroredVols(); |
658 | | -// final DataCenterVO dc = _dcDao.findById(router.getDataCenterId()); |
659 | | -// final HostPodVO pod = _podDao.findById(router.getPodId()); |
660 | | -// final ServiceOfferingVO offering = _serviceOfferingDao.findById(router.getServiceOfferingId()); |
661 | | -// StoragePoolVO sp = _storageMgr.getStoragePoolForVm(router.getId()); |
662 | | -// |
663 | | -// final List<VolumeVO> vols = _volsDao.findCreatedByInstance(routerId); |
664 | | -// |
665 | | -// final String[] storageIps = new String[2]; |
666 | | -// final VolumeVO vol = vols.get(0); |
667 | | -// storageIps[0] = vol.getHostIp(); |
668 | | -// if (mirroredVols && (vols.size() == 2)) { |
669 | | -// storageIps[1] = vols.get(1).getHostIp(); |
670 | | -// } |
671 | | -// |
672 | | -// final PrepareForMigrationCommand cmd = new PrepareForMigrationCommand(router.getInstanceName(), router.getVnet(), storageIps, vols, |
673 | | -// mirroredVols); |
674 | | -// |
675 | | -// HostVO routingHost = null; |
676 | | -// final HashSet<Host> avoid = new HashSet<Host>(); |
677 | | -// |
678 | | -// final HostVO fromHost = _hostDao.findById(router.getHostId()); |
679 | | -// if (fromHost.getHypervisorType() != HypervisorType.KVM && fromHost.getClusterId() == null) { |
680 | | -// s_logger.debug("The host is not in a cluster"); |
681 | | -// return null; |
682 | | -// } |
683 | | -// avoid.add(fromHost); |
684 | | -// |
685 | | -// while ((routingHost = (HostVO) _agentMgr.findHost(Host.Type.Routing, dc, pod, sp, offering, _template, router, fromHost, avoid)) != null) { |
686 | | -// avoid.add(routingHost); |
687 | | -// if (s_logger.isDebugEnabled()) { |
688 | | -// s_logger.debug("Trying to migrate router to host " + routingHost.getName()); |
689 | | -// } |
690 | | -// |
691 | | -// if (!_storageMgr.share(router, vols, routingHost, false)) { |
692 | | -// s_logger.warn("Can not share " + vol.getPath() + " to " + router.getName()); |
693 | | -// throw new StorageUnavailableException("Can not share " + vol.getPath() + " to " + router.getName(), sp.getId()); |
694 | | -// } |
695 | | -// |
696 | | -// final Answer answer = _agentMgr.easySend(routingHost.getId(), cmd); |
697 | | -// if (answer != null && answer.getResult()) { |
698 | | -// return routingHost; |
699 | | -// } |
700 | | -// |
701 | | -// _storageMgr.unshare(router, vols, routingHost); |
702 | | -// } |
703 | | -// |
704 | | -// return null; |
705 | | -// } |
706 | | -// |
707 | | -// @Override |
708 | | -// public boolean migrate(final DomainRouterVO router, final HostVO host) { |
709 | | -// final HostVO fromHost = _hostDao.findById(router.getHostId()); |
710 | | -// |
711 | | -// if (!_itMgr.stateTransitTo(router, VirtualMachine.Event.MigrationRequested, router.getHostId())) { |
712 | | -// s_logger.debug("State for " + router.toString() + " has changed so migration can not take place."); |
713 | | -// return false; |
714 | | -// } |
715 | | -// |
716 | | -// final MigrateCommand cmd = new MigrateCommand(router.getInstanceName(), host.getPrivateIpAddress(), false); |
717 | | -// final Answer answer = _agentMgr.easySend(fromHost.getId(), cmd); |
718 | | -// if (answer == null) { |
719 | | -// return false; |
720 | | -// } |
721 | | -// |
722 | | -// final List<VolumeVO> vols = _volsDao.findCreatedByInstance(router.getId()); |
723 | | -// if (vols.size() == 0) { |
724 | | -// return true; |
725 | | -// } |
726 | | -// |
727 | | -// _storageMgr.unshare(router, vols, fromHost); |
728 | | -// |
729 | | -// return true; |
730 | | -// } |
731 | | -// |
732 | | -// @Override |
733 | | -// public boolean completeMigration(final DomainRouterVO router, final HostVO host) throws OperationTimedoutException, AgentUnavailableException { |
734 | | -// final CheckVirtualMachineCommand cvm = new CheckVirtualMachineCommand(router.getInstanceName()); |
735 | | -// final CheckVirtualMachineAnswer answer = (CheckVirtualMachineAnswer) _agentMgr.send(host.getId(), cvm); |
736 | | -// if (answer == null || !answer.getResult()) { |
737 | | -// s_logger.debug("Unable to complete migration for " + router.getId()); |
738 | | -// _itMgr.stateTransitTo(router, VirtualMachine.Event.AgentReportStopped, null); |
739 | | -// return false; |
740 | | -// } |
741 | | -// |
742 | | -// final State state = answer.getState(); |
743 | | -// if (state == State.Stopped) { |
744 | | -// s_logger.warn("Unable to complete migration as we can not detect it on " + host.getId()); |
745 | | -// _itMgr.stateTransitTo(router, VirtualMachine.Event.AgentReportStopped, null); |
746 | | -// return false; |
747 | | -// } |
748 | | -// |
749 | | -// _itMgr.stateTransitTo(router, VirtualMachine.Event.OperationSucceeded, host.getId()); |
750 | | -// |
751 | | -// return true; |
752 | | -// } |
753 | | - |
754 | 653 | protected class RouterCleanupTask implements Runnable { |
755 | 654 |
|
756 | 655 | public RouterCleanupTask() { |
|
0 commit comments