Sergey Gotliv has posted comments on this change.

Change subject: engine: Set correct size of iso files and floppies
......................................................................


Patch Set 5:

(10 comments)

....................................................
Commit Message
Line 13: 
Line 14: Now this API returns all information VDSM keeps about these files
Line 15: including their size so Engine set the correct value.
Line 16: Engine uses -1 when size is not available because old versions of VDSM
Line 17: don't send it.
Done
Line 18: 
Line 19: Change-Id: I77bd99beb8138524b25f0afdcce0815ad8664f0f
Line 20: Bug-Url: https://bugzilla.redhat.com/1005889


....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/IsoDomainListSyncronizer.java
Line 540:     }
Line 541: 
Line 542:     private static boolean refreshIsoFileListMetaData(final Guid 
repoStorageDomainId,
Line 543:                                                       final 
RepoFileMetaDataDAO repoFileMetaDataDao,
Line 544:                                                       final 
Map<String, Map<String, String>> isoFilesToMetadataMap,
Done
Line 545:                                                       final 
ImageFileType imageType) {
Line 546:         Lock syncObject = getSyncObject(repoStorageDomainId, 
imageType);
Line 547:         try {
Line 548:             syncObject.lock();


Line 552:                         public Object runInTransaction() {
Line 553:                             long currentTime = 
System.currentTimeMillis();
Line 554:                             
repoFileMetaDataDao.removeRepoDomainFileList(repoStorageDomainId, imageType);
Line 555:                             RepoImage repo_md;
Line 556:                             for (Map.Entry<String, Map<String, 
String>> isoFileWithMetadata : isoFilesToMetadataMap.entrySet()) {
Done
Line 557:                                 repo_md = new RepoImage();
Line 558:                                 repo_md.setLastRefreshed(currentTime);
Line 559:                                 
repo_md.setSize(retrieveIsoFileSize(isoFileWithMetadata));
Line 560:                                 
repo_md.setRepoDomainId(repoStorageDomainId);


Line 572:         }
Line 573:     }
Line 574: 
Line 575:     private static long retrieveIsoFileSize(Map.Entry<String, 
Map<String, String>> isoFileWithMetadata) {
Line 576:         // old VDSM versions don't provide the metadata for iso files 
therefore engine marks size as not available
Done
Line 577:         String sizeValue = isoFileWithMetadata.getValue().get("size");
Line 578:         if (sizeValue == null) {
Line 579:             return SIZE_IS_NOT_AVAILABLE;
Line 580:         }


Line 577:         String sizeValue = isoFileWithMetadata.getValue().get("size");
Line 578:         if (sizeValue == null) {
Line 579:             return SIZE_IS_NOT_AVAILABLE;
Line 580:         }
Line 581: 
Done
Line 582:         try {
Line 583:             return Long.valueOf(sizeValue);
Line 584:         } catch (NumberFormatException e) {
Line 585:             // illegal number is treated as not available, treating 
exception in UI will be more complicate


Line 641:                         .RunVdsCommand(VDSCommandType.GetIsoList,
Line 642:                                 new 
IrsBaseVDSCommandParameters(repoStoragePoolId));
Line 643:                 @SuppressWarnings("unchecked")
Line 644:                 Map<String, Map<String, String>> isoDomainList =
Line 645:                         (Map<String, Map<String, String>>) 
returnValue.getReturnValue();
Done
Line 646:                 if (returnValue.getSucceeded() && isoDomainList != 
null) {
Line 647:                     log.debugFormat("The refresh process from VDSM, 
for Iso files succeeded.");
Line 648:                     // Set the Iso domain file list fetched from VDSM 
into the DB.
Line 649:                     refreshIsoSucceeded =


Line 679:                         .getResourceManager()
Line 680:                         .RunVdsCommand(VDSCommandType.GetFloppyList,
Line 681:                                 new 
IrsBaseVDSCommandParameters(repoStoragePoolId));
Line 682:                 @SuppressWarnings("unchecked")
Line 683:                 Map<String, Map<String, String>> isoDomainFloppyList =
Done
Line 684:                         (Map<String, Map<String, String>>) 
returnValue.getReturnValue();
Line 685:                 if (returnValue.getSucceeded() && isoDomainFloppyList 
!= null) {
Line 686:                     // Set the Iso domain floppy file list fetched 
from VDSM into the DB.
Line 687:                     refreshFloppySucceeded =


....................................................
File 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/IsoListReturnForXmlRpc.java
Line 7: public final class IsoListReturnForXmlRpc extends StatusReturnForXmlRpc 
{
Line 8:     private static final String ISO_LIST = "isolist";
Line 9:     private static final String FILE_STATS = "fileStats";
Line 10: 
Line 11:     private Map<String, Map<String, String>> fileToMetadata;
Done
Line 12: 
Line 13:     public IsoListReturnForXmlRpc(Map<String, Object> innerMap) {
Line 14:         super(innerMap);
Line 15:         fileToMetadata = (Map<String, Map<String, String>>) 
innerMap.get(FILE_STATS);


Line 13:     public IsoListReturnForXmlRpc(Map<String, Object> innerMap) {
Line 14:         super(innerMap);
Line 15:         fileToMetadata = (Map<String, Map<String, String>>) 
innerMap.get(FILE_STATS);
Line 16:         // new VDSM version returns dictionary(map) with file name as 
a key and file metadata as a value
Line 17:         // old VDSMs returned a list with file names only.
Done
Line 18:         if (fileToMetadata == null) {
Line 19:             fileToMetadata = new HashMap<>();
Line 20:             Object[] isoList = (Object[]) innerMap.get(ISO_LIST);
Line 21:             if (isoList != null) {


Line 25:             }
Line 26:         }
Line 27:     }
Line 28: 
Line 29:     public Map<String, Map<String, String>> getFileToMetadata() {
Done
Line 30:         return fileToMetadata;
Line 31:     }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I77bd99beb8138524b25f0afdcce0815ad8664f0f
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Sergey Gotliv <sgot...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Daniel Erez <de...@redhat.com>
Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com>
Gerrit-Reviewer: Sergey Gotliv <sgot...@redhat.com>
Gerrit-Reviewer: Tal Nisan <tni...@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

Reply via email to