Bug 917485
| Summary: | Exception was shown when setting NTP Server/NFS kdump with valid value. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Retired] oVirt | Reporter: | haiyang,dong <hadong> | ||||
| Component: | ovirt-node | Assignee: | Fabian Deutsch <fdeutsch> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | bugs <bugs> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 3.2 | CC: | acathrow, cshao, fdeutsch, gouyang, hadong, jboggs, leiwang, mgoldboi, ovirt-bugs, ovirt-maint, ycui | ||||
| Target Milestone: | --- | ||||||
| Target Release: | 3.4.1 | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | node | ||||||
| Fixed In Version: | ovirt-node-3.0.0 | Doc Type: | Bug Fix | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2014-04-30 10:51:39 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: | |||||||
| Attachments: |
|
||||||
Maybe the root cause happens here, but i'm not sure about it:
>>> FQDN().validate("example.com")
True
>>> FQDN().validate("0.rhel.pool.ntp.org")
False
So for ntp server "0.rhel.pool.ntp.org", it return "False", but actually "0.rhel.pool.ntp.org" is valid ntp server.
Change the class FQDN(RegexValidator) into follow can fix the issue:
class FQDN(RegexValidator):
description = "a valid FQDN"
# pattern = ("^(([a-z]|[a-z][a-z0-9\-]*[a-z0-9])\.)" +
# "*([a-z]|[a-z][a-z0-9\-]*[a-z0-9])$", re.I)
pattern = ("^(([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)" +
"*([a-z]|[a-z][a-z0-9\-]*[a-z0-9])$", re.I)
>>> FQDN().validate("example.com")
True
>>> FQDN().validate("0.rhel.pool.ntp.org")
True
>>> FQDN().validate("0.Rhel0.pool.ntp.org"
True
>>> FQDN().validate("example.com.")
False
>>> FQDN().validate("")
False
(In reply to comment #3) > Maybe the root cause happens here, but i'm not sure about it: > > >>> FQDN().validate("example.com") > True > >>> FQDN().validate("0.rhel.pool.ntp.org") > False > > So for ntp server "0.rhel.pool.ntp.org", it return "False", but actually > "0.rhel.pool.ntp.org" is valid ntp server. > > > Change the class FQDN(RegexValidator) into follow can fix the issue: > > class FQDN(RegexValidator): > > description = "a valid FQDN" > # pattern = ("^(([a-z]|[a-z][a-z0-9\-]*[a-z0-9])\.)" + > # "*([a-z]|[a-z][a-z0-9\-]*[a-z0-9])$", re.I) > pattern = ("^(([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)" + > "*([a-z]|[a-z][a-z0-9\-]*[a-z0-9])$", re.I) > > > >>> FQDN().validate("example.com") > True > >>> FQDN().validate("0.rhel.pool.ntp.org") > True > >>> FQDN().validate("0.Rhel0.pool.ntp.org" > True > >>> FQDN().validate("example.com.") > False > >>> FQDN().validate("") > False Nice catch, I'll look into it .. This patch should also attack this problem (in addition to the patch above): http://gerrit.ovirt.org/#/c/12733/ Hey fabian,
Using the iso "ovirt-node-iso-3.0.0-1.0.20130517.fc18" to setting NTP Server/NFS kdump with valid value, it work well for setting NTP Server with valid value.
But still failed for setting NFS kdump with valid value(10.66.11.23:/var/nfsserver).
I was confused that the line 796 of the follow code in defaults.py
794 @NodeConfigFileSection.map_and_update_defaults_decorator
795 def update(self, nfs, ssh, local):
796 (valid.Empty(or_none=True) | valid.FQDNOrIPAddress())(nfs)
797 (valid.Empty(or_none=True) | valid.URL())(ssh)
798 (valid.Empty(or_none=True) | valid.Boolean())(local)
799 return {"OVIRT_KDUMP_LOCAL": "true" if local else None
800 }
why using the function "FQDNOrIPAddress" to check the nfs value is valid or not:
>>> valid.FQDNOrIPAddress()("10.66.11.23:/var/nfsserver")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/ovirt/node/valid.py", line 63, in __call__
File "/usr/lib/python2.7/site-packages/ovirt/node/valid.py", line 69, in raise_exception
ovirt.node.exceptions.InvalidData: 'The field must contain a valid FQDN or a valid IPv4 address or a valid IPv6 address.'
>>>
Hey Haiyang, I suppose my patch was incomplete. A validator for a NFS address needs to be added. http://gerrit.ovirt.org/15034 I've added doctests to test all sorts of nfs urls, would be nice, if you, Haiyang, could tak a look at the patch and see if I missed an important corner case in the doctest (so addresses to be validated) This is an automated message. Re-targeting all non-blocker bugs still open on 3.4.0 to 3.4.1. |
Created attachment 704783 [details] attached Screenshot for exception Description of problem: Install ovirt-node-upstream, configure network with "static", enter network page, then setting NTP Server with valid ip address. But Exception was shown after clicking "Save" button.(Seen exception.png) Also Exception was shown when configure NFS kdump with valid value. Version-Release number of selected component (if applicable): ovirt-node-iso-2.6.1-20120228.fc18.iso Steps to Reproduce: 1. Install ovirt-node-upstream, configure network with "static". 2. enter network page, then setting NTP Server with valid ip address. Actual results: Exception was shown after clicking "Save" button. Expected results: setting NTP Server with valid value should be successful. Additional info: ----------