Search in sources :

Example 1 with RuntimeFault

use of com.vmware.vim25.RuntimeFault in project coprhd-controller by CoprHD.

the class ComputeSystemControllerImpl method getWwnDatastoreMap.

/**
 * Gets a map of volume wwn to datastore for all datastores that the host has access to
 *
 * @param host the host
 * @return map of volume wwn to datastore
 * @throws InvalidProperty
 * @throws RuntimeFault
 * @throws RemoteException
 */
public Map<String, Datastore> getWwnDatastoreMap(HostSystem host) throws InvalidProperty, RuntimeFault, RemoteException {
    Map<String, Datastore> result = Maps.newHashMap();
    HostStorageAPI hostApi = new HostStorageAPI(host);
    for (Datastore datastore : host.getDatastores()) {
        if (datastore.getInfo() instanceof VmfsDatastoreInfo) {
            Collection<HostScsiDisk> disks = hostApi.getDisksByPartition(datastore).values();
            for (HostScsiDisk disk : disks) {
                result.put(VMwareUtils.getDiskWwn(disk), datastore);
            }
        }
    }
    return result;
}
Also used : VmfsDatastoreInfo(com.vmware.vim25.VmfsDatastoreInfo) Datastore(com.vmware.vim25.mo.Datastore) HostScsiDisk(com.vmware.vim25.HostScsiDisk) HostStorageAPI(com.iwave.ext.vmware.HostStorageAPI)

Example 2 with RuntimeFault

use of com.vmware.vim25.RuntimeFault in project coprhd-controller by CoprHD.

the class HostStorageAPI method setMultipathPolicy.

/**
 * Sets the multipath policy on the given lun
 *
 * @param lun the lun to set the policy on
 * @param multipathPolicy name of the multipath policy
 */
public void setMultipathPolicy(HostScsiDisk lun, String multipathPolicy) {
    try {
        HostStorageSystem storageSystem = getStorageSystem();
        HostMultipathInfoLogicalUnitPolicy policy = createMultipathPolicy(multipathPolicy);
        storageSystem.setMultipathLunPolicy(lun.getUuid(), policy);
    } catch (HostConfigFault e) {
        throw new VMWareException(e);
    } catch (NotFound e) {
        throw new VMWareException(e);
    } catch (RuntimeFault e) {
        throw new VMWareException(e);
    } catch (RemoteException e) {
        throw new VMWareException(e);
    }
}
Also used : HostStorageSystem(com.vmware.vim25.mo.HostStorageSystem) HostMultipathInfoLogicalUnitPolicy(com.vmware.vim25.HostMultipathInfoLogicalUnitPolicy) RuntimeFault(com.vmware.vim25.RuntimeFault) RemoteException(java.rmi.RemoteException) HostConfigFault(com.vmware.vim25.HostConfigFault) NotFound(com.vmware.vim25.NotFound)

Example 3 with RuntimeFault

use of com.vmware.vim25.RuntimeFault in project coprhd-controller by CoprHD.

the class HostStorageAPI method rescanHBAs.

/**
 * Rescans the HBAs on the host.
 */
public void rescanHBAs() {
    try {
        HostStorageSystem storageSystem = getStorageSystem();
        storageSystem.rescanAllHba();
    } catch (HostConfigFault e) {
        throw new VMWareException(e);
    } catch (RuntimeFault e) {
        throw new VMWareException(e);
    } catch (RemoteException e) {
        throw new VMWareException(e);
    }
}
Also used : HostStorageSystem(com.vmware.vim25.mo.HostStorageSystem) RuntimeFault(com.vmware.vim25.RuntimeFault) RemoteException(java.rmi.RemoteException) HostConfigFault(com.vmware.vim25.HostConfigFault)

Example 4 with RuntimeFault

use of com.vmware.vim25.RuntimeFault in project coprhd-controller by CoprHD.

the class HostStorageAPI method mountDatastore.

/**
 * Attaches the datastore.
 */
public void mountDatastore(Datastore datastore) {
    try {
        HostStorageSystem storageSystem = getStorageSystem();
        String vmfsUuid = getVmfsVolumeUuid(datastore);
        storageSystem.mountVmfsVolume(vmfsUuid);
    } catch (HostConfigFault e) {
        throw new VMWareException(e);
    } catch (RuntimeFault e) {
        throw new VMWareException(e);
    } catch (RemoteException e) {
        throw new VMWareException(e);
    }
}
Also used : HostStorageSystem(com.vmware.vim25.mo.HostStorageSystem) RuntimeFault(com.vmware.vim25.RuntimeFault) RemoteException(java.rmi.RemoteException) HostConfigFault(com.vmware.vim25.HostConfigFault)

Example 5 with RuntimeFault

use of com.vmware.vim25.RuntimeFault in project cloudstack by apache.

the class VmwareResource method fillHostInfo.

protected void fillHostInfo(StartupRoutingCommand cmd) {
    VmwareContext serviceContext = getServiceContext();
    Map<String, String> details = cmd.getHostDetails();
    if (details == null) {
        details = new HashMap<String, String>();
    }
    try {
        fillHostHardwareInfo(serviceContext, cmd);
        fillHostNetworkInfo(serviceContext, cmd);
        fillHostDetailsInfo(serviceContext, details);
    } catch (RuntimeFaultFaultMsg e) {
        s_logger.error("RuntimeFault while retrieving host info: " + e.toString(), e);
        throw new CloudRuntimeException("RuntimeFault while retrieving host info");
    } catch (RemoteException e) {
        s_logger.error("RemoteException while retrieving host info: " + e.toString(), e);
        invalidateServiceContext();
        throw new CloudRuntimeException("RemoteException while retrieving host info");
    } catch (Exception e) {
        s_logger.error("Exception while retrieving host info: " + e.toString(), e);
        invalidateServiceContext();
        throw new CloudRuntimeException("Exception while retrieving host info: " + e.toString());
    }
    cmd.setHostDetails(details);
    cmd.setName(_url);
    cmd.setGuid(_guid);
    cmd.setDataCenter(_dcId);
    cmd.setIqn(getIqn());
    cmd.setPod(_pod);
    cmd.setCluster(_cluster);
    cmd.setVersion(VmwareResource.class.getPackage().getImplementationVersion());
}
Also used : VmwareContext(com.cloud.hypervisor.vmware.util.VmwareContext) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) RuntimeFaultFaultMsg(com.vmware.vim25.RuntimeFaultFaultMsg) RemoteException(java.rmi.RemoteException) ConnectException(java.net.ConnectException) IOException(java.io.IOException) RemoteException(java.rmi.RemoteException) InternalErrorException(com.cloud.exception.InternalErrorException) CloudException(com.cloud.exception.CloudException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ConfigurationException(javax.naming.ConfigurationException)

Aggregations

RemoteException (java.rmi.RemoteException)10 RuntimeFault (com.vmware.vim25.RuntimeFault)9 HostConfigFault (com.vmware.vim25.HostConfigFault)6 HostStorageSystem (com.vmware.vim25.mo.HostStorageSystem)6 InventoryNavigator (com.vmware.vim25.mo.InventoryNavigator)3 InvalidProperty (com.vmware.vim25.InvalidProperty)2 Datastore (com.vmware.vim25.mo.Datastore)2 ManagedEntity (com.vmware.vim25.mo.ManagedEntity)2 CloudException (com.cloud.exception.CloudException)1 InternalErrorException (com.cloud.exception.InternalErrorException)1 VmwareContext (com.cloud.hypervisor.vmware.util.VmwareContext)1 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 HostStorageAPI (com.iwave.ext.vmware.HostStorageAPI)1 VCenterAPI (com.iwave.ext.vmware.VCenterAPI)1 DatastoreInfo (com.vmware.vim25.DatastoreInfo)1 HostMultipathInfoLogicalUnitPolicy (com.vmware.vim25.HostMultipathInfoLogicalUnitPolicy)1 HostScsiDisk (com.vmware.vim25.HostScsiDisk)1 NotFound (com.vmware.vim25.NotFound)1 RuntimeFaultFaultMsg (com.vmware.vim25.RuntimeFaultFaultMsg)1 VmfsDatastoreInfo (com.vmware.vim25.VmfsDatastoreInfo)1