use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class LunDisksMonitoring method getVmLunDisksToSave.
List<LUNs> getVmLunDisksToSave(Guid vmId, Map<String, LUNs> lunsMap) {
if (lunsMap.isEmpty()) {
// LUNs list from getVmStats hasn't been updated yet or VDSM doesn't support LUNs list retrieval.
return Collections.emptyList();
}
List<LUNs> vmLunDisksToSave = new ArrayList<>();
getVmPluggedLunsFromDb(vmId).forEach(lunFromDB -> {
LUNs lunFromMap = lunsMap.get(lunFromDB.getId());
// Hence, verify before updating.
if (lunFromMap.getDeviceSize() != 0 && lunFromMap.getDeviceSize() != lunFromDB.getDeviceSize()) {
// Found a mismatch - set LUN for update
log.info("Updated LUN device size - ID: '{}', previous size: '{}', new size: '{}'.", lunFromDB.getLUNId(), lunFromDB.getDeviceSize(), lunFromMap.getDeviceSize());
lunFromDB.setDeviceSize(lunFromMap.getDeviceSize());
vmLunDisksToSave.add(lunFromDB);
}
});
return vmLunDisksToSave;
}
use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class ImportVmCommand method validateLunExistsAndInitDeviceData.
private boolean validateLunExistsAndInitDeviceData(LUNs lun, StorageType storageType, Guid vdsId) {
List<LUNs> lunFromStorage = null;
try {
StorageServerConnectionManagementVDSParameters connectParams = new StorageServerConnectionManagementVDSParameters(vdsId, Guid.Empty, storageType, lun.getLunConnections());
runVdsCommand(VDSCommandType.ConnectStorageServer, connectParams);
GetDeviceListVDSCommandParameters parameters = new GetDeviceListVDSCommandParameters(vdsId, storageType, false, Collections.singleton(lun.getLUNId()));
lunFromStorage = (List<LUNs>) runVdsCommand(VDSCommandType.GetDeviceList, parameters).getReturnValue();
} catch (Exception e) {
log.debug("Exception while validating LUN disk: '{}'", e);
return false;
}
if (lunFromStorage == null || lunFromStorage.isEmpty()) {
return false;
} else {
LUNs luns = lunFromStorage.get(0);
lun.setSerial(luns.getSerial());
lun.setLunMapping(luns.getLunMapping());
lun.setVendorId(luns.getVendorId());
lun.setProductId(luns.getProductId());
lun.setProductId(luns.getProductId());
lun.setDiscardMaxSize(luns.getDiscardMaxSize());
lun.setPvSize(luns.getPvSize());
}
return true;
}
use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class RefreshLunsSizeCommand method checkLunsInStorageDomain.
private boolean checkLunsInStorageDomain(Set<String> lunIds) {
// Get LUNs from DB
getParameters().setLunsList(new ArrayList<>(lunDao.getAllForVolumeGroup(getStorageDomain().getStorage())));
Set<String> lunsSet = new HashSet<>(lunIds);
for (LUNs lun : getParameters().getLunsList()) {
if (lunsSet.contains(lun.getLUNId())) {
// LUN is part of the storage domain
lunsSet.remove(lun.getLUNId());
}
}
return lunsSet.isEmpty();
}
use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class RefreshLunsSizeCommand method getDeviceListAllVds.
/**
* This method calls GetDeviceList with the specified luns on all hosts.
* In VDSM , this call will resize the devices if needed.
* It returns a map of LUN ID to a list of Pair(VDS,LUNs)
* This map will help to check if all hosts are seeing the same size of the LUNs.
*/
private Map<String, List<Pair<VDS, LUNs>>> getDeviceListAllVds(Set<String> lunsToResize) {
Map<String, List<Pair<VDS, LUNs>>> lunToVds = new HashMap<>();
for (VDS vds : getAllRunningVdssInPool()) {
GetDeviceListVDSCommandParameters parameters = new GetDeviceListVDSCommandParameters(vds.getId(), getStorageDomain().getStorageType(), false, lunsToResize);
List<LUNs> luns = (List<LUNs>) runVdsCommand(VDSCommandType.GetDeviceList, parameters).getReturnValue();
for (LUNs lun : luns) {
lunToVds.computeIfAbsent(lun.getLUNId(), k -> new ArrayList<>()).add(new Pair<>(vds, lun));
}
}
return lunToVds;
}
use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class GetUnregisteredBlockStorageDomainsQuery method getDeviceList.
/**
* Get devices (LUNs) that are visible by the host.
*
* @return the list of LUNs.
*/
protected List<LUNs> getDeviceList() {
List<LUNs> luns = new ArrayList<>();
QueryReturnValue returnValue = executeGetDeviceList(new GetDeviceListQueryParameters(getParameters().getVdsId(), getParameters().getStorageType(), false, null, false));
if (returnValue.getSucceeded()) {
luns.addAll(returnValue.<List<LUNs>>getReturnValue());
} else {
throw new RuntimeException(String.format("GetDeviceList execution failed. Exception message: %1$s", returnValue.getExceptionString()));
}
return luns;
}
Aggregations