提交 5b474026 编写于 作者: P Peter Krempa

virsh: Don't generate invalid XML in attach-disk command

The attach-disk command used with parameter --cache created an invalid
XML snippet as the beginning of the <driver> element was not printed
when used solely with --cache and no other attribute to driver.
上级 1f145b2f
......@@ -14765,18 +14765,18 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
virBufferAddLit(&buf, " rawio='yes'");
virBufferAddLit(&buf, ">\n");
if (driver || subdriver)
if (driver || subdriver || cache) {
virBufferAsprintf(&buf, " <driver");
if (driver)
virBufferAsprintf(&buf, " name='%s'", driver);
if (subdriver)
virBufferAsprintf(&buf, " type='%s'", subdriver);
if (cache)
virBufferAsprintf(&buf, " cache='%s'", cache);
if (driver)
virBufferAsprintf(&buf, " name='%s'", driver);
if (subdriver)
virBufferAsprintf(&buf, " type='%s'", subdriver);
if (cache)
virBufferAsprintf(&buf, " cache='%s'", cache);
if (driver || subdriver || cache)
virBufferAddLit(&buf, "/>\n");
}
if (source)
virBufferAsprintf(&buf, " <source %s='%s'/>\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册