コード例 #1
0
  @Override
  public boolean prepareMigration(
      final NicProfile nic,
      final Network network,
      final VirtualMachineProfile vm,
      final DeployDestination dest,
      final ReservationContext context) {
    if (!canHandle(network, Service.Connectivity)) {
      return false;
    }

    if (nic.getBroadcastType() != Networks.BroadcastDomainType.Vswitch) {
      return false;
    }

    if (nic.getTrafficType() != Networks.TrafficType.Guest) {
      return false;
    }

    if (vm.getType() != VirtualMachine.Type.User
        && vm.getType() != VirtualMachine.Type.DomainRouter) {
      return false;
    }

    // prepare the tunnel network on the host, in order for VM to get launched
    _ovsTunnelMgr.checkAndPrepareHostForTunnelNetwork(network, dest.getHost());

    return true;
  }
コード例 #2
0
  @Override
  public boolean release(
      final Network network,
      final NicProfile nic,
      final VirtualMachineProfile vm,
      final ReservationContext context)
      throws ConcurrentOperationException, ResourceUnavailableException {
    if (!canHandle(network, Service.Connectivity)) {
      return false;
    }
    if (nic.getBroadcastType() != Networks.BroadcastDomainType.Vswitch) {
      return false;
    }

    if (nic.getTrafficType() != Networks.TrafficType.Guest) {
      return false;
    }

    final HostVO host = _hostDao.findById(vm.getVirtualMachine().getHostId());
    _ovsTunnelMgr.checkAndRemoveHostFromTunnelNetwork(network, host);
    return true;
  }