Simple method for troubleshooting / doing introspection of xen j2 templates

I’m doing some customization of the templates (xen.xml, pci.xml, block.xml, …)

Because I’ve worked with Jinja2 before, I was able to have some quick success with some simple modifications (related to CPU affinity and i/o settings

I’m considering some more involved customizations and was wondering if there are any simple tricks for doing introspection or troubleshooting/debugging while doing this

Things I would like to do:

  • dump the full contents of some of the objects- ideally, the entire “vm” object. Using documentation to see what’s available in that context is slow and very incomplete. Determining what is available by reading the code is also challenging, it wasn’t immediately clear to me what variables were available based on the code
  • test modifications to templates quickly and incrementally - rather than needing to continuously power on a vm to see if it renders or throws an error

I have plenty of experience with Python development, so I figured one option would be patching the Python that renders the template, to make it dump all the variables given to the render function

I’m not sure how to properly validate the xml, short of trying to power on the vm. I suppose I could at least patch to write the rendered xml to a file and xmllint it, as a basic validation

Any easier or more correct ways of approaching this? Is there a test harness, or am I on my own for this?

Thanks