Federico Simoncelli has posted comments on this change.

Change subject: core: Calculate storage format when adding an SD
......................................................................


Patch Set 3:

(2 comments)

http://gerrit.ovirt.org/#/c/30960/3/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommand.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommand.java:

Line 164:         if (sd.getStorageFormat() == null) {
Line 165:             if (sd.getStorageDomainType().isDataDomain()) {
Line 166:                 
sd.setStorageFormat(VersionStorageFormatUtil.getPreferredForVersion(
Line 167:                         
getTargetStoragePool().getcompatibility_version(), sd.getStorageType())
Line 168:                 );
I have the feeling that we have some cases where getTargetStoragePool() could 
be null (or dummy pool?). But I can't spot this in the code now.

Anyway you're allowed to create a StorageDomain without specifying a Storage 
Pool (both webadmin and more commonly in rest-api). In that case I expect it to 
be the latest version (V3).
Line 169:             } else {
Line 170:                 sd.setStorageFormat(StorageFormatType.V1);
Line 171:             }
Line 172:         }


http://gerrit.ovirt.org/#/c/30960/3/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommonTest.java
File 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/AddStorageDomainCommonTest.java:

Line 116:         sd.setStorageFormat(null);
Line 117:         CanDoActionTestUtils.runAndAssertCanDoActionSuccess(cmd);
Line 118:         assertEquals("Format not initialized correctly", 
StorageFormatType.V3, sd.getStorageFormat());
Line 119:     }
Line 120: 
I think we miss something like:

 public void canDoActionSucceedsInitFormatDataDomain30() {
     sd.setStorageFormat(null);
     sp.setcompatibility_version(Version.v3_0);
     CanDoActionTestUtils.runAndAssertCanDoActionSuccess(cmd);
     assertEquals("Format not initialized correctly", StorageFormatType.V1, 
sd.getStorageFormat()
 }
Line 121:     @Test
Line 122:     public void canDoActionSucceedsInitFormatIsoDomain() {
Line 123:         sd.setStorageFormat(null);
Line 124:         sd.setStorageDomainType(StorageDomainType.ISO);


-- 
To view, visit http://gerrit.ovirt.org/30960
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: If469bb655e9a65e2d0afcee164655fa0bdfa5d99
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Tal Nisan <[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

Reply via email to