提交 1cc82093 编写于 作者: P Peter Krempa

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.
上级 50bdad66
...@@ -11365,9 +11365,10 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd) ...@@ -11365,9 +11365,10 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd)
if (!(disk_node = vshFindDisk(doc, target, VSH_FIND_DISK_NORMAL))) if (!(disk_node = vshFindDisk(doc, target, VSH_FIND_DISK_NORMAL)))
goto cleanup; goto cleanup;
if (!(disk_xml = vshPrepareDiskXML(disk_node, NULL, NULL, if (!(disk_xml = virXMLNodeToString(NULL, disk_node))) {
VSH_PREPARE_DISK_XML_NONE))) vshSaveLibvirtError();
goto cleanup; goto cleanup;
}
if (flags != 0 || current) if (flags != 0 || current)
ret = virDomainDetachDeviceFlags(dom, disk_xml, flags); ret = virDomainDetachDeviceFlags(dom, disk_xml, flags);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册