Arik Hadas has posted comments on this change.

Change subject: restapi,engine: fix usb mapping on update vm call
......................................................................


Patch Set 1: (3 inline comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java
Line 422:             VDSGroup vdsGroup,
Line 423:             List<String> messages) {
Line 424:         boolean retVal = true;
Line 425:         if (usbPolicy == null) {
Line 426:             
messages.add(VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_USB_POLICY.toString());
you're right by saying that calling "name()" is better that "toString()" as it 
ensures the returned string is the exactly as declared in the enum declaration, 
but the code is full of calls to toString method of VdcBllMessages and it seems 
wrong to make something different here. so I override VdcBllMessages#toString 
to ensure that the exact name is returned from the toString method also
Line 427:             retVal = false;
Line 428:         } else if (UsbPolicy.ENABLED_NATIVE.equals(usbPolicy)) {
Line 429:             if (!Config.<Boolean> 
GetValue(ConfigValues.NativeUSBEnabled, vdsGroup.getcompatibility_version()
Line 430:                     .getValue())) {


....................................................
File 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/utils/UsbResourceUtils.java
Line 40:                 if (currentPolicy == UsbPolicy.DISABLED) {
Line 41:                     return currentPolicy;
Line 42:                 }
Line 43:                 else {
Line 44:                     UsbType usbType = UsbType.fromValue(usb.getType());
Done
Line 45:                     return mapUsbTypeToPolicy(usbType);
Line 46:                 }
Line 47:             }
Line 48:             else {


Line 53:             if (!usb.isEnabled())
Line 54:                 return UsbPolicy.DISABLED;
Line 55:             else {
Line 56:                 if (usb.isSetType()) {
Line 57:                     UsbType usbType = UsbType.fromValue(usb.getType());
Done
Line 58:                     return mapUsbTypeToPolicy(usbType);
Line 59:                 }
Line 60:                 else {
Line 61:                     return currentPolicy == UsbPolicy.DISABLED ? null 
: currentPolicy;


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

Gerrit-MessageType: comment
Gerrit-Change-Id: If74bf6ede2fc0f932db8dfcd7951b6bcf90b7744
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <aha...@redhat.com>
Gerrit-Reviewer: Arik Hadas <aha...@redhat.com>
Gerrit-Reviewer: Michael Pasternak <mpast...@redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com>
Gerrit-Reviewer: Roy Golan <rgo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to