Add MIGRATABLE flag for virDomainGetXMLDesc

Using VIR_DOMAIN_XML_MIGRATABLE flag, one can request domain's XML
configuration that is suitable for migration or save/restore. Such XML
may contain extra run-time stuff internal to libvirt and some default
configuration may be removed for better compatibility of the XML with
older libvirt releases.

This flag may serve as an easy way to get the XML that can be passed
(after desired modifications) to APIs that accept custom XMLs, such as
virDomainMigrate{,ToURI}2 or virDomainSaveFlags.
This commit is contained in:
Jiri Denemark
2012-10-08 11:58:05 +02:00
parent edc9269a2a
commit 28f8dfdccc
9 changed files with 47 additions and 41 deletions

View File

@@ -6399,6 +6399,7 @@ static const vshCmdOptDef opts_dumpxml[] = {
{"inactive", VSH_OT_BOOL, 0, N_("show inactive defined XML")},
{"security-info", VSH_OT_BOOL, 0, N_("include security sensitive information in XML dump")},
{"update-cpu", VSH_OT_BOOL, 0, N_("update guest CPU according to host CPU")},
{"migratable", VSH_OT_BOOL, 0, N_("provide XML suitable for migrations")},
{NULL, 0, 0, NULL}
};
@@ -6412,6 +6413,7 @@ cmdDumpXML(vshControl *ctl, const vshCmd *cmd)
bool inactive = vshCommandOptBool(cmd, "inactive");
bool secure = vshCommandOptBool(cmd, "security-info");
bool update = vshCommandOptBool(cmd, "update-cpu");
bool migratable = vshCommandOptBool(cmd, "migratable");
if (inactive)
flags |= VIR_DOMAIN_XML_INACTIVE;
@@ -6419,6 +6421,8 @@ cmdDumpXML(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_DOMAIN_XML_SECURE;
if (update)
flags |= VIR_DOMAIN_XML_UPDATE_CPU;
if (migratable)
flags |= VIR_DOMAIN_XML_MIGRATABLE;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;

View File

@@ -948,7 +948,7 @@ NOTE: Some hypervisors may require the user to manually ensure proper
permissions on file and path specified by argument I<corefilepath>.
=item B<dumpxml> I<domain> [I<--inactive>] [I<--security-info>]
[I<--update-cpu>]
[I<--update-cpu>] [I<--migratable>]
Output the domain information as an XML dump to stdout, this format can be used
by the B<create> command. Additional options affecting the XML dump may be
@@ -956,7 +956,10 @@ used. I<--inactive> tells virsh to dump domain configuration that will be used
on next start of the domain as opposed to the current domain configuration.
Using I<--security-info> will also include security sensitive information
in the XML dump. I<--update-cpu> updates domain CPU requirements according to
host CPU.
host CPU. With I<--migratable> one can request an XML that is suitable for
migrations, i.e., compatible with older libvirt releases and possibly amended
with internal run-time options. This option may automatically enable other
options (I<--update-cpu>, I<--security-info>, ...) as necessary.
=item B<edit> I<domain>