本文整理汇总了Java中com.vmware.vim25.VirtualMachineConfigInfo类的典型用法代码示例。如果您正苦于以下问题:Java VirtualMachineConfigInfo类的具体用法?Java VirtualMachineConfigInfo怎么用?Java VirtualMachineConfigInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VirtualMachineConfigInfo类属于com.vmware.vim25包,在下文中一共展示了VirtualMachineConfigInfo类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createCustomizationAdapterMappings
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的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: reconfigureDisks
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的package包/类
/**
* Reconfigures VMware system disks and data disks.
*/
public void reconfigureDisks(VirtualMachineConfigSpec vmConfigSpec,
ManagedObjectReference vmwInstance) throws Exception {
logger.debug("");
long systemDiskMB = (long) paramHandler.getConfigDiskSpaceMB();
VirtualMachineConfigInfo configSpec = (VirtualMachineConfigInfo) vmw
.getServiceUtil().getDynamicProperty(vmwInstance, "config");
List<VirtualDevice> devices = configSpec.getHardware().getDevice();
VirtualDisk vdSystemDisk = getVMSystemDisk(devices,
configSpec.getName());
configureSystemDisk(vmConfigSpec, systemDiskMB, vdSystemDisk);
configureDataDisks(vmConfigSpec, devices, vdSystemDisk);
}
开发者ID:servicecatalog,项目名称:oscm,代码行数:19,代码来源:DiskManager.java
示例3: VM
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的package包/类
public VM(VMwareClient vmw, String instanceName) throws Exception {
this.vmw = vmw;
this.instanceName = instanceName;
vmInstance = vmw.getServiceUtil().getDecendentMoRef(null,
"VirtualMachine", instanceName);
configSpec = (VirtualMachineConfigInfo) vmw.getServiceUtil()
.getDynamicProperty(vmInstance, "config");
folder = (ManagedObjectReference) vmw.getServiceUtil()
.getDynamicProperty(vmInstance, "parent");
guestInfo = (GuestInfo) vmw.getServiceUtil()
.getDynamicProperty(vmInstance, "guest");
if (vmInstance == null || configSpec == null || folder == null
|| guestInfo == null) {
LOG.warn("failed to retrieve VM");
throw new Exception(
"Failed to retrieve information of VM " + instanceName);
}
}
开发者ID:servicecatalog,项目名称:oscm,代码行数:21,代码来源:VM.java
示例4: createRemoveDiskConfigSpec
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的package包/类
static VirtualDeviceConfigSpec createRemoveDiskConfigSpec(
VirtualMachineConfigInfo vmConfig, String diskName)
throws Exception
{
VirtualDeviceConfigSpec diskSpec =
new VirtualDeviceConfigSpec();
VirtualDisk disk = (VirtualDisk) findVirtualDevice(
vmConfig, diskName);
if(disk != null)
{
diskSpec.setOperation(
VirtualDeviceConfigSpecOperation.remove);
// remove the following line can keep the disk file
diskSpec.setFileOperation(
VirtualDeviceConfigSpecFileOperation.destroy);
diskSpec.setDevice(disk);
return diskSpec;
}
else
{
throw new Exception("No device found: " + diskName);
}
}
开发者ID:Juniper,项目名称:vijava,代码行数:25,代码来源:RemoveVmDisk.java
示例5: getVncPort
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的package包/类
public Pair<String, Integer> getVncPort(String hostNetworkName) throws Exception {
HostMO hostMo = getRunningHost();
VmwareHypervisorHostNetworkSummary summary = hostMo.getHyperHostNetworkSummary(hostNetworkName);
VirtualMachineConfigInfo configInfo = getConfigInfo();
List<OptionValue> values = configInfo.getExtraConfig();
if (values != null) {
for (OptionValue option : values) {
if (option.getKey().equals("RemoteDisplay.vnc.port")) {
String value = (String)option.getValue();
if (value != null) {
return new Pair<String, Integer>(summary.getHostIp(), Integer.parseInt(value));
}
}
}
}
return new Pair<String, Integer>(summary.getHostIp(), 0);
}
开发者ID:apache,项目名称:cloudstack,代码行数:20,代码来源:VirtualMachineMO.java
示例6: getNumberOfNICs
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的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
示例7: configureNetworkAdapter
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的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
示例8: getNetworkAdapter
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的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
示例9: getVirtualMachineMacAddress
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的package包/类
protected static String getVirtualMachineMacAddress(
VirtualMachineConfigInfo vmConfigInfo,
DistributedVirtualPortgroup portGroup) {
VirtualDevice devices[] = vmConfigInfo.getHardware().getDevice();
for (VirtualDevice device : devices) {
// Assuming only one interface
if (device instanceof VirtualEthernetCard) {
VirtualDeviceBackingInfo backingInfo =
device.getBacking();
if (backingInfo == null)
continue;
// Is it backed by the distributed virtual port group?
if (backingInfo instanceof
VirtualEthernetCardDistributedVirtualPortBackingInfo) {
VirtualEthernetCardDistributedVirtualPortBackingInfo
dvpBackingInfo =
(VirtualEthernetCardDistributedVirtualPortBackingInfo)
backingInfo;
if ((dvpBackingInfo.getPort() == null) ||
(dvpBackingInfo.getPort().getPortgroupKey() == null))
continue;
if (dvpBackingInfo.getPort().getPortgroupKey().
equals(portGroup.getKey())) {
String vmMac = ((VirtualEthernetCard) device).
getMacAddress();
return vmMac;
}
}
}
}
s_logger.error("dvPg: " + portGroup.getName() + " vmConfig: " +
vmConfigInfo + " MAC Address NOT found");
return null;
}
开发者ID:Juniper,项目名称:contrail-vcenter-plugin,代码行数:38,代码来源:VCenterDB.java
示例10: findVirtualDevice
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的package包/类
private static VirtualDevice findVirtualDevice(
VirtualMachineConfigInfo vmConfig, String name)
{
VirtualDevice [] devices = vmConfig.getHardware().getDevice();
for(int i=0;i<devices.length;i++)
{
if(devices[i].getDeviceInfo().getLabel().equals(name))
{
return devices[i];
}
}
return null;
}
开发者ID:Juniper,项目名称:vijava,代码行数:14,代码来源:VmDiskOp.java
示例11: findVirtualDevice
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的package包/类
private static VirtualDevice findVirtualDevice(
VirtualMachineConfigInfo cfg, String name)
{
VirtualDevice [] devices = cfg.getHardware().getDevice();
for(int i=0;devices!=null && i<devices.length; i++)
{
if(devices[i].getDeviceInfo().getLabel().equals(name))
{
return devices[i];
}
}
return null;
}
开发者ID:Juniper,项目名称:vijava,代码行数:14,代码来源:RemoveVmDisk.java
示例12: getNICDeviceConfigSpec
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的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
示例13: isTemplate
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的package包/类
public boolean isTemplate() throws Exception {
VirtualMachineConfigInfo configInfo = getConfigInfo();
return configInfo.isTemplate();
}
开发者ID:apache,项目名称:cloudstack,代码行数:5,代码来源:VirtualMachineMO.java
示例14: getConfigInfo
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的package包/类
public VirtualMachineConfigInfo getConfigInfo() throws Exception {
return (VirtualMachineConfigInfo)_context.getVimClient().getDynamicProperty(_mor, "config");
}
开发者ID:apache,项目名称:cloudstack,代码行数:4,代码来源:VirtualMachineMO.java
示例15: updateSiocInfoForWorkerVM
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的package包/类
private ResultWrapper updateSiocInfoForWorkerVM(VMwareUtil.VMwareConnection connection, ManagedObjectReference morVm, String datastoreName,
int limitIopsPerGB) throws Exception {
int limitIopsTotal = 0;
List<ManagedObjectReference> tasks = new ArrayList<>();
VirtualMachineConfigInfo vmci = (VirtualMachineConfigInfo)VMwareUtil.getEntityProps(connection, morVm,
new String[] { "config" }).get("config");
List<VirtualDevice> devices = vmci.getHardware().getDevice();
for (VirtualDevice device : devices) {
if (device instanceof VirtualDisk) {
VirtualDisk disk = (VirtualDisk)device;
if (disk.getBacking() instanceof VirtualDeviceFileBackingInfo) {
VirtualDeviceFileBackingInfo backingInfo = (VirtualDeviceFileBackingInfo)disk.getBacking();
if (backingInfo.getFileName().contains(datastoreName)) {
boolean diskUpdated = false;
StorageIOAllocationInfo sioai = disk.getStorageIOAllocation();
long currentLimitIops = sioai.getLimit() != null ? sioai.getLimit() : Long.MIN_VALUE;
long newLimitIops = getNewLimitIopsBasedOnVolumeSize(disk.getCapacityInBytes(), limitIopsPerGB);
limitIopsTotal += newLimitIops;
if (currentLimitIops != newLimitIops) {
sioai.setLimit(newLimitIops);
diskUpdated = true;
}
if (diskUpdated) {
VirtualDeviceConfigSpec vdcs = new VirtualDeviceConfigSpec();
vdcs.setDevice(disk);
vdcs.setOperation(VirtualDeviceConfigSpecOperation.EDIT);
VirtualMachineConfigSpec vmcs = new VirtualMachineConfigSpec();
vmcs.getDeviceChange().add(vdcs);
try {
ManagedObjectReference task = VMwareUtil.reconfigureVm(connection, morVm, vmcs);
tasks.add(task);
LOGGER.info(getInfoMsgForWorkerVm(newLimitIops));
} catch (Exception ex) {
throw new Exception("Error: " + ex.getMessage());
}
}
}
}
}
}
return new ResultWrapper(limitIopsTotal, tasks);
}
开发者ID:apache,项目名称:cloudstack,代码行数:60,代码来源:SiocManagerImpl.java
示例16: createAddDiskConfigSpec
import com.vmware.vim25.VirtualMachineConfigInfo; //导入依赖的package包/类
static VirtualDeviceConfigSpec createAddDiskConfigSpec(
VirtualMachine vm, int diskSize, String diskMode, String diskName) throws Exception
{
VirtualDeviceConfigSpec diskSpec = new VirtualDeviceConfigSpec();
VirtualMachineConfigInfo vmConfig = (VirtualMachineConfigInfo)vm.getConfig();
VirtualDevice[] vds = vmConfig.getHardware().getDevice();
VirtualDisk disk = new VirtualDisk();
VirtualDiskFlatVer2BackingInfo diskfileBacking = new VirtualDiskFlatVer2BackingInfo();
int key = 0;
int unitNumber = 0;
for(int k=0;k<vds.length;k++)
{
if(vds[k].getDeviceInfo().getLabel().equalsIgnoreCase("SCSI Controller 0"))
{
key = vds[k].getKey();
}
}
unitNumber = vds.length + 1; //***********************seems NOT correct!!!
String dsName = getFreeDatastoreName(vm, diskSize);
if(dsName==null)
{
return null;
}
String fileName = "["+ dsName +"] "+ vm.getName() + "/" + diskName + ".vmdk";
diskfileBacking.setFileName(fileName);
diskfileBacking.setDiskMode(diskMode);
disk.setControllerKey(key);
disk.setUnitNumber(unitNumber);
disk.setBacking(diskfileBacking);
disk.setCapacityInKB(1024 * diskSize);
disk.setKey(-1);
diskSpec.setOperation(VirtualDeviceConfigSpecOperation.add);
diskSpec.setFileOperation(VirtualDeviceConfigSpecFileOperation.create);
diskSpec.setDevice(disk);
return diskSpec;
}
开发者ID:Juniper,项目名称:vijava,代码行数:43,代码来源:VmDiskOp.java
注:本文中的com.vmware.vim25.VirtualMachineConfigInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论