use of com.vmware.vim25.OptionValue in project CloudStack-archive by CloudStack-extras.
the class HostMO method getVmVncPortsOnHost.
public HashMap<String, Integer> getVmVncPortsOnHost() throws Exception {
ObjectContent[] ocs = getVmPropertiesOnHyperHost(new String[] { "name", "config.extraConfig[\"RemoteDisplay.vnc.port\"]" });
HashMap<String, Integer> portInfo = new HashMap<String, Integer>();
if (ocs != null && ocs.length > 0) {
for (ObjectContent oc : ocs) {
DynamicProperty[] objProps = oc.getPropSet();
if (objProps != null) {
String name = null;
String value = null;
for (DynamicProperty objProp : objProps) {
if (objProp.getName().equals("name")) {
name = (String) objProp.getVal();
} else {
OptionValue optValue = (OptionValue) objProp.getVal();
value = (String) optValue.getValue();
}
}
if (name != null && value != null) {
portInfo.put(name, Integer.parseInt(value));
}
}
}
}
return portInfo;
}
use of com.vmware.vim25.OptionValue in project CloudStack-archive by CloudStack-extras.
the class VirtualMachineMO method getVncPort.
public Pair<String, Integer> getVncPort(String hostNetworkName) throws Exception {
HostMO hostMo = getRunningHost();
VmwareHypervisorHostNetworkSummary summary = hostMo.getHyperHostNetworkSummary(hostNetworkName);
VirtualMachineConfigInfo configInfo = getConfigInfo();
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);
}
use of com.vmware.vim25.OptionValue in project cloudstack by apache.
the class VmwareResource method setNuageVspVrIpInExtraConfig.
private static void setNuageVspVrIpInExtraConfig(List<OptionValue> extraOptions, NicTO nicTo, String dvSwitchUuid) {
if (nicTo.getBroadcastType() != BroadcastDomainType.Vsp) {
return;
}
OptionValue newVal;
if (nicTo.getType().equals(TrafficType.Guest) && dvSwitchUuid != null && nicTo.getGateway() != null && nicTo.getNetmask() != null) {
String vrIp = nicTo.getBroadcastUri().getPath().substring(1);
newVal = new OptionValue();
newVal.setKey("vsp.vr-ip." + nicTo.getMac());
newVal.setValue(vrIp);
extraOptions.add(newVal);
newVal = new OptionValue();
newVal.setKey("vsp.dvswitch." + nicTo.getMac());
newVal.setValue(dvSwitchUuid);
extraOptions.add(newVal);
if (s_logger.isDebugEnabled()) {
s_logger.debug("NIC with MAC " + nicTo.getMac() + " and BroadcastDomainType " + nicTo.getBroadcastType() + " in network(" + nicTo.getGateway() + "/" + nicTo.getNetmask() + ") is " + nicTo.getType() + " traffic type. So, vsp-vr-ip is set in the extraconfig");
}
}
}
use of com.vmware.vim25.OptionValue in project photon-model by vmware.
the class InstanceClient method populateSnapshotLimitValue.
private OptionValue populateSnapshotLimitValue(String snapshotLimitValue) {
OptionValue ov = new OptionValue();
ov.setKey(SNAPSHOT_LIMIT_CONFIG_STRING);
ov.setValue(snapshotLimitValue);
return ov;
}
use of com.vmware.vim25.OptionValue in project cloudstack by apache.
the class VmwareResource method configCustomExtraOption.
private static void configCustomExtraOption(List<OptionValue> extraOptions, VirtualMachineTO vmSpec) {
// we no longer to validation anymore
for (Map.Entry<String, String> entry : vmSpec.getDetails().entrySet()) {
if (entry.getKey().equalsIgnoreCase(VmDetailConstants.BOOT_MODE)) {
continue;
}
OptionValue newVal = new OptionValue();
newVal.setKey(entry.getKey());
newVal.setValue(entry.getValue());
extraOptions.add(newVal);
}
}
Aggregations