Search in sources :

Example 6 with RuntimeFault

use of com.vmware.vim25.RuntimeFault in project SimianArmy by Netflix.

the class VSphereServiceConnectionWithMockedInventoryNavigator method shouldEncapsulateRuntimeFaultException.

@Test(expectedExceptions = AmazonServiceException.class)
public void shouldEncapsulateRuntimeFaultException() throws RemoteException {
    VSphereServiceConnectionWithMockedInventoryNavigator service = new VSphereServiceConnectionWithMockedInventoryNavigator();
    InventoryNavigator inventoryNavigatorMock = service.getInventoryNavigatorMock();
    when(inventoryNavigatorMock.searchManagedEntities(VIRTUAL_MACHINE_TYPE_NAME)).thenThrow(new RuntimeFault());
    service.describeVirtualMachines();
}
Also used : RuntimeFault(com.vmware.vim25.RuntimeFault) InventoryNavigator(com.vmware.vim25.mo.InventoryNavigator) Test(org.testng.annotations.Test)

Example 7 with RuntimeFault

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

the class VCenterAPI method searchManagedEntity.

/**
 * Searches from the given parent for a single managed entity with the specified type and name.
 *
 * @param type the type name.
 * @param name the entity name.
 * @return the managed entity.
 *
 * @throws VMWareException if an error occurs.
 */
public <T extends ManagedEntity> T searchManagedEntity(ManagedEntity parent, String type, String name) throws VMWareException {
    try {
        InventoryNavigator navigator = new InventoryNavigator(parent);
        ManagedEntity entity = navigator.searchManagedEntity(type, name);
        return (T) entity;
    } catch (InvalidProperty e) {
        throw new VMWareException(e);
    } catch (RuntimeFault e) {
        throw new VMWareException(e);
    } catch (RemoteException e) {
        throw new VMWareException(e);
    }
}
Also used : ManagedEntity(com.vmware.vim25.mo.ManagedEntity) RuntimeFault(com.vmware.vim25.RuntimeFault) RemoteException(java.rmi.RemoteException) InvalidProperty(com.vmware.vim25.InvalidProperty) InventoryNavigator(com.vmware.vim25.mo.InventoryNavigator)

Example 8 with RuntimeFault

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

the class VCenterAPI method searchManagedEntities.

/**
 * Searches from the given parent for managed entities of the specified type.
 *
 * @param parent the parent entity.
 * @param type the type name.
 * @param recurse whether to recurse.
 * @return the managed entities.
 *
 * @throws VMWareException if an error occurs.
 */
public ManagedEntity[] searchManagedEntities(ManagedEntity parent, String type, boolean recurse) throws VMWareException {
    try {
        String[][] typeInfo = new String[][] { new String[] { type, "name" } };
        InventoryNavigator navigator = new InventoryNavigator(parent);
        ManagedEntity[] entities = navigator.searchManagedEntities(typeInfo, recurse);
        return entities;
    } catch (InvalidProperty e) {
        throw new VMWareException(e);
    } catch (RuntimeFault e) {
        throw new VMWareException(e);
    } catch (RemoteException e) {
        throw new VMWareException(e);
    }
}
Also used : ManagedEntity(com.vmware.vim25.mo.ManagedEntity) RuntimeFault(com.vmware.vim25.RuntimeFault) RemoteException(java.rmi.RemoteException) InvalidProperty(com.vmware.vim25.InvalidProperty) InventoryNavigator(com.vmware.vim25.mo.InventoryNavigator)

Example 9 with RuntimeFault

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

the class HostStorageAPI method refreshStorage.

/**
 * Refreshes the storage on the host.
 */
public void refreshStorage() {
    try {
        HostStorageSystem storageSystem = getStorageSystem();
        storageSystem.rescanAllHba();
        storageSystem.rescanVmfs();
    } 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 10 with RuntimeFault

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

the class HostStorageAPI method attachScsiLun.

/**
 * Attaches the lun.
 */
public void attachScsiLun(HostScsiDisk disk) {
    try {
        HostStorageSystem storageSystem = getStorageSystem();
        storageSystem.attachScsiLun(disk.getUuid());
    } 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)

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