Moti Asayag has posted comments on this change.

Change subject: core: Changes type of VmDevice from String to enum
......................................................................


Patch Set 1: (3 inline comments)

....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmDeviceGeneralType.java
Line 1: package org.ovirt.engine.core.common.businessentities;
Line 2: 
Line 3: /**
Line 4:  * General types of devices recognized by VDSM
Line 5:  */
After this file was introduced, do we need all of the overlapping values from 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmDeviceType.java
 ?
Line 6: public enum VmDeviceGeneralType {
Line 7:     /**
Line 8:      * A hard disk, floppy or cdrom device
Line 9:      */


Line 52:     /**
Line 53:      * Converts enum type to string value to save in database
Line 54:      */
Line 55:     public String getValue() {
Line 56:         return name().toLowerCase();
wouldn't it be preferred to store the value of each type in lower case instead 
of creating it each time this method invoked ?
Line 57:     }
Line 58: 
Line 59:     /**
Line 60:      * Converts string representation to enum value


....................................................
File 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfReader.java
Line 207:             
vmDevice.setSpecParams(Collections.<String,Object>emptyMap());
Line 208:         }
Line 209:         if (node.SelectSingleNode(OvfProperties.VMD_TYPE, _xmlNS) != 
null
Line 210:                 && 
!StringUtils.isEmpty(node.SelectSingleNode(OvfProperties.VMD_TYPE, 
_xmlNS).InnerText)) {
Line 211:             
vmDevice.setType(VmDeviceGeneralType.forValue(String.valueOf(node.SelectSingleNode(OvfProperties.VMD_TYPE,
 _xmlNS).InnerText)));
Doesn't it mean every device which isn't supported by VDSM (as noted on 
VmDeviceGeneralType) will cause the import to fail ?

I think this changes the behavior as were before, and if we wish to have it - 
it should be documented.
Line 212:         } else {
Line 213:             int resourceType = getResourceType(node, 
OvfProperties.VMD_RESOURCE_TYPE);
Line 214:             
vmDevice.setType(VmDeviceGeneralType.forValue(VmDeviceType.getoVirtDevice(resourceType).getName()));
Line 215:         }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icada39e3918fb053cb0ad0388178ccf5c6338ca2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Peřina <mper...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Alona Kaplan <alkap...@redhat.com>
Gerrit-Reviewer: Arik Hadas <aha...@redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skriva...@redhat.com>
Gerrit-Reviewer: Moti Asayag <masa...@redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com>
Gerrit-Reviewer: Roy Golan <rgo...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to