The VM metadata export handler (/export_metadata) will output the metadata
of a VM, all its snapshots, and all their attached VDIs. However, it doesn't
walk the tree of VDIs defined by the VDI.sm_config["vhd_parent"] field. For
a full-fidelity representation, having the parent VDIs is very useful.
This patch adds an "include_vhd_parents=(true|false)" option to the the
/export_metadata handler. With this option on, the entire tree of VDIs is
exported.
This patch does not change the /export URL handler, does not change any
behaviour when include_vhd_parents is false or missing, and copes gracefully
with a missing or malformed vhd_parent entry.
Dave: modified to be robust to vhd parent cycles
Signed-off-by: Ewan Mellor <ewan.mellor@eu.citrix.com> Signed-off-by: Dave Scott <dave.scott@eu.citrix.com>