/** * Create an instance of {@link DynamicProperty } * */ public DynamicProperty createDynamicProperty() { return new DynamicProperty(); }
private void resultsToTgtMorefMap(RetrieveResult results, Map<String, ManagedObjectReference> tgtMoref) { List<ObjectContent> oCont = (results != null) ? results.getObjects() : null; if (oCont != null) { for (ObjectContent oc : oCont) { ManagedObjectReference mr = oc.getObj(); String entityNm = null; List<DynamicProperty> dps = oc.getPropSet(); if (dps != null) { for (DynamicProperty dp : dps) { entityNm = (String) dp.getVal(); } } tgtMoref.put(entityNm, mr); } } }
DynamicProperty dprop = new DynamicProperty(); dprop.setName("guestinfo.userdata"); dprop.setVal(userData); vm2.getGuest().setDynamicProperty(new DynamicProperty[]{dprop});
private static String populate(final RetrieveResult results, final Map<String, ManagedObjectReference> tgtMoref) { String token = null; if (results != null) { token = results.getToken(); for (ObjectContent oc : results.getObjects()) { ManagedObjectReference mr = oc.getObj(); String entityNm = null; List<DynamicProperty> dps = oc.getPropSet(); if (dps != null) { for (DynamicProperty dp : dps) { entityNm = (String) dp.getVal(); } } tgtMoref.put(entityNm, mr); } } return token; } }
public static String populate(final RetrieveResult rslts, final Map<String, ManagedObjectReference> tgtMoref) { String token = null; if (rslts != null) { token = rslts.getToken(); for (ObjectContent oc : rslts.getObjects()) { ManagedObjectReference mr = oc.getObj(); String entityNm = null; List<DynamicProperty> dps = oc.getPropSet(); if (dps != null) { for (DynamicProperty dp : dps) { entityNm = (String) dp.getVal(); } } tgtMoref.put(entityNm, mr); } } return token; }
/** * @param propertyName The property name of current managed object * @return it will return either an array of related data objects, or an data object itself. * ManagedObjectReference objects are data objects!!! * @throws RemoteException * @throws RuntimeFault * @throws InvalidProperty * @ */ protected Object getCurrentProperty(String propertyName) { ObjectContent objContent = retrieveObjectProperties(new String[] { propertyName }); Object propertyValue = null; if (objContent != null) { DynamicProperty[] dynaProps = objContent.getPropSet(); if ((dynaProps != null) && (dynaProps[0]!= null)) { propertyValue = PropertyCollectorUtil.convertProperty(dynaProps[0].getVal()); } } return propertyValue; }
String nameInPropSet = (String) propSet[0].getVal(); if(name.equalsIgnoreCase(nameInPropSet))
public ManagedObjectReference getMorHost(String hostname, ConnectionResources connectionResources, ManagedObjectReference vmMor) throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg { ManagedObjectReference host = null; if (StringUtils.isNotBlank(hostname)) { ManagedObjectReference reference = connectionResources.getMorRootFolder(); host = new MorObjectHandler().getSpecificMor(connectionResources, reference, VmParameter.HOST_SYSTEM.getValue(), hostname); if (host == null) { throw new RuntimeException(ErrorMessages.HOST_NOT_FOUND); } } else if (StringUtils.isBlank(hostname) && vmMor != null) { ObjectContent[] objectContents = GetObjectProperties.getObjectProperties(connectionResources, vmMor, new String[]{VmParameter.SUMMARY.getValue()}); for (ObjectContent objectItem : objectContents) { List<DynamicProperty> vmProperties = objectItem.getPropSet(); for (DynamicProperty propertyItem : vmProperties) { VirtualMachineSummary virtualMachineSummary = (VirtualMachineSummary) propertyItem.getVal(); host = virtualMachineSummary.getRuntime().getHost(); break; } break; } } else { host = connectionResources.getHostMor(); } return host; }
List<DynamicProperty> vmProperties = objectItem.getPropSet(); for (DynamicProperty propertyItem : vmProperties) { VirtualMachineSummary virtualMachineSummary = (VirtualMachineSummary) propertyItem.getVal(); String vmPathName = virtualMachineSummary.getConfig().getVmPathName(); dataStoreName = vmPathName.substring(1, vmPathName.indexOf(Constants.RIGHT_SQUARE_BRACKET));
List<DynamicProperty> vmProperties = objectItem.getPropSet(); for (DynamicProperty propertyItem : vmProperties) { VirtualMachineSummary virtualMachineSummary = (VirtualMachineSummary) propertyItem.getVal(); VirtualMachineConfigSummary virtualMachineConfigSummary = virtualMachineSummary.getConfig();
if (dps != null) { for (DynamicProperty dp : dps) { vmnm = (String) dp.getVal(); if (vmName.equals(vmnm)) { return mr;