Search in sources :

Example 6 with BlockObjectRestRep

use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.

the class UnmountBlockVolumeHelper method unmountVolumes.

public void unmountVolumes() {
    Set<URI> untaggedVolumeIds = Sets.newHashSet();
    for (VolumeSpec volume : volumes) {
        aixSupport.unmount(volume.mountPoint.getPath());
        // remove mount point tag from all volumes for this mount point
        for (BlockObjectRestRep mountedVolume : volume.relatedVolumes) {
            aixSupport.removeVolumeMountPointTag(mountedVolume);
            untaggedVolumeIds.add(mountedVolume.getId());
        }
        if (usePowerPath) {
            aixSupport.removePowerPathDevices(volume.powerpathDevices);
        }
        // delete the directory entry if it's empty
        if (aixSupport.isDirectoryEmpty(volume.mountPoint.getPath())) {
            aixSupport.deleteDirectory(volume.mountPoint.getPath());
        }
        aixSupport.removeFromFilesystemsConfig(volume.mountPoint.getPath());
    }
    // Ensure all volumes have had their mount point tag removed
    for (VolumeSpec volume : volumes) {
        if (untaggedVolumeIds.add(volume.viprVolume.getId())) {
            aixSupport.removeVolumeMountPointTag(volume.viprVolume);
        }
    }
}
Also used : URI(java.net.URI) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Example 7 with BlockObjectRestRep

use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.

the class UnmountBlockVolumeHelper method unmountVolumes.

public void unmountVolumes() {
    Set<URI> untaggedVolumeIds = Sets.newHashSet();
    for (VolumeSpec volume : volumes) {
        // unmount the volume
        linux.unmountPath(volume.mountPoint.getPath());
        // remove from fstab
        linux.removeFromFSTab(volume.mountPoint);
        // remove mount point tag from all volumes for this mount point
        for (BlockObjectRestRep mountedVolume : volume.relatedVolumes) {
            linux.removeVolumeMountPointTag(mountedVolume);
            untaggedVolumeIds.add(mountedVolume.getId());
        }
        // delete the directory entry if it's empty
        if (linux.isDirectoryEmpty(volume.mountPoint.getPath())) {
            linux.deleteDirectory(volume.mountPoint.getPath());
        }
    }
    // Ensure all volumes have had their mount point tag removed
    for (VolumeSpec volume : volumes) {
        if (untaggedVolumeIds.add(volume.viprVolume.getId())) {
            linux.removeVolumeMountPointTag(volume.viprVolume);
        }
    }
}
Also used : URI(java.net.URI) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Example 8 with BlockObjectRestRep

use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.

the class UnmountBlockVolumeHelper method findRelatedVolumes.

/**
 * Finds the volumes related to the mount points selected. When a mount point is removed, all related volumes have
 * to have their mount point tags removed.
 */
private void findRelatedVolumes() {
    for (VolumeSpec volume : volumes) {
        volume.relatedVolumes = Lists.newArrayList();
        Set<String> volumeWwns = getVolumeWwns(volume);
        for (String relatedWwn : volumeWwns) {
            BlockObjectRestRep related = findVolumeRestRepByWwn(relatedWwn);
            if (related == null) {
                related = BlockStorageUtils.getVolumeByWWN(relatedWwn);
            }
            if (related != null) {
                volume.relatedVolumes.add(related);
            }
        }
    }
}
Also used : BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Example 9 with BlockObjectRestRep

use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.

the class CreateAndMountVolumeService method execute.

@Override
public void execute() throws Exception {
    BlockObjectRestRep volume = createVolume();
    acquireHostsLock();
    refreshStorage(volume);
    artificialFailure(ArtificialFailures.ARTIFICIAL_FAILURE_LINUX_MOUNT_VOLUME);
    mountVolume(volume);
}
Also used : BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Example 10 with BlockObjectRestRep

use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.

the class BlockStorageUtils method isVMAXUsePortGroupEnabled.

public static boolean isVMAXUsePortGroupEnabled(URI resourceId) {
    SimpleValueRep value = execute(new GetVMAXUsePortGroupEnabledConfig());
    if (value.getValue().equalsIgnoreCase("true")) {
        if (ResourceType.isType(ResourceType.VOLUME, resourceId)) {
            BlockObjectRestRep obj = getVolume(resourceId);
            if (obj instanceof VolumeRestRep) {
                VolumeRestRep volume = (VolumeRestRep) obj;
                boolean isVMAX = StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax3.name());
                boolean isRPOrVPlex = isVplexOrRPVolume(volume);
                if (isVMAX && !isRPOrVPlex) {
                    return true;
                }
            }
            if (obj instanceof BlockSnapshotRestRep) {
                BlockSnapshotRestRep snapshot = (BlockSnapshotRestRep) obj;
                BlockObjectRestRep parent = getVolume(snapshot.getParent().getId());
                if (parent instanceof VolumeRestRep) {
                    VolumeRestRep volume = (VolumeRestRep) obj;
                    if (StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax3.name())) {
                        return true;
                    }
                }
                if (parent instanceof BlockMirrorRestRep) {
                    BlockMirrorRestRep mirror = (BlockMirrorRestRep) obj;
                    if (StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax3.name())) {
                        return true;
                    }
                }
            }
            if (obj instanceof BlockMirrorRestRep) {
                BlockMirrorRestRep mirror = (BlockMirrorRestRep) obj;
                if (StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax3.name())) {
                    return true;
                }
            }
        }
        if (ResourceType.isType(ResourceType.VIRTUAL_POOL, resourceId)) {
            BlockVirtualPoolRestRep virtualPool = execute(new GetBlockVirtualPool(resourceId));
            boolean isVMAX = StringUtils.equalsIgnoreCase(virtualPool.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(virtualPool.getSystemType(), DiscoveredDataObject.Type.vmax3.name());
            boolean isVPLEX = virtualPool.getHighAvailability() != null;
            if (isVMAX && !isVPLEX) {
                return true;
            }
        }
    }
    return false;
}
Also used : SimpleValueRep(com.emc.storageos.model.customconfig.SimpleValueRep) BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) BlockMirrorRestRep(com.emc.storageos.model.block.BlockMirrorRestRep) GetBlockVirtualPool(com.emc.sa.service.vipr.block.tasks.GetBlockVirtualPool) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) GetVMAXUsePortGroupEnabledConfig(com.emc.sa.service.vipr.block.tasks.GetVMAXUsePortGroupEnabledConfig) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Aggregations

BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)60 URI (java.net.URI)30 Host (com.emc.storageos.db.client.model.Host)8 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)8 ArrayList (java.util.ArrayList)8 DiskDrive (com.iwave.ext.windows.model.wmi.DiskDrive)7 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)5 Datastore (com.vmware.vim25.mo.Datastore)5 Map (java.util.Map)5 ExecutionException (com.emc.sa.engine.ExecutionException)4 DeactivateHost (com.emc.sa.service.vipr.compute.tasks.DeactivateHost)4 DiscoverHost (com.emc.sa.service.vipr.compute.tasks.DiscoverHost)4 GetHost (com.emc.sa.service.vipr.tasks.GetHost)4 AssetOption (com.emc.vipr.model.catalog.AssetOption)4 HashMap (java.util.HashMap)4 HostRestRep (com.emc.storageos.model.host.HostRestRep)3 BlockVirtualPoolRestRep (com.emc.storageos.model.vpool.BlockVirtualPoolRestRep)3 TimeoutException (com.emc.vipr.client.exceptions.TimeoutException)3 ViPRException (com.emc.vipr.client.exceptions.ViPRException)3 Disk (com.iwave.ext.windows.model.Disk)3