mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virsh: domain: Add --print-xml flag for command change-media
Allow printing the XML that would be used mostly for debugging purposes.
This commit is contained in:
parent
1cc820937a
commit
4cbcaffb74
@ -12274,6 +12274,10 @@ static const vshCmdOptDef opts_change_media[] = {
|
|||||||
.type = VSH_OT_BOOL,
|
.type = VSH_OT_BOOL,
|
||||||
.help = N_("force media changing")
|
.help = N_("force media changing")
|
||||||
},
|
},
|
||||||
|
{.name = "print-xml",
|
||||||
|
.type = VSH_OT_BOOL,
|
||||||
|
.help = N_("print XML document rather than change media")
|
||||||
|
},
|
||||||
{.name = NULL}
|
{.name = NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -12354,12 +12358,17 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(disk_xml = vshPrepareDiskXML(disk_node, source, path, prepare_type)))
|
if (!(disk_xml = vshPrepareDiskXML(disk_node, source, path, prepare_type)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virDomainUpdateDeviceFlags(dom, disk_xml, flags) != 0) {
|
if (vshCommandOptBool(cmd, "print-xml")) {
|
||||||
vshError(ctl, _("Failed to complete action %s on media"), action);
|
vshPrint(ctl, "%s", disk_xml);
|
||||||
goto cleanup;
|
} else {
|
||||||
|
if (virDomainUpdateDeviceFlags(dom, disk_xml, flags) != 0) {
|
||||||
|
vshError(ctl, _("Failed to complete action %s on media"), action);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
vshPrint(ctl, _("succeeded to complete action %s on media\n"), action);
|
||||||
}
|
}
|
||||||
|
|
||||||
vshPrint(ctl, _("succeeded to complete action %s on media\n"), action);
|
|
||||||
ret = true;
|
ret = true;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -2597,6 +2597,7 @@ expected.
|
|||||||
|
|
||||||
=item B<change-media> I<domain> I<path> [I<--eject>] [I<--insert>]
|
=item B<change-media> I<domain> I<path> [I<--eject>] [I<--insert>]
|
||||||
[I<--update>] [I<source>] [I<--force>] [[I<--live>] [I<--config>] | [I<--current>]]
|
[I<--update>] [I<source>] [I<--force>] [[I<--live>] [I<--config>] | [I<--current>]]
|
||||||
|
[I<--print-xml>]
|
||||||
|
|
||||||
Change media of CDROM or floppy drive. I<path> can be the fully-qualified path
|
Change media of CDROM or floppy drive. I<path> can be the fully-qualified path
|
||||||
or the unique target name (<target dev='hdc'>) of the disk device. I<source>
|
or the unique target name (<target dev='hdc'>) of the disk device. I<source>
|
||||||
@ -2620,6 +2621,8 @@ the hypervisor's implementation.
|
|||||||
Both I<--live> and I<--config> flags may be given, but I<--current> is
|
Both I<--live> and I<--config> flags may be given, but I<--current> is
|
||||||
exclusive. If no flag is specified, behavior is different depending
|
exclusive. If no flag is specified, behavior is different depending
|
||||||
on hypervisor.
|
on hypervisor.
|
||||||
|
If I<--print-xml> is specified, the XML that would be used to change media is
|
||||||
|
printed instead of changing the media.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user