1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-11 09:17:52 +03:00

virsh: domain: Don't use vshPrepareDiskXML for creating XML to detach disk

Since cmdDetachDisk() calls into vshPrepareDiskXML() with
type == VSH_PREPARE_DISK_XML_NONE && source == NULL this would result
into skipping all the checks and effectively turn the function into a
XML formatter.

This patch changes the code to use the formatter directly so that the
function can be refactored in a easier way.
This commit is contained in:
Peter Krempa 2015-03-12 11:51:51 +01:00
parent 50bdad6678
commit 1cc820937a

View File

@ -11365,9 +11365,10 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd)
if (!(disk_node = vshFindDisk(doc, target, VSH_FIND_DISK_NORMAL)))
goto cleanup;
if (!(disk_xml = vshPrepareDiskXML(disk_node, NULL, NULL,
VSH_PREPARE_DISK_XML_NONE)))
if (!(disk_xml = virXMLNodeToString(NULL, disk_node))) {
vshSaveLibvirtError();
goto cleanup;
}
if (flags != 0 || current)
ret = virDomainDetachDeviceFlags(dom, disk_xml, flags);