use of com.vmware.apputils.vim25.ServiceUtil in project CloudStack-archive by CloudStack-extras.
the class HostMO method getHyperHostOwnerResourcePool.
@Override
public ManagedObjectReference getHyperHostOwnerResourcePool() throws Exception {
ServiceUtil serviceUtil = _context.getServiceUtil();
ManagedObjectReference morComputerResource = (ManagedObjectReference) serviceUtil.getDynamicProperty(_mor, "parent");
return (ManagedObjectReference) serviceUtil.getDynamicProperty(morComputerResource, "resourcePool");
}
use of com.vmware.apputils.vim25.ServiceUtil in project CloudStack-archive by CloudStack-extras.
the class HostMO method getHostLocalDatastore.
public ManagedObjectReference[] getHostLocalDatastore() throws Exception {
ServiceUtil serviceUtil = _context.getServiceUtil();
ManagedObjectReference[] datastores = (ManagedObjectReference[]) serviceUtil.getDynamicProperty(_mor, "datastore");
List<ManagedObjectReference> l = new ArrayList<ManagedObjectReference>();
if (datastores != null) {
for (ManagedObjectReference mor : datastores) {
DatastoreSummary summary = (DatastoreSummary) serviceUtil.getDynamicProperty(mor, "summary");
if (summary.getType().equalsIgnoreCase("VMFS") && !summary.getMultipleHostAccess())
l.add(mor);
}
}
return l.toArray(new ManagedObjectReference[1]);
}
use of com.vmware.apputils.vim25.ServiceUtil in project CloudStack-archive by CloudStack-extras.
the class HostMO method getHyperHostCluster.
@Override
public ManagedObjectReference getHyperHostCluster() throws Exception {
ServiceUtil serviceUtil = _context.getServiceUtil();
ManagedObjectReference morParent = (ManagedObjectReference) serviceUtil.getDynamicProperty(_mor, "parent");
if (morParent.getType().equalsIgnoreCase("ClusterComputeResource")) {
return morParent;
}
assert (false);
throw new Exception("Standalone host is not supported");
}
use of com.vmware.apputils.vim25.ServiceUtil in project CloudStack-archive by CloudStack-extras.
the class DatacenterMO method registerTemplate.
public void registerTemplate(ManagedObjectReference morHost, String datastoreName, String templateName, String templateFileName) throws Exception {
ServiceUtil serviceUtil = _context.getServiceUtil();
ManagedObjectReference morFolder = (ManagedObjectReference) serviceUtil.getDynamicProperty(_mor, "vmFolder");
assert (morFolder != null);
ManagedObjectReference morTask = _context.getService().registerVM_Task(morFolder, String.format("[%s] %s/%s", datastoreName, templateName, templateFileName), templateName, true, null, morHost);
String result = serviceUtil.waitForTask(morTask);
if (!result.equalsIgnoreCase("Sucess")) {
throw new Exception("Unable to register template due to " + TaskMO.getTaskFailureInfo(_context, morTask));
} else {
_context.waitForTaskProgressDone(morTask);
}
}
Aggregations