Search in sources :

Example 1 with HostsUpdateParam

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

the class AddHostToExport method doExecute.

@Override
protected Task<ExportGroupRestRep> doExecute() throws Exception {
    ExportUpdateParam exportUpdateParam = new ExportUpdateParam();
    exportUpdateParam.setHosts(new HostsUpdateParam());
    exportUpdateParam.getHosts().getAdd().add(hostId);
    // Only add the export path parameters to the call if we have to
    boolean addExportPathParameters = false;
    ExportPathParameters exportPathParameters = new ExportPathParameters();
    if (minPaths != null && maxPaths != null && pathsPerInitiator != null) {
        exportPathParameters.setMinPaths(minPaths);
        exportPathParameters.setMaxPaths(maxPaths);
        exportPathParameters.setPathsPerInitiator(pathsPerInitiator);
        addExportPathParameters = true;
    }
    if (portGroup != null) {
        exportPathParameters.setPortGroup(portGroup);
        addExportPathParameters = true;
    }
    if (addExportPathParameters) {
        exportUpdateParam.setExportPathParameters(exportPathParameters);
    }
    return getClient().blockExports().update(exportId, exportUpdateParam);
}
Also used : ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) ExportPathParameters(com.emc.storageos.model.block.export.ExportPathParameters) HostsUpdateParam(com.emc.storageos.model.block.export.HostsUpdateParam)

Example 2 with HostsUpdateParam

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

the class BlockExportGroups method removeHost.

@FlashException(referrer = { "exportGroup" })
public static void removeHost(String exportGroupId, String hostId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    ExportUpdateParam exportUpdateParam = new ExportUpdateParam();
    exportUpdateParam.setHosts(new HostsUpdateParam());
    exportUpdateParam.getHosts().getRemove().add(uri(hostId));
    Task<ExportGroupRestRep> task = client.blockExports().update(uri(exportGroupId), exportUpdateParam);
    flash.put("info", MessagesUtils.get("resources.exportgroup.host.removed", task.getOpId()));
    exportGroup(exportGroupId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) HostsUpdateParam(com.emc.storageos.model.block.export.HostsUpdateParam) FlashException(controllers.util.FlashException)

Example 3 with HostsUpdateParam

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

the class BlockExportGroups method addHosts.

@FlashException(referrer = { "exportGroup" })
public static void addHosts(String exportId, @As(",") String[] ids) {
    ExportUpdateParam exportUpdateParam = new ExportUpdateParam();
    exportUpdateParam.setHosts(new HostsUpdateParam());
    if (ids != null && ids.length > 0) {
        for (String hostId : ids) {
            exportUpdateParam.getHosts().getAdd().add(uri(hostId));
        }
    }
    Task<ExportGroupRestRep> task = getViprClient().blockExports().update(uri(exportId), exportUpdateParam);
    flash.put("info", MessagesUtils.get("resources.exportgroup.hosts.added", task.getOpId()));
    exportGroup(exportId);
}
Also used : ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) HostsUpdateParam(com.emc.storageos.model.block.export.HostsUpdateParam) FlashException(controllers.util.FlashException)

Example 4 with HostsUpdateParam

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

the class AddHostAndVolumeToExportNoWait method doExecute.

@Override
protected Task<ExportGroupRestRep> doExecute() throws Exception {
    ExportUpdateParam exportUpdateParam = new ExportUpdateParam();
    List<VolumeParam> volumes = new ArrayList<VolumeParam>();
    if (!NullColumnValueGetter.isNullURI(volumeId)) {
        VolumeParam volume = new VolumeParam(volumeId);
        volume.setLun(-1);
        if (hlu != null && !hlu.equals(ExportVMwareBlockVolumeHelper.USE_EXISTING_HLU)) {
            volume.setLun(hlu);
        }
        volumes.add(volume);
        exportUpdateParam.setVolumes(new VolumeUpdateParam(volumes, new ArrayList<URI>()));
    }
    if (!NullColumnValueGetter.isNullURI(hostId)) {
        exportUpdateParam.setHosts(new HostsUpdateParam());
        exportUpdateParam.getHosts().getAdd().add(hostId);
    }
    if (!NullColumnValueGetter.isNullURI(portGroup)) {
        ExportPathParameters exportPathParameters = new ExportPathParameters();
        exportPathParameters.setPortGroup(portGroup);
        exportUpdateParam.setExportPathParameters(exportPathParameters);
    }
    return getClient().blockExports().update(exportId, exportUpdateParam);
}
Also used : VolumeUpdateParam(com.emc.storageos.model.block.export.VolumeUpdateParam) ArrayList(java.util.ArrayList) ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) VolumeParam(com.emc.storageos.model.block.export.VolumeParam) ExportPathParameters(com.emc.storageos.model.block.export.ExportPathParameters) HostsUpdateParam(com.emc.storageos.model.block.export.HostsUpdateParam)

Aggregations

ExportUpdateParam (com.emc.storageos.model.block.export.ExportUpdateParam)4 HostsUpdateParam (com.emc.storageos.model.block.export.HostsUpdateParam)4 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)2 ExportPathParameters (com.emc.storageos.model.block.export.ExportPathParameters)2 FlashException (controllers.util.FlashException)2 VolumeParam (com.emc.storageos.model.block.export.VolumeParam)1 VolumeUpdateParam (com.emc.storageos.model.block.export.VolumeUpdateParam)1 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)1 ArrayList (java.util.ArrayList)1