use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.
the class FindDisksForVolumes method failIfMissingVolumes.
protected void failIfMissingVolumes(Map<BlockObjectRestRep, DiskDrive> results) {
if (isMissingVolumes(results)) {
// Build error message
StrBuilder wwids = new StrBuilder();
int missingCount = 0;
for (BlockObjectRestRep volume : volumes) {
DiskDrive disk = results.get(volume);
if (disk == null) {
wwids.appendSeparator(", ");
wwids.append(volume.getWwn());
missingCount++;
}
}
if (missingCount > 1) {
throw stateException("illegalState.FindDisksForVolumes.noVolumes", wwids);
} else {
throw stateException("illegalState.FindDisksForVolumes.noVolume", wwids);
}
}
}
use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.
the class ExtendDriveHelper method extendDrives.
public void extendDrives() {
windows.rescanDisks();
for (Map.Entry<? extends BlockObjectRestRep, String> entry : volume2mountPoint.entrySet()) {
BlockObjectRestRep volume = entry.getKey();
String mountPoint = entry.getValue();
ViPRService.artificialFailure(ArtificialFailures.ARTIFICIAL_FAILURE_WINDOWS_BEFORE_EXTEND_DRIVE);
windows.extendDrive(volume, mountPoint);
// Updates the volume mount point, it may have changed
ViPRService.artificialFailure(ArtificialFailures.ARTIFICIAL_FAILURE_WINDOWS_AFTER_EXTEND_DRIVE);
windows.addVolumeMountPoint(volume, mountPoint);
}
ExecutionUtils.clearRollback();
}
use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.
the class UnmountBlockVolumeHelper method unmountVolumes.
public void unmountVolumes() {
for (BlockObjectRestRep volume : volumes) {
DiskDrive disk = volume2disk.get(volume);
Disk diskDetail = windows.getDiskDetail(disk);
if (diskDetail.getVolumes() != null) {
for (Volume diskVolume : diskDetail.getVolumes()) {
windows.unmountVolume(diskVolume.getNumber(), diskVolume.getMountPoint());
boolean isDriveLetterOnly = WindowsUtils.isMountPointDriveLetterOnly(diskVolume.getMountPoint());
if (!isDriveLetterOnly && windows.isDirectoryEmpty(diskVolume.getMountPoint())) {
windows.deleteDirectory(diskVolume.getMountPoint());
}
}
}
if (diskDetail.isOnline()) {
windows.offlineDisk(disk);
} else {
logInfo("win.unmount.block.volume.disk.offline", disk.getNumber(), volume.getWwn());
}
windows.removeVolumeMountPoint(volume);
}
}
use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.
the class ExpandVmfsDatastoreService method execute.
@Override
public void execute() throws Exception {
BlockObjectRestRep volume = BlockStorageUtils.getVolume(volumeId);
// Skip the expand if the current volume capacity is larger than the requested expand size
if (BlockStorageUtils.isVolumeExpanded(volume, sizeInGb)) {
logWarn("expand.vmfs.datastore.skip", volumeId, BlockStorageUtils.getCapacity(volume));
} else {
BlockStorageUtils.expandVolume(volumeId, sizeInGb);
}
connectAndInitializeHost();
datastore = vmware.getDatastore(datacenter.getLabel(), datastoreName);
vmware.refreshStorage(host, cluster);
artificialFailure(ArtificialFailures.ARTIFICIAL_FAILURE_VMWARE_EXPAND_DATASTORE);
vmware.expandVmfsDatastore(host, cluster, hostId, volume, datastore);
if (hostId != null) {
ExecutionUtils.addAffectedResource(hostId.toString());
}
}
use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getVPlexVolumesInTargetVArray.
/**
* Gets all {@link VolumeRestRep}s that are either in the target VArray or use the target VArray for protection
*
* @param client the ViPR client instance.
* @param targetVArrayId the target VArray ID.
* @param volumes the volumes we are concerned with. (These should be VPlex volumes)
* @return List of {@link VolumeRestRep}s that are VPlex volumes that are in the target VArray
*/
public static List<BlockObjectRestRep> getVPlexVolumesInTargetVArray(ViPRCoreClient client, URI targetVArrayId, List<VolumeRestRep> volumes) {
// collect vpools used by these volumes
Map<URI, BlockVirtualPoolRestRep> vpools = getVpoolsForVolumes(client, volumes);
// sift through the volumes to find ones with the correct VArray
List<BlockObjectRestRep> acceptedVolumes = Lists.newArrayList();
for (VolumeRestRep volume : volumes) {
if (volume.getVirtualArray().getId().equals(targetVArrayId)) {
addVolume(acceptedVolumes, volume);
} else {
// if this volume's HA type is 'distributed' and its distributed VArray matches the target VArray we can accept the volume
URI vpoolId = volume.getVirtualPool().getId();
BlockVirtualPoolRestRep volumeVpool = vpools.get(vpoolId);
if (volumeVpool != null && isVpoolProtectedByVarray(volumeVpool, targetVArrayId)) {
addVolume(acceptedVolumes, volume);
}
}
}
return acceptedVolumes;
}
Aggregations