Maor Lipchuk has posted comments on this change. Change subject: engine, dao: Introduce ISCSI Bundle entity, tables and dao ......................................................................
Patch Set 2: (8 comments) .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/GetIscsiBundlesByStoragePoolIdQuery.java Line 18: List<IscsiBundle> iscsiBundles = getDbFacade().getIscsiBundleDao().getAllByStoragePoolId(getParameters().getId()); Line 19: Line 20: for (IscsiBundle iscsiBundle : iscsiBundles) { Line 21: List<Guid> networkIds = getDbFacade().getIscsiBundleDao().getNetworkIdsByIscsiBundleId(iscsiBundle.getId()); Line 22: if (networkIds != null) { The validation here is redundant, networkIds should not be null Line 23: iscsiBundle.setNetworkIds(networkIds); Line 24: } Line 25: } Line 26: .................................................... File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/IscsiBundle.java Line 10: private static final long serialVersionUID = 6318808440502965971L; Line 11: Line 12: private Guid id; Line 13: private Guid storagePoolId; Line 14: private String name; You can use here validation annotation, as so: @Size(min = 0, max = BusinessEntitiesDefinitions.GENERAL_NAME_SIZE, groups = { CreateEntity.class }) @ValidI18NName(message = "VALIDATION.NAME.INVALID", groups = { CreateEntity.class, UpdateEntity.class }) Line 15: private String description; Line 16: private List<Guid> networkIds; Line 17: Line 18: public IscsiBundle() { Line 11: Line 12: private Guid id; Line 13: private Guid storagePoolId; Line 14: private String name; Line 15: private String description; same for description Line 16: private List<Guid> networkIds; Line 17: Line 18: public IscsiBundle() { Line 19: networkIds = new LinkedList<Guid>(); .................................................... File backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java Line 167: put(Image.class, ImageDao.class); Line 168: put(Job.class, JobDao.class); Line 169: put(Step.class, StepDao.class); Line 170: put(VnicProfile.class, VnicProfileDao.class); Line 171: put(VnicProfileView.class, VnicProfileDao.class); Maybe it is worth to add IscsiBundleDao also if we want to use compensation? Line 172: put(DwhHistoryTimekeeping.class, DwhHistoryTimekeepingDao.class); Line 173: } Line 174: }; Line 175: .................................................... File packaging/dbscripts/iscsi_bundles_sp.sql Line 21: END; $procedure$ Line 22: LANGUAGE plpgsql; Line 23: Line 24: Line 25: Create or replace FUNCTION GetNetworksByIscsiBundleId(v_iscsi_bundle_id UUID) RETURNS SETOF UUID STABLE I think this function is more suitable to be in the NetowrkDAO Line 26: AS $procedure$ Line 27: BEGIN Line 28: RETURN QUERY SELECT iscsi_bundles_networks_map.network_id Line 29: FROM iscsi_bundles_networks_map Line 44: END; $procedure$ Line 45: LANGUAGE plpgsql; Line 46: Line 47: Line 48: Create or replace FUNCTION UpdateIscsiBundles(v_id UUID, perhaps use singular name here (UpdateIscsiBundle instead of UpdateIscsiBundles) Line 49: v_alias VARCHAR(30), Line 50: v_description VARCHAR(4000)) Line 51: RETURNS VOID Line 52: AS $procedure$ Line 64: DECLARE Line 65: v_val UUID; Line 66: BEGIN Line 67: -- Get (and keep) a shared lock with "right to upgrade to exclusive" Line 68: -- in order to force locking parent before children tabs are redundant Line 69: SELECT id INTO v_val FROM iscsi_bundles WHERE id = v_id FOR UPDATE; Line 70: DELETE FROM iscsi_bundles_networks_map WHERE iscsi_bundle_id = v_id; Line 71: DELETE FROM iscsi_bundles WHERE id = v_id; Line 72: END; $procedure$ .................................................... File packaging/dbscripts/upgrade/03_04_0340_add_iscsi_bundle.sql Line 1: CREATE TABLE iscsi_bundles Line 2: ( Line 3: id UUID NOT NULL, Line 4: alias varchar(30) NOT NULL, Perhaps better to use more then 30 characters (Network name has 50 characters maybe it will be better to use 50 characters instead) Line 5: description varchar(4000), Line 6: storage_pool_id UUID NOT NULL, Line 7: CONSTRAINT PK_iscsi_bundles PRIMARY KEY(id) Line 8: ) WITH OIDS; -- To view, visit http://gerrit.ovirt.org/22951 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I12313c02810a2f0e75016bdd78b44da43f2154d4 Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Sergey Gotliv <sgot...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com> Gerrit-Reviewer: Sergey Gotliv <sgot...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches