Doron Fediuck has posted comments on this change.

Change subject: engine: Add validation to cpu pinning
......................................................................


Patch Set 4: (6 inline comments)

Noam, see inline.

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmManagementCommandBase.java
Line 167:                     
exclude.add(Integer.parseInt(section.substring(1)));
Line 168:                 } else if (section.contains("-")) {
Line 169:                 // include range
Line 170:                 String[] numbers = section.split("-");
Line 171:                 int start = Integer.parseInt(numbers[0]);
You have the indentation wrong here.

What happens if you get a range like this: 10-4? your min will be 10 and max 
will be 4. So maybe check start<end before the loop?

I think it would be best if the range handling will be in a separate method.

Also, you're not testing if the range includes a duplicate of previous data. 
For example: 5,3-7. In this case you can fail saying this is duplicated.
Line 172:                     int end = Integer.parseInt(numbers[1]);
Line 173:                     for (int i = start; i <= end; i++) {
Line 174:                         include.add(i);
Line 175:                     }


....................................................
File 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/VdcBllMessages.java
Line 246:     VM_CANNOT_EXPORT_RAW_FORMAT,
Line 247:     VM_PINNING_FORMAT_INVALID,
Line 248:     VM_PINNING_VCPU_DOES_NOT_EXIST,
Line 249:     VM_PINNING_PCPU_DOES_NOT_EXIST,
Line 250:     VM_PINNING_WITHOUT_DEDICATED_VDS,
Is the above needed?
Line 251:     VM_PINNING_DUPLICATE_DEFINITION,
Line 252:     VM_PINNING_PINNED_TO_NO_CPU,
Line 253:     CANNOT_PREIEW_CURRENT_IMAGE,
Line 254:     ACTION_TYPE_FAILED_XP_MEMORY_ERROR,


....................................................
File backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
Line 498: VM_CANNOT_EXPORT_RAW_FORMAT=Cannot change format to RAW on export VM.
Line 499: VM_PINNING_FORMAT_INVALID=CPU pinning format invalid.
Line 500: VM_PINNING_VCPU_DOES_NOT_EXIST=CPU pinning validation failed - 
virtual CPU does not exist in vm.
Line 501: VM_PINNING_PCPU_DOES_NOT_EXIST=CPU pinning validation failed - CPU 
does not exist in host.
Line 502: VM_PINNING_WITHOUT_DEDICATED_VDS=Cannot configure CPU pinning to a VM 
without pinning to host.
Is the above needed?
Line 503: VM_PINNING_DUPLICATE_DEFINITION=Cannot configure CPU pinning twice to 
the same vCPU.
Line 504: VM_PINNING_PINNED_TO_NO_CPU=Cannot pin a vCPU to no pCPU.
Line 505: ACTION_TYPE_FAILED_TEMPLATE_NOT_FOUND_ON_EXPORT_DOMAIN=Cannot export 
VM. Template ${TemplateName} does not exist on the export domain. if you want 
to export VM without its Template please use TemplateMustExists=false
Line 506: ACTION_TYPE_FAILED_VM_NOT_FOUND_ON_EXPORT_DOMAIN=Cannot delete VM, VM 
not exists in export domain


....................................................
Commit Message
Line 9: Validation the following conditions:
Line 10: - syntax is correct
Line 11: - all given vcpus exist (e.i vcpu number < max cpu# on vm)
Line 12: - only one definition for each vcpu
Line 13: - if defined, a vcpu is pined to at least one pcpu (e.g 0#1-2,^1,^2 
isn't valid)
pinned?
Line 14: - in cluster 3.2 verify all pcpu givem exists (e.i pcpu number < max 
thread# on host)
Line 15: *pcpu is not verified in cluster < 3.2 as we cannot know the nuber for 
sure.
Line 16: 
Line 17: Change-Id: I690b60fcde6bf337058246ef9b1ee24fa3b7220a


Line 10: - syntax is correct
Line 11: - all given vcpus exist (e.i vcpu number < max cpu# on vm)
Line 12: - only one definition for each vcpu
Line 13: - if defined, a vcpu is pined to at least one pcpu (e.g 0#1-2,^1,^2 
isn't valid)
Line 14: - in cluster 3.2 verify all pcpu givem exists (e.i pcpu number < max 
thread# on host)
givem?
Line 15: *pcpu is not verified in cluster < 3.2 as we cannot know the nuber for 
sure.
Line 16: 
Line 17: Change-Id: I690b60fcde6bf337058246ef9b1ee24fa3b7220a
Line 18: Bug-Url: https://bugzilla.redhat.com/871726


....................................................
File 
frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
Line 494: VM_CANNOT_EXPORT_RAW_FORMAT=Cannot change format to RAW on export VM.
Line 495: VM_PINNING_FORMAT_INVALID=CPU pinning format invalid.
Line 496: VM_PINNING_VCPU_DOES_NOT_EXIST=CPU pinning validation failed - 
virtual CPU does not exist in vm.
Line 497: VM_PINNING_PCPU_DOES_NOT_EXIST=CPU pinning validation failed - CPU 
does not exist in host.
Line 498: VM_PINNING_WITHOUT_DEDICATED_VDS=Cannot configure CPU pinning to a VM 
without pinning to host.
Is the above needed?
Line 499: VM_PINNING_DUPLICATE_DEFINITION=Cannot configure CPU pinning twice to 
the same vCPU.
Line 500: VM_PINNING_PINNED_TO_NO_CPU=Cannot pin a vCPU to no pCPU.
Line 501: ACTION_TYPE_FAILED_TEMPLATE_NOT_FOUND_ON_EXPORT_DOMAIN=Cannot export 
VM. Template ${TemplateName} does not exist on the export domain. if you want 
to export VM without its Template please use TemplateMustExists=false
Line 502: ACTION_TYPE_FAILED_VM_NOT_FOUND_ON_EXPORT_DOMAIN=Cannot delete VM, VM 
not exists in export domain


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I690b60fcde6bf337058246ef9b1ee24fa3b7220a
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Noam Slomianko <nslom...@redhat.com>
Gerrit-Reviewer: Andrew Cathrow <and...@cathrow.com>
Gerrit-Reviewer: Doron Fediuck <dfedi...@redhat.com>
Gerrit-Reviewer: Einav Cohen <eco...@redhat.com>
Gerrit-Reviewer: Liron Aravot <lara...@redhat.com>
Gerrit-Reviewer: Noam Slomianko <nslom...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to