Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
3e865c3b
authored
Jul 21, 2014
by
Guba Sándor
Committed by
Őry Máté
Jul 28, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add basic libvirt domain validator
parent
165eb1d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
circle/dashboard/virtvalidator.py
+20
-0
No files found.
circle/dashboard/virtvalidator.py
0 → 100644
View file @
3e865c3b
from
django.core.exceptions
import
ValidationError
from
lxml
import
etree
as
ET
rng_file
=
"/usr/share/libvirt/schemas/domain.rng"
header
=
"""<domain type='kvm'>
<name>validator</name>
<memory unit='KiB'>1024</memory>
<os>
<type>hvm</type>
</os>"""
footer
=
"""</domain>"""
def
domain_validator
(
value
):
xml
=
header
+
value
+
footer
relaxng
=
ET
.
RelaxNG
(
file
=
rng_file
)
if
not
relaxng
.
validate
(
ET
.
fromstring
(
xml
)):
raise
ValidationError
(
"
%
s is not valid libvirt Domain xml."
%
value
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment