Add option to xm create to skip DTD checks.

signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
This commit is contained in:
Tom Wilkie committed 2007-03-26 15:09:24 +01:00
1 parent dd6bd5adf4
commit 70a47391ce
2 files changed
+17 -5

No files matched your search

+9 -2
View File
@@ -104,6 +104,11 @@ gopts.opt('xmldryrun', short='x',
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,
use='Leave the domain paused after it is created.')
@@ -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:
+8 -3
View File
@@ -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)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.