本文整理汇总了Java中com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo类的典型用法代码示例。如果您正苦于以下问题:Java VirtualEthernetCardNetworkBackingInfo类的具体用法?Java VirtualEthernetCardNetworkBackingInfo怎么用?Java VirtualEthernetCardNetworkBackingInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VirtualEthernetCardNetworkBackingInfo类属于com.vmware.vim25包,在下文中一共展示了VirtualEthernetCardNetworkBackingInfo类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: replaceNetworkAdapter
import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo; //导入依赖的package包/类
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);
}
开发者ID:servicecatalog,项目名称:oscm,代码行数:24,代码来源:NetworkManager.java
示例2: testStandardNetworkBackingInfo
import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo; //导入依赖的package包/类
@Test
public void testStandardNetworkBackingInfo() {
this.subnet = new SubnetState();
this.subnet.name = UUID.randomUUID().toString();
this.subnet.customProperties = new HashMap<>();
this.subnet.customProperties.put(CustomProperties.TYPE, VimNames.TYPE_NETWORK);
VirtualDeviceBackingInfo deviceBackingInfo = NetworkDeviceBackingFactory
.getNetworkDeviceBackingInfo(this.subnet);
assertTrue(deviceBackingInfo instanceof VirtualEthernetCardNetworkBackingInfo);
VirtualEthernetCardNetworkBackingInfo virtualEthernetCardNetworkBackingInfo =
(VirtualEthernetCardNetworkBackingInfo) deviceBackingInfo;
assertEquals(this.subnet.name, virtualEthernetCardNetworkBackingInfo.getDeviceName());
}
开发者ID:vmware,项目名称:photon-model,代码行数:18,代码来源:NetworkDeviceBackingFactoryTest.java
示例3: testNetworkStateBackingInfo
import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo; //导入依赖的package包/类
@Test
public void testNetworkStateBackingInfo() {
this.network = new NetworkState();
this.network.name = UUID.randomUUID().toString();
this.network.customProperties = new HashMap<>();
VirtualDeviceBackingInfo deviceBackingInfo = NetworkDeviceBackingFactory
.getNetworkDeviceBackingInfo(this.network);
assertTrue(deviceBackingInfo instanceof VirtualEthernetCardNetworkBackingInfo);
VirtualEthernetCardNetworkBackingInfo virtualEthernetCardNetworkBackingInfo =
(VirtualEthernetCardNetworkBackingInfo) deviceBackingInfo;
assertEquals(this.network.name, virtualEthernetCardNetworkBackingInfo.getDeviceName());
}
开发者ID:vmware,项目名称:photon-model,代码行数:17,代码来源:NetworkDeviceBackingFactoryTest.java
示例4: editEthernetCards
import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo; //导入依赖的package包/类
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;
}
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:24,代码来源:VmwareNetworkProcess.java
示例5: checkSameNormalNetwork
import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo; //导入依赖的package包/类
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());
}
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:18,代码来源:VmwareNetworkProcess.java
示例6: createNicSpec
import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo; //导入依赖的package包/类
static VirtualDeviceConfigSpec createNicSpec(String netName,
String nicName) throws Exception
{
VirtualDeviceConfigSpec nicSpec =
new VirtualDeviceConfigSpec();
nicSpec.setOperation(VirtualDeviceConfigSpecOperation.add);
VirtualEthernetCard nic = new VirtualPCNet32();
VirtualEthernetCardNetworkBackingInfo nicBacking =
new VirtualEthernetCardNetworkBackingInfo();
nicBacking.setDeviceName(netName);
Description info = new Description();
info.setLabel(nicName);
info.setSummary(netName);
nic.setDeviceInfo(info);
// type: "generated", "manual", "assigned" by VC
nic.setAddressType("generated");
nic.setBacking(nicBacking);
nic.setKey(0);
nicSpec.setDevice(nic);
return nicSpec;
}
开发者ID:Juniper,项目名称:vijava,代码行数:26,代码来源:CreateVM.java
示例7: prepareNicDevice
import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo; //导入依赖的package包/类
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;
}
开发者ID:apache,项目名称:cloudstack,代码行数:17,代码来源:VmwareHelper.java
示例8: getStandardNetworkBackingInfo
import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo; //导入依赖的package包/类
/**
* Backing info for existing network
*/
private static VirtualEthernetCardNetworkBackingInfo getStandardNetworkBackingInfo(
String name) {
VirtualEthernetCardNetworkBackingInfo backing = new VirtualEthernetCardNetworkBackingInfo();
backing.setDeviceName(name);
return backing;
}
开发者ID:vmware,项目名称:photon-model,代码行数:10,代码来源:NetworkDeviceBackingFactory.java
示例9: getEth
import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo; //导入依赖的package包/类
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;
}
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:12,代码来源:VmUtils.java
示例10: getNICDeviceConfigSpec
import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo; //导入依赖的package包/类
static VirtualDeviceConfigSpec getNICDeviceConfigSpec(
VirtualMachine vm, String op, String name)
throws Exception
{
VirtualDeviceConfigSpec nicSpec =
new VirtualDeviceConfigSpec();
VirtualMachineConfigInfo vmConfigInfo = vm.getConfig();
if("add".equalsIgnoreCase(op)
&& doesNetworkNameExist(vm, name))
{
nicSpec.setOperation(VirtualDeviceConfigSpecOperation.add);
VirtualEthernetCard nic = new VirtualPCNet32();
VirtualEthernetCardNetworkBackingInfo nicBacking =
new VirtualEthernetCardNetworkBackingInfo();
nicBacking.setDeviceName(name);
nic.setAddressType("generated");
nic.setBacking(nicBacking);
nic.setKey(4);
nicSpec.setDevice(nic);
return nicSpec;
}
else if("remove".equalsIgnoreCase(op))
{
VirtualDevice [] vds =
vmConfigInfo.getHardware().getDevice();
nicSpec.setOperation(
VirtualDeviceConfigSpecOperation.remove);
for(int i=0;i<vds.length;i++)
{
if((vds[i] instanceof VirtualEthernetCard) &&
(vds[i].getDeviceInfo().getLabel().equalsIgnoreCase(
name)))
{
nicSpec.setDevice(vds[i]);
return nicSpec;
}
}
}
return null;
}
开发者ID:Juniper,项目名称:vijava,代码行数:42,代码来源:VmNicOp.java
示例11: updateNicDevice
import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo; //导入依赖的package包/类
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);
}
开发者ID:apache,项目名称:cloudstack,代码行数:7,代码来源:VmwareHelper.java
示例12: plugPublicNic
import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo; //导入依赖的package包/类
private void plugPublicNic(VirtualMachineMO vmMo, final String vlanId, final IpAddressTO ipAddressTO) throws Exception {
// TODO : probably need to set traffic shaping
Pair<ManagedObjectReference, String> networkInfo = null;
VirtualSwitchType vSwitchType = VirtualSwitchType.StandardVirtualSwitch;
if (_publicTrafficInfo != null) {
vSwitchType = _publicTrafficInfo.getVirtualSwitchType();
}
/** FIXME We have no clue which network this nic is on and that means that we can't figure out the BroadcastDomainType
* so we assume that it's VLAN for now
*/
if (VirtualSwitchType.StandardVirtualSwitch == vSwitchType) {
networkInfo = HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(),
"cloud.public", vmMo.getRunningHost(), vlanId, ipAddressTO.getNetworkRate(), null,
_opsTimeout, true, BroadcastDomainType.Vlan, null, null);
} else {
networkInfo =
HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(), "cloud.public", vmMo.getRunningHost(), vlanId, null, ipAddressTO.getNetworkRate(), null,
_opsTimeout, vSwitchType, _portsPerDvPortGroup, null, false, BroadcastDomainType.Vlan, _vsmCredentials, null);
}
int nicIndex = allocPublicNicIndex(vmMo);
try {
VirtualDevice[] nicDevices = vmMo.getNicDevices();
VirtualEthernetCard device = (VirtualEthernetCard)nicDevices[nicIndex];
if (VirtualSwitchType.StandardVirtualSwitch == vSwitchType) {
VirtualEthernetCardNetworkBackingInfo nicBacking = new VirtualEthernetCardNetworkBackingInfo();
nicBacking.setDeviceName(networkInfo.second());
nicBacking.setNetwork(networkInfo.first());
device.setBacking(nicBacking);
} else {
HostMO hostMo = vmMo.getRunningHost();
DatacenterMO dataCenterMo = new DatacenterMO(hostMo.getContext(), hostMo.getHyperHostDatacenter());
device.setBacking(dataCenterMo.getDvPortBackingInfo(networkInfo));
}
VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
//VirtualDeviceConfigSpec[] deviceConfigSpecArray = new VirtualDeviceConfigSpec[1];
VirtualDeviceConfigSpec deviceConfigSpec = new VirtualDeviceConfigSpec();
deviceConfigSpec.setDevice(device);
deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.EDIT);
vmConfigSpec.getDeviceChange().add(deviceConfigSpec);
if (!vmMo.configureVm(vmConfigSpec)) {
throw new Exception("Failed to configure devices when plugPublicNic");
}
} catch (Exception e) {
// restore allocation mask in case of exceptions
String nicMasksStr = vmMo.getCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK);
int nicMasks = Integer.parseInt(nicMasksStr);
nicMasks &= ~(1 << nicIndex);
vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK, String.valueOf(nicMasks));
throw e;
}
}
开发者ID:apache,项目名称:cloudstack,代码行数:61,代码来源:VmwareResource.java
注:本文中的com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论