Ejemplo n.º 1
0
  private void createVnet(String vnetId, String pif, String brName, String protocol)
      throws InternalErrorException {
    synchronized (_vnetBridgeMonitor) {
      String script = _modifyVlanPath;
      if (protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
        script = _modifyVxlanPath;
      }
      final Script command = new Script(script, _timeout, s_logger);
      command.add("-v", vnetId);
      command.add("-p", pif);
      command.add("-b", brName);
      command.add("-o", "add");

      final String result = command.execute();
      if (result != null) {
        throw new InternalErrorException("Failed to create vnet " + vnetId + ": " + result);
      }
    }
  }
Ejemplo n.º 2
0
 private String createVnetBr(String vNetId, String pifKey, String protocol)
     throws InternalErrorException {
   String nic = _pifs.get(pifKey);
   if (nic == null) {
     // if not found in bridge map, maybe traffic label refers to pif already?
     File pif = new File("/sys/class/net/" + pifKey);
     if (pif.isDirectory()) {
       nic = pifKey;
     }
   }
   String brName = "";
   if (protocol.equals(Networks.BroadcastDomainType.Vxlan.scheme())) {
     brName = setVxnetBrName(nic, vNetId);
   } else {
     brName = setVnetBrName(nic, vNetId);
   }
   createVnet(vNetId, nic, brName, protocol);
   return brName;
 }