Maor Lipchuk has uploaded a new change for review. Change subject: core: Add OVF_STORE disks registration on Data Center initialization ......................................................................
core: Add OVF_STORE disks registration on Data Center initialization Add existing OVF_STORE disks to Storage Domains which are registered to the Data Center Change-Id: I9a6dd41c220dd1e91c458e0af5a600860a3ae466 Bug-Url: https://bugzilla.redhat.com/1217339 Signed-off-by: Maor Lipchuk <mlipc...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStoragePoolWithStoragesCommand.java 1 file changed, 29 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/95/40595/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStoragePoolWithStoragesCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStoragePoolWithStoragesCommand.java index 1cfb957..430ed74 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStoragePoolWithStoragesCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStoragePoolWithStoragesCommand.java @@ -14,6 +14,8 @@ import org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase; import org.ovirt.engine.core.common.action.StoragePoolWithStoragesParameter; import org.ovirt.engine.core.common.action.VdcActionType; +import org.ovirt.engine.core.common.businessentities.DiskImage; +import org.ovirt.engine.core.common.businessentities.OvfEntityData; import org.ovirt.engine.core.common.businessentities.StorageDomain; import org.ovirt.engine.core.common.businessentities.StorageDomainStatic; import org.ovirt.engine.core.common.businessentities.StorageDomainStatus; @@ -130,6 +132,8 @@ // command throw new VdcBLLException(VdcBllErrors.ENGINE_ERROR_CREATING_STORAGE_POOL); } + } else { + registerOvfStoreDisks(); } } @@ -256,6 +260,31 @@ return returnValue; } + private void registerOvfStoreDisks() { + for (final Guid storageDomainId : getParameters().getStorages()) { + resetOvfStoreDisks(); + final List<OvfEntityData> unregisteredEntitiesFromOvfDisk = + getEntitiesFromStorageOvfDisk(storageDomainId, getStoragePool().getId()); + TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { + @Override + public Void runInTransaction() { + List<DiskImage> ovfStoreDiskImages = getAllOVFDisks(storageDomainId, getStoragePool().getId()); + registerAllOvfDisks(ovfStoreDiskImages, storageDomainId); + + // Update unregistered entities + for (OvfEntityData ovf : unregisteredEntitiesFromOvfDisk) { + getUnregisteredOVFDataDao().removeEntity(ovf.getEntityId(), storageDomainId); + getUnregisteredOVFDataDao().saveOVFData(ovf); + log.infoFormat("Adding OVF data of entity id {0} and entity name {1}", + ovf.getEntityId(), + ovf.getEntityName()); + } + return null; + } + }); + } + } + @Override protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__TYPE__STORAGE__DOMAIN); -- To view, visit https://gerrit.ovirt.org/40595 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9a6dd41c220dd1e91c458e0af5a600860a3ae466 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5.2 Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches