Examples of OvsTunnelInterfaceVO


Examples of com.cloud.network.ovs.dao.OvsTunnelInterfaceVO

  }

  @DB
  protected OvsTunnelInterfaceVO createInterfaceRecord(String ip,
      String netmask,String mac,long hostId, String label) {
    OvsTunnelInterfaceVO ti = null;
    try {
      ti = new OvsTunnelInterfaceVO(ip, netmask, mac, hostId, label);
      //TODO: Is locking really necessary here?
      OvsTunnelInterfaceVO lock =
          _tunnelInterfaceDao.acquireInLockTable(Long.valueOf(1));
      if (lock == null) {
          s_logger.warn("Cannot lock table ovs_tunnel_account");
          return null;
      }
      _tunnelInterfaceDao.persist(ti);
      _tunnelInterfaceDao.releaseFromLockTable(lock.getId());
    } catch (EntityExistsException e) {
      s_logger.debug("A record for the interface for network " + label +
                 " on host id " + hostId + " already exists");
    }
    return ti;
View Full Code Here

Examples of com.cloud.network.ovs.dao.OvsTunnelInterfaceVO

  private String handleFetchInterfaceAnswer(Answer[] answers, Long hostId){
    OvsFetchInterfaceAnswer ans = (OvsFetchInterfaceAnswer) answers[0];
    if (ans.getResult()) {
      if (ans.getIp() != null &&
        !("".equals(ans.getIp()))) {
        OvsTunnelInterfaceVO ti =
            createInterfaceRecord(ans.getIp(), ans.getNetmask(),
                        ans.getMac(), hostId, ans.getLabel());
        return ti.getIp();
      }
    }
    // Fetch interface failed!
      s_logger.warn("Unable to fetch the IP address for the GRE tunnel endpoint" +
              ans.getDetails());
View Full Code Here

Examples of com.cloud.network.ovs.dao.OvsTunnelInterfaceVO

                " unsupported by OVS Tunnel Manager");
        }
   
        // Try to fetch GRE endpoint IP address for cloud db
        // If not found, then find it on the hypervisor           
        OvsTunnelInterfaceVO tunnelIface =
            _tunnelInterfaceDao.getByHostAndLabel(host.getId(),
                                physNetLabel);
        if (tunnelIface == null) {
            //Now find and fetch configuration for physical interface
          //for network with label on target host
      Commands fetchIfaceCmds =
          new Commands(new OvsFetchInterfaceCommand(physNetLabel));
      s_logger.debug("Ask host " + host.getId() +
               " to retrieve interface for phy net with label:" +
               physNetLabel);
      Answer[] fetchIfaceAnswers = _agentMgr.send(host.getId(),
                            fetchIfaceCmds);
            //And finally save it for future use
      endpointIp = handleFetchInterfaceAnswer(fetchIfaceAnswers,
                          host.getId());
        } else {
          endpointIp = tunnelIface.getIp();
        }
        return endpointIp;
  }
View Full Code Here

Examples of com.cloud.network.ovs.dao.OvsTunnelInterfaceVO

    }

    @DB
    protected OvsTunnelInterfaceVO createInterfaceRecord(String ip,
            String netmask, String mac, long hostId, String label) {
        OvsTunnelInterfaceVO ti = null;
        try {
            ti = new OvsTunnelInterfaceVO(ip, netmask, mac, hostId, label);
            // TODO: Is locking really necessary here?
            OvsTunnelInterfaceVO lock = _tunnelInterfaceDao
                    .acquireInLockTable(Long.valueOf(1));
            if (lock == null) {
                s_logger.warn("Cannot lock table ovs_tunnel_account");
                return null;
            }
            _tunnelInterfaceDao.persist(ti);
            _tunnelInterfaceDao.releaseFromLockTable(lock.getId());
        } catch (EntityExistsException e) {
            s_logger.debug("A record for the interface for network " + label
                    + " on host id " + hostId + " already exists");
        }
        return ti;
View Full Code Here

Examples of com.cloud.network.ovs.dao.OvsTunnelInterfaceVO

    private String handleFetchInterfaceAnswer(Answer[] answers, Long hostId) {
        OvsFetchInterfaceAnswer ans = (OvsFetchInterfaceAnswer)answers[0];
        if (ans.getResult()) {
            if (ans.getIp() != null && !("".equals(ans.getIp()))) {
                OvsTunnelInterfaceVO ti = createInterfaceRecord(ans.getIp(),
                        ans.getNetmask(), ans.getMac(), hostId, ans.getLabel());
                return ti.getIp();
            }
        }
        // Fetch interface failed!
        s_logger.warn("Unable to fetch the IP address for the GRE tunnel endpoint"
                + ans.getDetails());
View Full Code Here

Examples of com.cloud.network.ovs.dao.OvsTunnelInterfaceVO

                    " unsupported by OVS Tunnel Manager");
        }

        // Try to fetch GRE endpoint IP address for cloud db
        // If not found, then find it on the hypervisor
        OvsTunnelInterfaceVO tunnelIface =
                _tunnelInterfaceDao.getByHostAndLabel(host.getId(),
                        physNetLabel);
        if (tunnelIface == null) {
            //Now find and fetch configuration for physical interface
            //for network with label on target host
            Commands fetchIfaceCmds =
                    new Commands(new OvsFetchInterfaceCommand(physNetLabel));
            s_logger.debug("Ask host " + host.getId() +
                    " to retrieve interface for phy net with label:" +
                    physNetLabel);
            Answer[] fetchIfaceAnswers = _agentMgr.send(host.getId(), fetchIfaceCmds);
            //And finally save it for future use
            endpointIp = handleFetchInterfaceAnswer(fetchIfaceAnswers, host.getId());
        } else {
            endpointIp = tunnelIface.getIp();
        }
        return endpointIp;
    }
View Full Code Here

Examples of com.cloud.network.ovs.dao.OvsTunnelInterfaceVO

  }

  @DB
  protected OvsTunnelInterfaceVO createInterfaceRecord(String ip,
      String netmask,String mac,long hostId, String label) {
    OvsTunnelInterfaceVO ti = null;
    try {
      ti = new OvsTunnelInterfaceVO(ip, netmask, mac, hostId, label);
      //TODO: Is locking really necessary here?
      OvsTunnelInterfaceVO lock =
          _tunnelInterfaceDao.acquireInLockTable(Long.valueOf(1));
      if (lock == null) {
          s_logger.warn("Cannot lock table ovs_tunnel_account");
          return null;
      }
      _tunnelInterfaceDao.persist(ti);
      _tunnelInterfaceDao.releaseFromLockTable(lock.getId());
    } catch (EntityExistsException e) {
      s_logger.debug("A record for the interface for network " + label +
                 " on host id " + hostId + " already exists");
    }
    return ti;
View Full Code Here

Examples of com.cloud.network.ovs.dao.OvsTunnelInterfaceVO

  private String handleFetchInterfaceAnswer(Answer[] answers, Long hostId){
    OvsFetchInterfaceAnswer ans = (OvsFetchInterfaceAnswer) answers[0];
    if (ans.getResult()) {
      if (ans.getIp() != null &&
        !("".equals(ans.getIp()))) {
        OvsTunnelInterfaceVO ti =
            createInterfaceRecord(ans.getIp(), ans.getNetmask(),
                        ans.getMac(), hostId, ans.getLabel());
        return ti.getIp();
      }
    }
    // Fetch interface failed!
      s_logger.warn("Unable to fetch the IP address for the GRE tunnel endpoint" +
              ans.getDetails());
View Full Code Here

Examples of com.cloud.network.ovs.dao.OvsTunnelInterfaceVO

                " unsupported by OVS Tunnel Manager");
        }
   
        // Try to fetch GRE endpoint IP address for cloud db
        // If not found, then find it on the hypervisor           
        OvsTunnelInterfaceVO tunnelIface =
            _tunnelInterfaceDao.getByHostAndLabel(host.getId(),
                                physNetLabel);
        if (tunnelIface == null) {
            //Now find and fetch configuration for physical interface
          //for network with label on target host
      Commands fetchIfaceCmds =
          new Commands(new OvsFetchInterfaceCommand(physNetLabel));
      s_logger.debug("Ask host " + host.getId() +
               " to retrieve interface for phy net with label:" +
               physNetLabel);
      Answer[] fetchIfaceAnswers = _agentMgr.send(host.getId(),
                            fetchIfaceCmds);
            //And finally save it for future use
      endpointIp = handleFetchInterfaceAnswer(fetchIfaceAnswers,
                          host.getId());
        } else {
          endpointIp = tunnelIface.getIp();
        }
        return endpointIp;
  }
View Full Code Here

Examples of com.cloud.network.ovs.dao.OvsTunnelInterfaceVO

    }

    @DB
    protected OvsTunnelInterfaceVO createInterfaceRecord(String ip,
            String netmask, String mac, long hostId, String label) {
        OvsTunnelInterfaceVO ti = null;
        try {
            ti = new OvsTunnelInterfaceVO(ip, netmask, mac, hostId, label);
            //TODO: Is locking really necessary here?
            OvsTunnelInterfaceVO lock =
                    _tunnelInterfaceDao.acquireInLockTable(Long.valueOf(1));
            if (lock == null) {
                s_logger.warn("Cannot lock table ovs_tunnel_account");
                return null;
            }
            _tunnelInterfaceDao.persist(ti);
            _tunnelInterfaceDao.releaseFromLockTable(lock.getId());
        } catch (EntityExistsException e) {
            s_logger.debug("A record for the interface for network " + label +
                    " on host id " + hostId + " already exists");
        }
        return ti;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.