Ori Liel has posted comments on this change.
Change subject: restapi: Direct-LUN Disk Creation - Dont Require Size
......................................................................
Patch Set 2: (3 inline comments)
....................................................
File
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendDisksResource.java
Line 28:
Line 29: @Override
Line 30: public Response add(Disk disk) {
Line 31: validateParameters(disk, "format", "interface");
Line 32: if (!disk.isSetLunStorage() ||
disk.getLunStorage().getLogicalUnits().isEmpty()) { // lun-disk does not require
not true, see implementation of getLogicalUnits():
public List<LogicalUnit> getLogicalUnits() {
if (logicalUnits == null) {
logicalUnits = new ArrayList<LogicalUnit>();
}
return this.logicalUnits;
}
It will always return a non-null result
Line 33:
// size
Line 34: validateParameters(disk, "provisionedSize|size");
Line 35: }
Line 36: validateEnums(Disk.class, disk);
....................................................
File
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmDisksResource.java
Line 55: if (disk.isSetId()) {
Line 56: return attachDiskToVm(disk);
Line 57: }else {
Line 58: validateParameters(disk, "format", "interface");
Line 59: if (!disk.isSetLunStorage()) {// lun-disk does not require
size
Done
Line 60: validateParameters(disk, "provisionedSize|size");
Line 61: }
Line 62: return performCreation(addAction,
Line 63: getAddParameters(map(disk), disk),
....................................................
File
backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmDisksResourceTest.java
Line 344: try {
Line 345: collection.add(model);
Line 346: fail("expected WebApplicationException on incomplete
parameters");
Line 347: } catch (WebApplicationException wae) {
Line 348: verifyIncompleteException(wae, "Disk", "add",
"provisionedSize|size");
validation of [format, interface] was separated from validation of
[provisionedSize|size], so I had to add a test that checks that if format and
interface are supplied, but size is not, then there's a validation failure. But
you're right, an additional test is required that checks that when a lun is
supplied, size validation does not occur, I will add this test
Line 349: }
Line 350: }
Line 351:
Line 352: @Test
--
To view, visit http://gerrit.ovirt.org/8331
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie8dba8d1e1b20ff5f81d9cfa944d3bfcd5630bc1
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ori Liel <[email protected]>
Gerrit-Reviewer: Michael Pasternak <[email protected]>
Gerrit-Reviewer: Ori Liel <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches