private void VifHotPlug(final Connect conn, final String vmName, final String broadcastUri, final String macAddr) throws InternalErrorException, LibvirtException { final NicTO nicTO = new NicTO(); nicTO.setMac(macAddr); nicTO.setType(TrafficType.Public); if (broadcastUri == null) { nicTO.setBroadcastType(BroadcastDomainType.Native); } else { final URI uri = BroadcastDomainType.fromString(broadcastUri); nicTO.setBroadcastType(BroadcastDomainType.getSchemeValue(uri)); nicTO.setBroadcastUri(uri); } final Domain vm = getDomain(conn, vmName); vm.attachDevice(getVifDriver(nicTO.getType()).plug(nicTO, "Other PV", "", null).toString()); }
nicTo.setMac(mac); } catch (InsufficientAddressCapacityException e) { throw new CloudRuntimeException("unable to allocate mac address on network: " + networkId);
nic.setMac(ip.getVifMacAddress()); nic.setType(ip.getTrafficType()); if (ip.getBroadcastUri() == null) {
nic.setMac(ip.getVifMacAddress()); nic.setType(ip.getTrafficType()); if (ip.getBroadcastUri() == null) {
to.setIp(profile.getIPv4Address()); to.setNetmask(profile.getIPv4Netmask()); to.setMac(profile.getMacAddress()); to.setDns1(profile.getIPv4Dns1()); to.setDns2(profile.getIPv4Dns2());
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; }