Search in sources :

Example 16 with ManagedObjectReference

use of com.vmware.vim25.ManagedObjectReference 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");
}
Also used : ServiceUtil(com.vmware.apputils.vim25.ServiceUtil) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Example 17 with ManagedObjectReference

use of com.vmware.vim25.ManagedObjectReference in project CloudStack-archive by CloudStack-extras.

the class HostMO method getHostFirewallSystemMO.

public HostFirewallSystemMO getHostFirewallSystemMO() throws Exception {
    HostConfigManager configMgr = getHostConfigManager();
    ManagedObjectReference morFirewall = configMgr.getFirewallSystem();
    // only ESX hosts have firewall manager
    if (morFirewall != null)
        return new HostFirewallSystemMO(_context, morFirewall);
    return null;
}
Also used : HostConfigManager(com.vmware.vim25.HostConfigManager) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Example 18 with ManagedObjectReference

use of com.vmware.vim25.ManagedObjectReference in project CloudStack-archive by CloudStack-extras.

the class HostMO method getLocalDatastoreOnHost.

public List<Pair<ManagedObjectReference, String>> getLocalDatastoreOnHost() throws Exception {
    List<Pair<ManagedObjectReference, String>> dsList = new ArrayList<Pair<ManagedObjectReference, String>>();
    ObjectContent[] ocs = getDatastorePropertiesOnHyperHost(new String[] { "name", "summary" });
    if (ocs != null) {
        for (ObjectContent oc : ocs) {
            DatastoreSummary dsSummary = (DatastoreSummary) VmwareHelper.getPropValue(oc, "summary");
            if (dsSummary.getMultipleHostAccess() == false && dsSummary.isAccessible() && dsSummary.getType().equalsIgnoreCase("vmfs")) {
                ManagedObjectReference morDs = oc.getObj();
                String name = (String) VmwareHelper.getPropValue(oc, "name");
                dsList.add(new Pair<ManagedObjectReference, String>(morDs, name));
            }
        }
    }
    return dsList;
}
Also used : ObjectContent(com.vmware.vim25.ObjectContent) DatastoreSummary(com.vmware.vim25.DatastoreSummary) ArrayList(java.util.ArrayList) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) Pair(com.cloud.utils.Pair)

Example 19 with ManagedObjectReference

use of com.vmware.vim25.ManagedObjectReference in project CloudStack-archive by CloudStack-extras.

the class HostMO method importVmFromOVF.

@Override
public void importVmFromOVF(String ovfFilePath, String vmName, DatastoreMO dsMo, String diskOption) throws Exception {
    ManagedObjectReference morRp = getHyperHostOwnerResourcePool();
    assert (morRp != null);
    HypervisorHostHelper.importVmFromOVF(this, ovfFilePath, vmName, dsMo, diskOption, morRp, _mor);
}
Also used : ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Example 20 with ManagedObjectReference

use of com.vmware.vim25.ManagedObjectReference 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]);
}
Also used : DatastoreSummary(com.vmware.vim25.DatastoreSummary) ArrayList(java.util.ArrayList) ServiceUtil(com.vmware.apputils.vim25.ServiceUtil) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Aggregations

ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)236 ArrayOfManagedObjectReference (com.vmware.vim25.ArrayOfManagedObjectReference)62 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)57 Pair (com.cloud.utils.Pair)49 RemoteException (java.rmi.RemoteException)48 ArrayList (java.util.ArrayList)45 UnsupportedEncodingException (java.io.UnsupportedEncodingException)39 VmwareHypervisorHost (com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost)35 VmwareContext (com.cloud.hypervisor.vmware.util.VmwareContext)32 IOException (java.io.IOException)31 CloudException (com.cloud.exception.CloudException)30 DatastoreMO (com.cloud.hypervisor.vmware.mo.DatastoreMO)30 VirtualMachineConfigSpec (com.vmware.vim25.VirtualMachineConfigSpec)29 ObjectContent (com.vmware.vim25.ObjectContent)28 VirtualDeviceConfigSpec (com.vmware.vim25.VirtualDeviceConfigSpec)27 VirtualMachineMO (com.cloud.hypervisor.vmware.mo.VirtualMachineMO)25 ConfigurationException (javax.naming.ConfigurationException)24 InternalErrorException (com.cloud.exception.InternalErrorException)23 VirtualDisk (com.vmware.vim25.VirtualDisk)23 ConnectException (java.net.ConnectException)23