use of org.ovirt.engine.core.common.businessentities.storage.LUNs 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.businessentities.storage.LUNs 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.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class ImagesHandler method removeLunDisk.
public void removeLunDisk(LunDisk lunDisk) {
vmDeviceDao.remove(new VmDeviceId(lunDisk.getId(), null));
LUNs lun = lunDisk.getLun();
diskLunMapDao.remove(new DiskLunMapId(lunDisk.getId(), lun.getLUNId()));
baseDiskDao.remove(lunDisk.getId());
lun.setLunConnections(new ArrayList<>(storageServerConnectionDao.getAllForLun(lun.getLUNId())));
if (!lun.getLunConnections().isEmpty()) {
storageHelperDirector.getItem(lun.getLunConnections().get(0).getStorageType()).removeLun(lun);
} else {
// if there are no connections then the lun is fcp.
storageHelperDirector.getItem(StorageType.FCP).removeLun(lun);
}
}
use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class LunDaoTest method testGetAllForVolumeGroup.
/**
* Ensures the right set of LUNs are returned.
*/
@Test
public void testGetAllForVolumeGroup() {
List<LUNs> result = dao.getAllForVolumeGroup(existingEntity.getVolumeGroupId());
assertNotNull(result);
assertFalse(result.isEmpty());
for (LUNs lun : result) {
assertEquals(existingEntity.getVolumeGroupId(), lun.getVolumeGroupId());
}
}
use of org.ovirt.engine.core.common.businessentities.storage.LUNs in project ovirt-engine by oVirt.
the class BackendStorageDomainsResource method mapVolumeGroupIscsi.
protected void mapVolumeGroupIscsi(StorageDomain model, org.ovirt.engine.core.common.businessentities.StorageDomain entity) {
VolumeGroup vg = model.getStorage().getVolumeGroup();
List<LUNs> luns = getLunsByVgId(vg.getId());
if (luns != null && !luns.isEmpty()) {
vg.setLogicalUnits(new LogicalUnits());
for (LUNs lun : luns) {
List<StorageServerConnections> lunConnections = lun.getLunConnections();
if (lunConnections != null) {
for (StorageServerConnections cnx : lunConnections) {
LogicalUnit unit = map(lun);
unit = map(cnx, unit);
vg.getLogicalUnits().getLogicalUnits().add(unit);
}
}
}
}
}
Aggregations