Lior Vernia has posted comments on this change.

Change subject: engine: Calculate "true" host network usage
......................................................................


Patch Set 1:

(4 comments)

http://gerrit.ovirt.org/#/c/31000/1/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VdsNetworkInterface.java
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/VdsNetworkInterface.java:

Line 248:      * Checks whether an interface is a VLAN device.
Line 249:      *
Line 250:      * @return whether an interface is a VLAN device.
Line 251:      */
Line 252:     public boolean isVlanDevice() {
> This is way out-of the scope of this patch and could be done by a following
Done
Line 253:         return vlanId != null;
Line 254:     }
Line 255: 
Line 256:     /**


http://gerrit.ovirt.org/#/c/31000/1/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java
File 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsBrokerObjectsBuilder.java:

Line 680:         // ------------- vds network statistics ---------------------
Line 681:         Map<String, Object> interfaces = (Map<String, Object>) 
xmlRpcStruct.get(VdsProperties.NETWORK);
Line 682:         if (interfaces != null) {
Line 683:             Map<String, VdsNetworkInterface> nicsByName = 
Entities.entitiesByName(vds.getInterfaces());
Line 684:             Set<String> usageNics = new HashSet<String>();
> The type on the right side can be omitted (new HashSet<>();)
Done
Line 685:             for (Entry<String, Object> entry : interfaces.entrySet()) 
{
Line 686:                 if (nicsByName.containsKey(entry.getKey())) {
Line 687:                     VdsNetworkInterface iface = 
nicsByName.get(entry.getKey());
Line 688:                     iface.setVdsId(vds.getId());


Line 697:                     
iface.getStatistics().setTransmitDropRate(tx_dropped != null ? tx_dropped : 0);
Line 698:                     iface.setSpeed(AssignIntValue(dict, 
VdsProperties.INTERFACE_SPEED));
Line 699:                     
iface.getStatistics().setStatus(AssignInterfaceStatusValue(dict, 
VdsProperties.iface_status));
Line 700: 
Line 701:                     if (!Boolean.TRUE.equals(iface.getBonded()) && 
!iface.isVlanDevice()) {
> why not-
Because I also need to add bonds to the collection, but only those that 
actually have slaves.
Line 702:                         usageNics.add(iface.isBondSlave() ? 
iface.getBondName() : iface.getName());
Line 703:                     }
Line 704:                 }
Line 705:             }


Line 707:             double networkUsage = 0;
Line 708:             int networkCapacity = 0;
Line 709:             for (String nicName : usageNics) {
Line 710:                 VdsNetworkInterface iface = nicsByName.get(nicName);
Line 711:                 networkUsage +=
> pleas extract the network usage percentage computation into a method.
Done
Line 712:                         iface.getSpeed()
Line 713:                                 * 
(truncatePercentage(iface.getStatistics().getReceiveRate())
Line 714:                                         + 
truncatePercentage(iface.getStatistics().getTransmitRate()));
Line 715: 


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I71adf32f76414fe34d433177741e73529959992b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Lior Vernia <[email protected]>
Gerrit-Reviewer: Alona Kaplan <[email protected]>
Gerrit-Reviewer: Lior Vernia <[email protected]>
Gerrit-Reviewer: Moti Asayag <[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