use of io.cloudslang.content.vmware.services.helpers.MorObjectHandler in project cs-actions by CloudSlang.
the class ClusterComputeResourceService method getVmOverride.
public String getVmOverride(final HttpInputs httpInputs, final VmInputs vmInputs) throws Exception {
ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs);
try {
final ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName());
final ClusterConfigInfoEx clusterConfigInfoEx = getClusterConfiguration(connectionResources, clusterMor, vmInputs.getClusterName());
final String restartPriority;
if (StringUtilities.isNotBlank(vmInputs.getVirtualMachineId()) || StringUtilities.isNotBlank(vmInputs.getVirtualMachineName())) {
final ManagedObjectReference vmMor = getVirtualMachineReference(vmInputs, connectionResources);
restartPriority = getVmRestartPriority(clusterConfigInfoEx, vmMor);
} else {
restartPriority = getVmRestartPriority(clusterConfigInfoEx);
}
return restartPriority;
} finally {
if (httpInputs.isCloseSession()) {
connectionResources.getConnection().disconnect();
clearConnectionFromContext(httpInputs.getGlobalSessionObject());
}
}
}
use of io.cloudslang.content.vmware.services.helpers.MorObjectHandler in project cs-actions by CloudSlang.
the class ClusterComputeResourceService method deleteHostGroup.
public Map<String, String> deleteHostGroup(HttpInputs httpInputs, VmInputs vmInputs) throws Exception {
ConnectionResources connectionResources = new ConnectionResources(httpInputs);
try {
ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName());
ClusterHostGroup clusterHostGroup = new ClusterHostGroup();
clusterHostGroup.setName(vmInputs.getHostGroupName());
ClusterGroupSpec clusterGroupSpec = new ClusterGroupSpec();
clusterGroupSpec.setInfo(clusterHostGroup);
clusterGroupSpec.setOperation(ArrayUpdateOperation.REMOVE);
clusterGroupSpec.setRemoveKey(vmInputs.getHostGroupName());
return reconfigureClusterGroup(vmInputs, connectionResources, clusterMor, clusterGroupSpec);
} finally {
if (httpInputs.isCloseSession()) {
connectionResources.getConnection().disconnect();
clearConnectionFromContext(httpInputs.getGlobalSessionObject());
}
}
}
Aggregations