com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo Java Examples
The following examples show how to use
com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NetworkManager.java From development with Apache License 2.0 | 6 votes |
private static void replaceNetworkAdapter( VirtualMachineConfigSpec vmConfigSpec, VirtualDevice oldNIC, ManagedObjectReference newNetworkRef, String newNetworkName) throws Exception { logger.debug("new network: " + newNetworkName); VirtualEthernetCardNetworkBackingInfo nicBacking = new VirtualEthernetCardNetworkBackingInfo(); nicBacking.setDeviceName(newNetworkName); nicBacking.setNetwork(newNetworkRef); nicBacking.setUseAutoDetect(true); oldNIC.setBacking(nicBacking); VirtualDeviceConnectInfo info = new VirtualDeviceConnectInfo(); info.setConnected(true); info.setStartConnected(true); info.setAllowGuestControl(true); oldNIC.setConnectable(info); // oldNIC.getConnectable().setConnected(true); // oldNIC.getConnectable().setStartConnected(true); VirtualDeviceConfigSpec vmDeviceSpec = new VirtualDeviceConfigSpec(); vmDeviceSpec.setOperation(VirtualDeviceConfigSpecOperation.EDIT); vmDeviceSpec.setDevice(oldNIC); vmConfigSpec.getDeviceChange().add(vmDeviceSpec); }
Example #2
Source File: VmwareNetworkProcess.java From primecloud-controller with GNU General Public License v2.0 | 6 votes |
protected VirtualEthernetCard editEthernetCards(VirtualMachine machine, String networkName) { // ネットワークアダプタ E1000を使用する VirtualEthernetCard ethernetCard = new VirtualE1000(); // 分散ポートグループ情報取得 DistributedVirtualPortgroupInfo dvPortgroupInfo = getDVPortgroupInfo(machine, networkName); if (dvPortgroupInfo != null) { // 分散ポートグループの場合 VirtualEthernetCardDistributedVirtualPortBackingInfo nicBacking = new VirtualEthernetCardDistributedVirtualPortBackingInfo(); nicBacking.setPort(new DistributedVirtualSwitchPortConnection()); nicBacking.getPort().setPortgroupKey(dvPortgroupInfo.getPortgroupKey()); nicBacking.getPort().setSwitchUuid(dvPortgroupInfo.getSwitchUuid()); ethernetCard.setBacking(nicBacking); } else { // 標準ポートグループの場合 VirtualEthernetCardNetworkBackingInfo backingInfo = new VirtualEthernetCardNetworkBackingInfo(); backingInfo.setDeviceName(networkName); ethernetCard.setBacking(backingInfo); } return ethernetCard; }
Example #3
Source File: VmwareNetworkProcess.java From primecloud-controller with GNU General Public License v2.0 | 6 votes |
protected boolean checkSameNormalNetwork(VirtualEthernetCard ethernetCard1, VirtualEthernetCard ethernetCard2) { if (!(ethernetCard1.getBacking() instanceof VirtualEthernetCardNetworkBackingInfo)) { return false; } if (!(ethernetCard2.getBacking() instanceof VirtualEthernetCardNetworkBackingInfo)) { return false; } VirtualEthernetCardNetworkBackingInfo backingInfo1 = VirtualEthernetCardNetworkBackingInfo.class .cast(ethernetCard1.getBacking()); VirtualEthernetCardNetworkBackingInfo backingInfo2 = VirtualEthernetCardNetworkBackingInfo.class .cast(ethernetCard2.getBacking()); return StringUtils.equals(backingInfo1.getDeviceName(), backingInfo2.getDeviceName()); }
Example #4
Source File: VmwareHelper.java From cloudstack with Apache License 2.0 | 6 votes |
public static VirtualDevice prepareNicDevice(VirtualMachineMO vmMo, ManagedObjectReference morNetwork, VirtualEthernetCardType deviceType, String portGroupName, String macAddress, int contextNumber, boolean connected, boolean connectOnStart) throws Exception { VirtualEthernetCard nic = createVirtualEthernetCard(deviceType); VirtualEthernetCardNetworkBackingInfo nicBacking = new VirtualEthernetCardNetworkBackingInfo(); nicBacking.setDeviceName(portGroupName); nicBacking.setNetwork(morNetwork); nic.setBacking(nicBacking); nic.setAddressType("Manual"); nic.setConnectable(getVirtualDeviceConnectInfo(connected, connectOnStart)); nic.setMacAddress(macAddress); nic.setKey(-contextNumber); return nic; }
Example #5
Source File: VmUtils.java From cs-actions with Apache License 2.0 | 5 votes |
private VirtualEthernetCard getEth(String fileName, String addressType, Integer key) { VirtualEthernetCardNetworkBackingInfo nicBacking = new VirtualEthernetCardNetworkBackingInfo(); nicBacking.setDeviceName(fileName); VirtualEthernetCard nic = new VirtualPCNet32(); nic.setBacking(nicBacking); nic.setAddressType(addressType); nic.setKey(key); return nic; }
Example #6
Source File: VMwareGuru.java From cloudstack with Apache License 2.0 | 5 votes |
/** * Get network MO from VM NIC */ private NetworkMO getNetworkMO(VirtualE1000 nic, VmwareContext context) { VirtualDeviceConnectInfo connectable = nic.getConnectable(); VirtualEthernetCardNetworkBackingInfo info = (VirtualEthernetCardNetworkBackingInfo)nic.getBacking(); ManagedObjectReference networkMor = info.getNetwork(); if (networkMor == null) { throw new CloudRuntimeException("Could not find network for NIC on: " + nic.getMacAddress()); } return new NetworkMO(context, networkMor); }
Example #7
Source File: VmwareHelper.java From cloudstack with Apache License 2.0 | 4 votes |
public static void updateNicDevice(VirtualDevice nic, ManagedObjectReference morNetwork, String portGroupName) throws Exception { VirtualEthernetCardNetworkBackingInfo nicBacking = new VirtualEthernetCardNetworkBackingInfo(); nicBacking.setDeviceName(portGroupName); nicBacking.setNetwork(morNetwork); nic.setBacking(nicBacking); }