use of org.ovirt.engine.core.common.vdscommands.GetVGInfoVDSCommandParameters in project ovirt-engine by oVirt.
the class AddSANStorageDomainCommand method proceedVGLunsInDb.
protected void proceedVGLunsInDb() {
final ArrayList<LUNs> luns = (ArrayList<LUNs>) runVdsCommand(VDSCommandType.GetVGInfo, new GetVGInfoVDSCommandParameters(getVds().getId(), getStorageDomain().getStorage())).getReturnValue();
TransactionSupport.executeInNewTransaction(() -> {
for (LUNs lun : luns) {
lunHelper.proceedLUNInDb(lun, getStorageDomain().getStorageType(), getStorageDomain().getStorage());
}
return null;
});
}
use of org.ovirt.engine.core.common.vdscommands.GetVGInfoVDSCommandParameters in project ovirt-engine by oVirt.
the class ExtendSANStorageDomainCommand method updateLunsList.
@SuppressWarnings("unchecked")
private void updateLunsList() {
VDS spmVds = getAllRunningVdssInPool().stream().filter(vds -> vds.getSpmStatus() == VdsSpmStatus.SPM).findFirst().orElse(null);
if (spmVds == null) {
log.error("Could not update LUNs' information of storage domain with VG ID '{}' in the DB.", getStorageDomain().getStorage());
return;
}
try {
ArrayList<LUNs> upToDateLuns = (ArrayList<LUNs>) runVdsCommand(VDSCommandType.GetVGInfo, new GetVGInfoVDSCommandParameters(spmVds.getId(), getStorageDomain().getStorage())).getReturnValue();
getParameters().setLunsList(upToDateLuns);
} catch (RuntimeException e) {
log.error("Could not get the information for VG ID '{}'; the LUNs' information will not be updated.", getStorageDomain().getStorage());
log.debug("Exception", e);
}
}
use of org.ovirt.engine.core.common.vdscommands.GetVGInfoVDSCommandParameters in project ovirt-engine by oVirt.
the class GetUnregisteredBlockStorageDomainsQuery method getStorageDomainsByVolumeGroupIds.
/**
* Create StorageDomain objects according to the specified VG-IDs list.
*
* @param vgIDs the VG-IDs list
*
* @return storage domains list
*/
@SuppressWarnings("unchecked")
protected List<StorageDomain> getStorageDomainsByVolumeGroupIds(List<String> vgIDs) {
List<StorageDomain> storageDomains = new ArrayList<>();
// Get existing PhysicalVolumes.
Set<String> existingLunIds = lunDao.getAll().stream().map(LUNs::getId).collect(Collectors.toSet());
for (String vgID : vgIDs) {
VDSReturnValue returnValue;
try {
returnValue = executeGetVGInfo(new GetVGInfoVDSCommandParameters(getParameters().getVdsId(), vgID));
} catch (RuntimeException e) {
log.error("Could not get info for VG ID: '{}': {}", vgID, e.getMessage());
log.debug("Exception", e);
continue;
}
ArrayList<LUNs> luns = (ArrayList<LUNs>) returnValue.getReturnValue();
if (luns.stream().anyMatch(l -> existingLunIds.contains(l.getId()))) {
log.info("There are existing luns in the system which are part of VG id '{}'", vgID);
continue;
}
// Get storage domain ID by a representative LUN
LUNs lun = luns.get(0);
Guid storageDomainId = lun.getStorageDomainId();
// Get storage domain using GetStorageDomainInfo
StorageDomain storageDomain = getStorageDomainById(storageDomainId);
if (storageDomain != null) {
storageDomains.add(storageDomain);
}
}
return storageDomains;
}
use of org.ovirt.engine.core.common.vdscommands.GetVGInfoVDSCommandParameters in project ovirt-engine by oVirt.
the class AddExistingBlockStorageDomainCommand method getLUNsFromVgInfo.
protected List<LUNs> getLUNsFromVgInfo() {
List<LUNs> luns = new ArrayList<>();
VDSReturnValue returnValue;
try {
returnValue = runVdsCommand(VDSCommandType.GetVGInfo, new GetVGInfoVDSCommandParameters(getParameters().getVdsId(), getStorageDomain().getStorage()));
} catch (RuntimeException e) {
log.error("Could not get info for VG ID '{}': {}", getStorageDomain().getStorage(), e.getMessage());
log.debug("Exception", e);
return luns;
}
luns.addAll((ArrayList<LUNs>) returnValue.getReturnValue());
return luns;
}
Aggregations