On 12/12/2011 11:12 PM, KAMEZAWA Hiroyuki wrote:
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu(a)jp.fujitsu.com>
PCI <address...> can be specified by attach-disk but multifunction cannot
be specified. add --multifunction support.
---
tools/virsh.c | 7 ++++++-
tools/virsh.pod | 3 ++-
2 files changed, 8 insertions(+), 2 deletions(-)
ACK and pushed.
diff --git a/tools/virsh.c b/tools/virsh.c
index d58b827..346b440 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -12661,6 +12661,7 @@ static const vshCmdOptDef opts_attach_disk[] = {
{"serial", VSH_OT_STRING, 0, N_("serial of disk device")},
{"shareable", VSH_OT_BOOL, 0, N_("shareable between domains")},
{"address", VSH_OT_STRING, 0, N_("address of disk device")},
+ {"multifunction", VSH_OT_BOOL, 0, N_("use multifunction pci under
specified address")},
I wrapped this to fit 80 columns.
+ if (vshCommandOptBool(cmd,
"multifunction"))
+ virBufferAsprintf(&buf, " multifunction='on'
/>\n");
+ else
+ virBufferAsprintf(&buf, " />\n");
virBufferAsprintf for a string literal is heavy-weight; I swapped this
to virBufferAddLit.
diff --git i/tools/virsh.c w/tools/virsh.c
index c2f8da3..f6571f7 100644
--- i/tools/virsh.c
+++ w/tools/virsh.c
@@ -12667,7 +12667,8 @@ static const vshCmdOptDef opts_attach_disk[] = {
{"serial", VSH_OT_STRING, 0, N_("serial of disk device")},
{"shareable", VSH_OT_BOOL, 0, N_("shareable between domains")},
{"address", VSH_OT_STRING, 0, N_("address of disk device")},
- {"multifunction", VSH_OT_BOOL, 0, N_("use multifunction pci under
specified address")},
+ {"multifunction", VSH_OT_BOOL, 0,
+ N_("use multifunction pci under specified address")},
{NULL, 0, 0, NULL}
};
@@ -12927,9 +12928,8 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
diskAddr.addr.pci.domain,
diskAddr.addr.pci.bus,
diskAddr.addr.pci.slot,
diskAddr.addr.pci.function);
if (vshCommandOptBool(cmd, "multifunction"))
- virBufferAsprintf(&buf, " multifunction='on'
/>\n");
- else
- virBufferAsprintf(&buf, " />\n");
+ virBufferAddLit(&buf, " multifunction='on'");
+ virBufferAddLit(&buf, "/>\n");
} else {
vshError(ctl, "%s", _("expecting a pci:0000.00.00.00
address."));
goto cleanup;
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org