# HG changeset patch
# User Tom Wilkie <tom.wilkie@xxxxxxxxx>
# Date 1174918164 -3600
# Node ID 3b2efc3cf6b60837f3ac527fce34bfd07dedf9e0
# Parent d01e7ace9d2c27d652d624a313fe9d3224aae1b1
Add option to xm create to skip DTD checks.
signed-off-by: Tom Wilkie <tom.wilkie@xxxxxxxxx>
---
tools/python/xen/xm/create.py | 11 +++++++++--
tools/python/xen/xm/xenapi_create.py | 11 ++++++++---
2 files changed, 17 insertions(+), 5 deletions(-)
diff -r d01e7ace9d2c -r 3b2efc3cf6b6 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py Mon Mar 26 14:57:12 2007 +0100
+++ b/tools/python/xen/xm/create.py Mon Mar 26 15:09:24 2007 +0100
@@ -103,6 +103,11 @@ gopts.opt('xmldryrun', short='x',
fn=set_true, default=0,
use="XML dry run - prints the resulting configuration in XML but "
"does not create the domain.")
+
+gopts.opt('skipdtd', short='s',
+ fn=set_true, default=0,
+ use="Skip DTD checking - skips checks on XML before creating. "
+ " Experimental. Can decreate create time." )
gopts.opt('paused', short='p',
fn=set_true, default=0,
@@ -1279,9 +1284,11 @@ def main(argv):
from xen.xm.xenapi_create import xenapi_create
xenapi_create_inst = xenapi_create()
if opts.is_xml:
- vm_refs = xenapi_create_inst.create(filename = config)
+ vm_refs = xenapi_create_inst.create(filename = config,
+ skipdtd = opts.vals.skipdtd)
else:
- vm_refs = xenapi_create_inst.create(document = doc)
+ vm_refs = xenapi_create_inst.create(document = doc,
+ skipdtd = opts.vals.skipdtd)
map(lambda vm_ref: server.xenapi.VM.start(vm_ref, 0), vm_refs)
elif not opts.is_xml:
diff -r d01e7ace9d2c -r 3b2efc3cf6b6 tools/python/xen/xm/xenapi_create.py
--- a/tools/python/xen/xm/xenapi_create.py Mon Mar 26 14:57:12 2007 +0100
+++ b/tools/python/xen/xm/xenapi_create.py Mon Mar 26 15:09:24 2007 +0100
@@ -75,15 +75,20 @@ class xenapi_create:
self.dtd = "/usr/lib/python/xen/xm/create.dtd"
- def create(self, filename=None, document=None):
+ def create(self, filename=None, document=None, skipdtd=False):
"""
Create a domain from an XML file or DOM tree
"""
+ if skipdtd:
+ print "Skipping DTD checks. Dangerous!"
+
if filename is not None:
- self.check_dtd(filename)
+ if not skipdtd:
+ self.check_dtd(filename)
document = parse(filename)
elif document is not None:
- self.check_dom_against_dtd(document)
+ if not skipdtd:
+ self.check_dom_against_dtd(document)
self.check_doc(document)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|