Bug 1046611

Summary: [oVirt][infra] Device custom properties syntax check is wrong
Product: [Retired] oVirt Reporter: Mike Kolesnik <mkolesni>
Component: ovirt-engine-coreAssignee: Martin Perina <mperina>
Status: CLOSED CURRENTRELEASE QA Contact: movciari
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.3CC: acathrow, emesika, iheim, talayan, yeylon, yzaslavs
Target Milestone: ---   
Target Release: 3.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: ovirt-3.4.0-beta1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-31 12:28:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mike Kolesnik 2013-12-26 10:16:33 UTC
Description of problem:
Trying to set an empty custom property results in an error on the engine: 
2013-12-26 09:55:46,700 WARN  [org.ovirt.engine.core.bll.network.vm.UpdateVnicProfileCommand] (http-/0.0.0.0:8080-1) [246beb72] CanDoAction of action UpdateVnicProfile failed. Reasons:VAR__TYPE__VNIC_PROFILE,VAR__ACTION__UPDATE,ACTION_TYPE_FAILED_INVALID_CUSTOM_PROPERTIES_INVALID_SYNTAX



Version-Release number of selected component (if applicable):


How reproducible:
Always


Steps to Reproduce:
1. Create a custom property allowing an empty value, such as:
engine-config -s CustomDeviceProperties="{type=interface;prop={someProp=([a-z0-9A-Z]*)$}}" --cver=3.3
2. Add a network on a 3.3 data center.
3. Add a network profile and on the dialog select your "someProp" property but don't enter any value.
4. Click OK to add the profile.

Actual results:
You will get an error "Error while executing action: Cannot edit VM network interface profile if custom properties are in invalid format. Please check the input."


Expected results:
The profile should be saved without error.


Additional info:
The error comes from a check in org.ovirt.engine.core.utils.customprop.DevicePropertiesUtils.validateProperties(Version, VmDeviceGeneralType, Map<String, String>)

This method invokes syntaxErrorInProperties(properties) which is meant for checking the property definition in the configuration, not the actual uasge of the properties and their conformity to the syntax (this check is done later in the validateProperties method).

This should probably be fixed also for other usages of custom properties.

Comment 1 Martin Perina 2014-01-06 05:42:41 UTC
Device custom properties syntax is inherited from VM properties syntax, which requires that defined property always has non-empty value. So do we want to allow properties with empty value? If so, should it be allowed for both device and VM properties?

Comment 2 Yair Zaslavsky 2014-01-06 09:54:24 UTC
Martin the set of possible values is defined by the regex. If the regex matches an empty string (empty value) we should allow storing empty value.

Comment 3 Sandro Bonazzola 2014-03-31 12:28:12 UTC
this is an automated message: moving to Closed CURRENT RELEASE since oVirt 3.4.0 has been released