public void setProperties(ModelController controller, VMInstanceVO instance, NicVO nic) throws IOException { _vmName = instance.getInstanceName(); _deviceId = nic.getDeviceId(); Network network = controller.getNetworkDao().findById(nic.getNetworkId()); switch (nic.getState()) { case Allocated: case Reserved: _nicActive = true; break; default: _nicActive = false; break; } switch (network.getState()) { case Implemented: case Setup: _netActive = true; break; default: _netActive = false; break; } assert _vnModel != null; _networkId = _vnModel.getUuid(); }
ipModel = new InstanceIpModel(vm.getInstanceName(), nic.getDeviceId()); ipModel.addToVMInterface(vmiModel);
s_logger.debug("no mac address is allocated for Nic " + nicVO.getUuid()); } else { s_logger.info("VMI " + _manager.getVifNameByVmUuid(vm.getUuid(), nicVO.getDeviceId()) + " got mac address: " + macs.getMacAddress().get(0)); nic.setMacAddress(macs.getMacAddress().get(0));
String tag; switch (nic.getDeviceId()) { case 0: tag = "management";
Integer chosenID = nic.getDeviceId(); Integer existingID = existing.getDeviceId();
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; }
deviceIdSearch.select(null, Func.DISTINCT, deviceIdSearch.entity().getDeviceId()); deviceIdSearch.and("instance", deviceIdSearch.entity().getInstanceId(), Op.EQ); deviceIdSearch.done();