本文整理汇总了Java中com.vmware.vim25.VirtualEthernetCard类的典型用法代码示例。如果您正苦于以下问题:Java VirtualEthernetCard类的具体用法?Java VirtualEthernetCard怎么用?Java VirtualEthernetCard使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VirtualEthernetCard类属于com.vmware.vim25包,在下文中一共展示了VirtualEthernetCard类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createCustomizationAdapterMappings
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
protected List<CustomizationAdapterMapping> createCustomizationAdapterMappings(
VmwareProcessClient vmwareProcessClient, VirtualMachine machine) {
List<CustomizationAdapterMapping> nicSettingMap = new ArrayList<CustomizationAdapterMapping>();
// VirtualEthernetCardを取得
VirtualMachineConfigInfo configInfo = machine.getConfig();
for (VirtualDevice device : configInfo.getHardware().getDevice()) {
if (device instanceof VirtualEthernetCard) {
VirtualEthernetCard virtualEthernetCard = VirtualEthernetCard.class.cast(device);
CustomizationAdapterMapping mapping = new CustomizationAdapterMapping();
CustomizationIPSettings settings = new CustomizationIPSettings();
// すべてのNICをDHCPにする
CustomizationDhcpIpGenerator dhcpIp = new CustomizationDhcpIpGenerator();
settings.setIp(dhcpIp);
mapping.setMacAddress(virtualEthernetCard.getMacAddress());
mapping.setAdapter(settings);
nicSettingMap.add(mapping);
}
}
return nicSettingMap;
}
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:26,代码来源:VmwareCustomizeProcess.java
示例2: editEthernetCards
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的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
示例3: checkSameNormalNetwork
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的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
示例4: checkSameDistributedNetwork
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
protected boolean checkSameDistributedNetwork(VirtualEthernetCard ethernetCard1, VirtualEthernetCard ethernetCard2) {
if (!(ethernetCard1.getBacking() instanceof VirtualEthernetCardDistributedVirtualPortBackingInfo)) {
return false;
}
if (!(ethernetCard2.getBacking() instanceof VirtualEthernetCardDistributedVirtualPortBackingInfo)) {
return false;
}
VirtualEthernetCardDistributedVirtualPortBackingInfo backingInfo1 = VirtualEthernetCardDistributedVirtualPortBackingInfo.class
.cast(ethernetCard1.getBacking());
VirtualEthernetCardDistributedVirtualPortBackingInfo backingInfo2 = VirtualEthernetCardDistributedVirtualPortBackingInfo.class
.cast(ethernetCard2.getBacking());
return StringUtils.equals(backingInfo1.getPort().getPortgroupKey(), backingInfo2.getPort().getPortgroupKey());
}
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:18,代码来源:VmwareNetworkProcess.java
示例5: createNicSpec
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的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
示例6: getNicSpecs
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
VirtualDeviceConfigSpec getNicSpecs(String fileName, List<VirtualDevice> virtualDevicesList,
VirtualDeviceConfigSpecOperation operation, String addressType,
Integer key, String parameter, VmInputs vmInputs) {
VirtualDeviceConfigSpec nicSpecs = new VirtualDeviceConfigSpec();
VirtualEthernetCard nic;
if (Operation.ADD.toString().equalsIgnoreCase(parameter)) {
nic = getEth(fileName, addressType, key);
return getNicOpSpec(nicSpecs, operation, nic);
} else {
nic = findVirtualDevice(VirtualEthernetCard.class, virtualDevicesList, vmInputs);
if (nic != null) {
return getNicOpSpec(nicSpecs, operation, nic);
}
}
throw new RuntimeException("No nic named: [" + vmInputs.getUpdateValue() + "] can be found.");
}
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:17,代码来源:VmUtils.java
示例7: getNicDeviceIndex
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
public Pair<Integer, VirtualDevice> getNicDeviceIndex(String networkNamePrefix) throws Exception {
List<VirtualDevice> nics = getNicDevices(true);
int index = 0;
String attachedNetworkSummary;
String dvPortGroupName;
for (VirtualDevice nic : nics) {
attachedNetworkSummary = ((VirtualEthernetCard)nic).getDeviceInfo().getSummary();
if (attachedNetworkSummary.startsWith(networkNamePrefix)) {
return new Pair<Integer, VirtualDevice>(new Integer(index), nic);
} else if (attachedNetworkSummary.endsWith("DistributedVirtualPortBackingInfo.summary") || attachedNetworkSummary.startsWith("DVSwitch")) {
dvPortGroupName = getDvPortGroupName((VirtualEthernetCard)nic);
if (dvPortGroupName != null && dvPortGroupName.startsWith(networkNamePrefix)) {
s_logger.debug("Found a dvPortGroup already associated with public NIC.");
return new Pair<Integer, VirtualDevice>(new Integer(index), nic);
}
}
index++;
}
return new Pair<Integer, VirtualDevice>(new Integer(-1), null);
}
开发者ID:apache,项目名称:cloudstack,代码行数:22,代码来源:VirtualMachineMO.java
示例8: prepareNicOpaque
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
public static VirtualDevice prepareNicOpaque(VirtualMachineMO vmMo, VirtualEthernetCardType deviceType, String portGroupName,
String macAddress, int contextNumber, boolean connected, boolean connectOnStart) throws Exception {
assert(vmMo.getRunningHost().hasOpaqueNSXNetwork());
VirtualEthernetCard nic = createVirtualEthernetCard(deviceType);
VirtualEthernetCardOpaqueNetworkBackingInfo nicBacking = new VirtualEthernetCardOpaqueNetworkBackingInfo();
nicBacking.setOpaqueNetworkId("br-int");
nicBacking.setOpaqueNetworkType("nsx.network");
nic.setBacking(nicBacking);
nic.setAddressType("Manual");
nic.setConnectable(getVirtualDeviceConnectInfo(connected, connectOnStart));
nic.setMacAddress(macAddress);
nic.setKey(-contextNumber);
return nic;
}
开发者ID:apache,项目名称:cloudstack,代码行数:20,代码来源:VmwareHelper.java
示例9: prepareNicDevice
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的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
示例10: prepareDvNicDevice
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
public static VirtualDevice prepareDvNicDevice(VirtualMachineMO vmMo, ManagedObjectReference morNetwork, VirtualEthernetCardType deviceType, String dvPortGroupName,
String dvSwitchUuid, String macAddress, int contextNumber, boolean connected, boolean connectOnStart) throws Exception {
VirtualEthernetCard nic = createVirtualEthernetCard(deviceType);
final VirtualEthernetCardDistributedVirtualPortBackingInfo dvPortBacking = new VirtualEthernetCardDistributedVirtualPortBackingInfo();
final DistributedVirtualSwitchPortConnection dvPortConnection = new DistributedVirtualSwitchPortConnection();
dvPortConnection.setSwitchUuid(dvSwitchUuid);
dvPortConnection.setPortgroupKey(morNetwork.getValue());
dvPortBacking.setPort(dvPortConnection);
nic.setBacking(dvPortBacking);
nic.setAddressType("Manual");
nic.setConnectable(getVirtualDeviceConnectInfo(connected, connectOnStart));
nic.setMacAddress(macAddress);
nic.setKey(-contextNumber);
return nic;
}
开发者ID:apache,项目名称:cloudstack,代码行数:20,代码来源:VmwareHelper.java
示例11: getNumberOfNICs
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
public static int getNumberOfNICs(VMwareClient vmw,
ManagedObjectReference vmwInstance) throws Exception {
logger.debug("");
VirtualMachineConfigInfo configInfo = (VirtualMachineConfigInfo) vmw
.getServiceUtil().getDynamicProperty(vmwInstance, "config");
List<VirtualEthernetCard> vmNics = getNetworkAdapter(configInfo);
return vmNics.size();
}
开发者ID:servicecatalog,项目名称:oscm,代码行数:10,代码来源:NetworkManager.java
示例12: configureNetworkAdapter
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
/**
* Replaces the NICs in the given VM.
*
* @param vmw
* connected VMware client entity
* @param paramHandler
* entity which holds all properties of the instance
* @param vmwInstance
* the virtual machine that gets reconfigured
*/
public static void configureNetworkAdapter(VMwareClient vmw,
VirtualMachineConfigSpec vmConfigSpec,
VMPropertyHandler paramHandler, ManagedObjectReference vmwInstance)
throws Exception {
logger.debug("");
VirtualMachineConfigInfo configInfo = (VirtualMachineConfigInfo) vmw
.getServiceUtil().getDynamicProperty(vmwInstance, "config");
List<VirtualEthernetCard> vmNics = getNetworkAdapter(configInfo);
int numberOfNICs = Integer.parseInt(paramHandler
.getServiceSetting(VMPropertyHandler.TS_NUMBER_OF_NICS));
if (numberOfNICs != vmNics.size()) {
throw new Exception(
"the number of NICs in virtual machine does not match the service parameter. VM: "
+ configInfo.getName() + " NICs: " + vmNics.size()
+ " " + VMPropertyHandler.TS_NUMBER_OF_NICS + ": "
+ numberOfNICs);
}
for (int i = 1; i <= numberOfNICs; i++) {
String newNetworkName = paramHandler.getNetworkAdapter(i);
VirtualEthernetCard vmNic = vmNics.get(i - 1);
String vmNetworkName = getNetworkName(vmw, vmwInstance, i);
if (newNetworkName != null && newNetworkName.length() > 0
&& !newNetworkName.equals(vmNetworkName)) {
ManagedObjectReference newNetworkRef = getNetworkFromHost(vmw,
vmwInstance, newNetworkName);
replaceNetworkAdapter(vmConfigSpec, vmNic, newNetworkRef,
newNetworkName);
} else {
connectNIC(vmConfigSpec, vmNic, vmNetworkName);
}
}
}
开发者ID:servicecatalog,项目名称:oscm,代码行数:48,代码来源:NetworkManager.java
示例13: getNetworkAdapter
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
public static List<VirtualEthernetCard> getNetworkAdapter(
VirtualMachineConfigInfo configInfo) {
List<VirtualEthernetCard> nics = new ArrayList<VirtualEthernetCard>();
List<VirtualDevice> devices = configInfo.getHardware().getDevice();
for (VirtualDevice vd : devices) {
if (vd instanceof VirtualEthernetCard) {
nics.add((VirtualEthernetCard) vd);
}
}
return nics;
}
开发者ID:servicecatalog,项目名称:oscm,代码行数:13,代码来源:NetworkManager.java
示例14: getNics
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
public List<VirtualEthernetCard> getNics() {
ArrayOfVirtualDevice dev = (ArrayOfVirtualDevice) getOrDefault(
VimPath.vm_config_hardware_device, null);
if (dev == null) {
return Collections.emptyList();
}
return dev.getVirtualDevice().stream()
.filter(d -> d instanceof VirtualEthernetCard)
.map(d -> (VirtualEthernetCard) d)
.collect(Collectors.toList());
}
开发者ID:vmware,项目名称:photon-model,代码行数:13,代码来源:VmOverlay.java
示例15: getPrimaryMac
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
public String getPrimaryMac() {
for (VirtualEthernetCard dev : getNics()) {
return dev.getMacAddress();
}
return null;
}
开发者ID:vmware,项目名称:photon-model,代码行数:8,代码来源:VmOverlay.java
示例16: getPrimaryIPv4Address
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
private String getPrimaryIPv4Address(VirtualEthernetCard nic, Map<String, List<String>>
nicMACToIPv4Addresses) {
if (nicMACToIPv4Addresses == null) {
return null;
}
String macAddress = nic.getMacAddress();
List<String> ipv4Addresses = nicMACToIPv4Addresses.get(macAddress);
if (ipv4Addresses != null && ipv4Addresses.size() > 0) {
return ipv4Addresses.get(0);
}
return null;
}
开发者ID:vmware,项目名称:photon-model,代码行数:15,代码来源:VSphereAdapterResourceEnumerationService.java
示例17: createNic
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
private VirtualEthernetCard createNic(NetworkInterfaceStateWithDetails nicWithDetails,
Integer controllerKey)
throws FinderException, InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
VirtualEthernetCard nic = new VirtualE1000();
nic.setAddressType(VirtualEthernetCardMacType.GENERATED.value());
nic.setKey(-1);
nic.setControllerKey(controllerKey);
// Currently the network backing information is stored in both places subnet and network
// If it were to exist at one state object, then it would reduce complexity further.
// Question: Is it acceptable for querying subnet first and network later? Or the order
// should be reversed?
QueryConfigTargetRequest queryConfigTargetRequest = new
QueryConfigTargetRequest(this.get, getVimPort(), this.ctx.computeMoRef);
VirtualDeviceBackingInfo deviceBackingInfo = NetworkDeviceBackingFactory
.getNetworkDeviceBackingInfo(nicWithDetails.subnet, queryConfigTargetRequest);
if (deviceBackingInfo == null) {
deviceBackingInfo = NetworkDeviceBackingFactory
.getNetworkDeviceBackingInfo(nicWithDetails.network, queryConfigTargetRequest);
}
nic.setBacking(deviceBackingInfo);
return nic;
}
开发者ID:vmware,项目名称:photon-model,代码行数:29,代码来源:InstanceClient.java
示例18: createEthernetCards
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
protected List<VirtualEthernetCard> createEthernetCards(VmwareProcessClient vmwareProcessClient, Long instanceNo,
VirtualMachine machine) {
Instance instance = instanceDao.read(instanceNo);
List<VmwareNetwork> vmwareNetworks = vmwareNetworkDao.readByFarmNo(instance.getFarmNo());
// ネットワーク名の取得
PlatformVmware platformVmware = platformVmwareDao.read(instance.getPlatformNo());
String publicNetworkName = platformVmware.getPublicNetwork();
String privateNetworkName = platformVmware.getPrivateNetwork();
for (VmwareNetwork vmwareNetwork : vmwareNetworks) {
if (BooleanUtils.isTrue(vmwareNetwork.getPublicNetwork())) {
publicNetworkName = vmwareNetwork.getNetworkName();
} else {
privateNetworkName = vmwareNetwork.getNetworkName();
}
}
// イーサネット設定の作成
List<VirtualEthernetCard> ethernetCards = new ArrayList<VirtualEthernetCard>();
// Public側イーサネット設定
if (StringUtils.isNotEmpty(publicNetworkName)) {
VirtualEthernetCard publicEthernetCard = editEthernetCards(machine, publicNetworkName);
ethernetCards.add(publicEthernetCard);
}
// Private側イーサネット設定
VirtualEthernetCard privateEthernetCard = editEthernetCards(machine, privateNetworkName);
ethernetCards.add(privateEthernetCard);
return ethernetCards;
}
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:33,代码来源:VmwareNetworkProcess.java
示例19: createPublicNetworkData
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
protected Map<String, String> createPublicNetworkData(Long instanceNo, VirtualEthernetCard ethernetCard) {
VmwareAddress vmwareAddress = vmwareAddressDao.readByInstanceNo(instanceNo);
if (vmwareAddress == null) {
// VmwareAddressがない場合は動的IP
return createDhcpNetworkData(ethernetCard);
}
if (BooleanUtils.isTrue(vmwareAddress.getEnabled())) {
// VmwareAddressが有効な場合は静的IP
return createStaticNetworkData(ethernetCard, vmwareAddress);
} else {
// VmwareAddressが無効な場合は動的IP
return createDhcpNetworkData(ethernetCard);
}
}
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:16,代码来源:VmwareInitProcess.java
示例20: createStaticNetworkData
import com.vmware.vim25.VirtualEthernetCard; //导入依赖的package包/类
protected Map<String, String> createStaticNetworkData(VirtualEthernetCard ethernetCard, VmwareAddress vmwareAddress) {
Map<String, String> map = new HashMap<String, String>();
String macAddress = ethernetCard.getMacAddress().toUpperCase();
map.put("BootProto", "static");
map.put("Mac", macAddress);
map.put("IP", vmwareAddress.getIpAddress());
map.put("Netmask", vmwareAddress.getSubnetMask());
map.put("Gateway", vmwareAddress.getDefaultGateway());
return map;
}
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:11,代码来源:VmwareInitProcess.java
注:本文中的com.vmware.vim25.VirtualEthernetCard类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论