use of org.ovirt.engine.core.common.vdscommands.GetDeviceListVDSCommandParameters 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.vdscommands.GetDeviceListVDSCommandParameters 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.vdscommands.GetDeviceListVDSCommandParameters in project ovirt-engine by oVirt.
the class ImportHostedEngineStorageDomainCommand method discoverBlockConnectionDetails.
private void discoverBlockConnectionDetails() {
// get device list
VDSReturnValue getDeviceList = runVdsCommand(VDSCommandType.GetDeviceList, new GetDeviceListVDSCommandParameters(getParameters().getVdsId(), heStorageDomain.getStorageType()));
if (getDeviceList.getSucceeded() && getDeviceList.getReturnValue() != null && heStorageDomain.getStorageStaticData().getStorage() != null) {
for (LUNs lun : (ArrayList<LUNs>) getDeviceList.getReturnValue()) {
// match a lun vgid to the domain vgid.
if (heStorageDomain.getStorage().equals(lun.getVolumeGroupId())) {
// found a lun. Use its connection details
heStorageDomain.getStorageStaticData().setConnection(lun.getLunConnections().get(0));
setSucceeded(true);
break;
}
}
if (!getSucceeded()) {
log.error("There are no luns with VG that match the SD VG '{}'." + " Connections details are missing. completing this automatic import");
}
}
}
use of org.ovirt.engine.core.common.vdscommands.GetDeviceListVDSCommandParameters in project ovirt-engine by oVirt.
the class GetDeviceListQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
if (getParameters().isValidateHostStatus() && !isActiveVds()) {
return;
}
List<LUNs> returnValue = new ArrayList<>();
// Get Device List
GetDeviceListVDSCommandParameters parameters = new GetDeviceListVDSCommandParameters(getParameters().getId(), getParameters().getStorageType(), getParameters().isCheckStatus(), getParameters().getLunIds());
List<LUNs> luns = (List<LUNs>) runVdsCommand(VDSCommandType.GetDeviceList, parameters).getReturnValue();
// Get LUNs from DB
List<LUNs> lunsFromDb = lunDao.getAll();
Map<String, LUNs> lunsFromDbById = lunsFromDb.stream().collect(Collectors.toMap(LUNs::getLUNId, Function.identity()));
for (LUNs lun : luns) {
if (lunsFromDbById.containsKey(lun.getLUNId())) {
LUNs lunFromDb = lunsFromDbById.get(lun.getLUNId());
lun.setDiskId(lunFromDb.getDiskId());
lun.setDiskAlias(lunFromDb.getDiskAlias());
lun.setStorageDomainId(lunFromDb.getStorageDomainId());
lun.setStorageDomainName(lunFromDb.getStorageDomainName());
}
returnValue.add(lun);
}
getQueryReturnValue().setReturnValue(returnValue);
}
use of org.ovirt.engine.core.common.vdscommands.GetDeviceListVDSCommandParameters in project ovirt-engine by oVirt.
the class GetLunsByVgIdQuery method getLunsFromDeviceMap.
protected Map<String, LUNs> getLunsFromDeviceMap(StorageType storageType) {
Map<String, LUNs> lunsMap = new HashMap<>();
if (getParameters().getId() == null) {
return lunsMap;
}
GetDeviceListVDSCommandParameters parameters = new GetDeviceListVDSCommandParameters(getParameters().getId(), storageType);
List<LUNs> lunsList = (List<LUNs>) runVdsCommand(VDSCommandType.GetDeviceList, parameters).getReturnValue();
for (LUNs lun : lunsList) {
lunsMap.put(lun.getLUNId(), lun);
}
return lunsMap;
}
Aggregations