protected ExecutionResult prepareNetworkElementCommand(final SetupGuestNetworkCommand cmd) { final NicTO nic = cmd.getNic(); final String domrName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME); try { final URI broadcastUri = nic.getBroadcastUri(); final String vlanId = BroadcastDomainType.getValue(broadcastUri); final int ethDeviceNum = getVmNics(domrName, vlanId); if (ethDeviceNum > 0) { nic.setDeviceId(ethDeviceNum); } else { return new ExecutionResult(false, "Prepare SetupGuestNetwork failed due to unable to find the nic"); } } catch (final Exception e) { final String msg = "Prepare SetupGuestNetwork failed due to " + e.toString(); s_logger.warn(msg, e); return new ExecutionResult(false, msg); } return new ExecutionResult(true, null); }
private ExecutionResult prepareNetworkElementCommand(final SetNetworkACLCommand cmd) { final NicTO nic = cmd.getNic(); final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME); try { final URI broadcastUri = nic.getBroadcastUri(); final String vlanId = BroadcastDomainType.getValue(broadcastUri); final int ethDeviceNum = getVmNics(routerName, vlanId); if (ethDeviceNum > 0) { nic.setDeviceId(ethDeviceNum); } else { return new ExecutionResult(false, "Prepare SetNetworkACL failed due to unable to find the nic"); } } catch (final Exception e) { final String msg = "Prepare SetNetworkACL failed due to " + e.toString(); s_logger.error(msg, e); return new ExecutionResult(false, msg); } return new ExecutionResult(true, null); }
nic.setDeviceId(Integer.parseInt(domrVif.getDevice(conn))); } catch (final Exception e) { final String msg = "Creating guest network failed due to " + e.toString();
protected ExecutionResult prepareNetworkElementCommand(final SetNetworkACLCommand cmd) { final Connection conn = getConnection(); final String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME); try { final VM router = getVM(conn, routerName); final NicTO nic = cmd.getNic(); if (nic != null) { final VIF vif = getVifByMac(conn, router, nic.getMac()); if (vif == null) { final String msg = "Prepare SetNetworkACL failed due to VIF is null for : " + nic.getMac() + " with routername: " + routerName; s_logger.error(msg); return new ExecutionResult(false, msg); } nic.setDeviceId(Integer.parseInt(vif.getDevice(conn))); } else { final String msg = "Prepare SetNetworkACL failed due to nic is null for : " + routerName; s_logger.error(msg); return new ExecutionResult(false, msg); } } catch (final Exception e) { final String msg = "Prepare SetNetworkACL failed due to " + e.toString(); s_logger.error(msg, e); return new ExecutionResult(false, msg); } return new ExecutionResult(true, null); }
nic.setDeviceId(Integer.parseInt(deviceId)); final VIF vif = citrixResourceBase.createVif(conn, vmName, vm, null, nic);
nic.setBroadcastUri(uri); nic.setDeviceId(0); nic.setNetworkRateMbps(ip.getNetworkRate()); nic.setName(ip.getNetworkName()); nic.setDeviceId(Integer.parseInt(vifDeviceNum));
nicTo.setDeviceId(deviceId++); nicTo.setBroadcastType(BroadcastDomainType.Vlan); nicTo.setType(TrafficType.Public);
nic.setBroadcastUri(uri); nic.setDeviceId(0); nic.setNetworkRateMbps(ip.getNetworkRate()); nic.setName(ip.getNetworkName());
@Override public NicTO toNicTO(NicProfile profile) { NicTO to = new NicTO(); to.setDeviceId(profile.getDeviceId()); to.setBroadcastType(profile.getBroadcastType()); to.setType(profile.getTrafficType());
protected NicTO toNicTO(final NicVO nic, final NicProfile profile, final NetworkVO config) { final NicTO to = new NicTO(); to.setDeviceId(nic.getDeviceId()); to.setBroadcastType(config.getBroadcastDomainType()); to.setType(config.getTrafficType()); to.setIp(nic.getIPv4Address()); to.setNetmask(nic.getIPv4Netmask()); to.setMac(nic.getMacAddress()); to.setDns1(profile.getIPv4Dns1()); to.setDns2(profile.getIPv4Dns2()); if (nic.getIPv4Gateway() != null) { to.setGateway(nic.getIPv4Gateway()); } else { to.setGateway(config.getGateway()); } if (nic.getVmType() != VirtualMachine.Type.User) { to.setPxeDisable(true); } to.setDefaultNic(nic.isDefaultNic()); to.setBroadcastUri(nic.getBroadcastUri()); to.setIsolationuri(nic.getIsolationUri()); if (profile != null) { to.setDns1(profile.getIPv4Dns1()); to.setDns2(profile.getIPv4Dns2()); } final Integer networkRate = _networkModel.getNetworkRate(config.getId(), null); to.setNetworkRateMbps(networkRate); to.setUuid(config.getUuid()); return to; }