Juan Hernandez has posted comments on this change. Change subject: restapi: add quota mode to data center ......................................................................
Patch Set 1: (6 comments) https://gerrit.ovirt.org/#/c/39902/1/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/model/QuotaModeType.java File backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/model/QuotaModeType.java: Line 11: Line 12: public static QuotaModeType fromValue(String value) { Line 13: try { Line 14: return valueOf(value.toUpperCase()); Line 15: } catch (IllegalArgumentException e) { Send this exception to the log. Line 16: return null; Line 17: } Line 18: } https://gerrit.ovirt.org/#/c/39902/1/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd File backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd: Line 1389: <xs:element name="version" type="Version" minOccurs="0" /> Line 1390: <xs:element name="supported_versions" type="SupportedVersions" minOccurs="0" /> Line 1391: <xs:element ref="status" minOccurs="0" maxOccurs="1" /> Line 1392: <xs:element ref="mac_pool" minOccurs="0" /> Line 1393: <xs:element name="quota_mode_type" type="xs:string" minOccurs="0" maxOccurs="1" /> Shouldn't this be "quota_mode"? Line 1394: <!-- also rel="files" and rel="storagedomains" links --> Line 1395: </xs:sequence> Line 1396: </xs:extension> Line 1397: </xs:complexContent> Line 5511: </xs:appinfo> Line 5512: </xs:annotation> Line 5513: </xs:element> Line 5514: </xs:sequence> Line 5515: </xs:complexType> Can we move this type closer to the part of the file where all the other capabilities related types are defined? Line 5516: Line 5517: <xs:complexType name="OpenStackSubnet"> Line 5518: <xs:complexContent> Line 5519: <xs:extension base="BaseResource"> https://gerrit.ovirt.org/#/c/39902/1/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendCapabilitiesResource.java File backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendCapabilitiesResource.java: Line 972: } Line 973: } Line 974: Line 975: private void addQuotaModeTypes(VersionCaps version) { Line 976: if (VersionUtils.greaterOrEqual(version, VERSION_3_2)) { This should be 3.6, even if the "quota mode" concept was available sinnce 3.2. Line 977: version.setQuotaModeTypes(new QuotaModeTypes()); Line 978: for (QuotaModeType mode : QuotaModeType.values()) { Line 979: version.getQuotaModeTypes().getQuotaModeTypes().add(mode.value()); Line 980: } https://gerrit.ovirt.org/#/c/39902/1/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/DataCenterMapper.java File backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/DataCenterMapper.java: Line 130: return QuotaModeType.ENABLED; Line 131: case SOFT_ENFORCEMENT: Line 132: return QuotaModeType.AUDIT; Line 133: default: Line 134: return null; Throw an exception indicating that the value can't be mapped, something like this: throw new IllegalArgumentException("Unknown quota enforcement type \"" + type + "\""); Line 135: } Line 136: } Line 137: Line 138: @Mapping(from = QuotaModeType.class, to = QuotaEnforcementTypeEnum.class) Line 144: return QuotaEnforcementTypeEnum.HARD_ENFORCEMENT; Line 145: case AUDIT: Line 146: return QuotaEnforcementTypeEnum.SOFT_ENFORCEMENT; Line 147: default: Line 148: return null; Throw an exception, something like this: throw new IllegalArgumentException("Unknown quota mode type \"" + type + "\""); Line 149: } Line 150: } Line 151: } -- To view, visit https://gerrit.ovirt.org/39902 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I543068d6207e6cb31a2232616a8187770c7432bc Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Gilad Chaplik <[email protected]> Gerrit-Reviewer: Gilad Chaplik <[email protected]> Gerrit-Reviewer: Juan Hernandez <[email protected]> Gerrit-Reviewer: Ori Liel <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
