From 65aefae1a860b0ea1038cd65aafdd90e0f0e3b2d Mon Sep 17 00:00:00 2001 From: KAMEZAWA Hiroyuki Date: Tue, 13 Dec 2011 15:12:32 +0900 Subject: [PATCH] virsh: support multifunction in attach-disk PCI 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, 9 insertions(+), 1 deletion(-) diff --git a/tools/virsh.c b/tools/virsh.c index a95784d084..f6571f72eb 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -12667,6 +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")}, {NULL, 0, 0, NULL} }; @@ -12922,9 +12924,12 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd) if (diskAddr.type == DISK_ADDR_TYPE_PCI) { virBufferAsprintf(&buf, "
\n", + " bus ='0x%02x' slot='0x%02x' function='0x%0x'", diskAddr.addr.pci.domain, diskAddr.addr.pci.bus, diskAddr.addr.pci.slot, diskAddr.addr.pci.function); + if (vshCommandOptBool(cmd, "multifunction")) + virBufferAddLit(&buf, " multifunction='on'"); + virBufferAddLit(&buf, "/>\n"); } else { vshError(ctl, "%s", _("expecting a pci:0000.00.00.00 address.")); goto cleanup; diff --git a/tools/virsh.pod b/tools/virsh.pod index d56c5d7d6d..c468f1362b 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1276,6 +1276,7 @@ the device does not use managed mode. [I<--driver driver>] [I<--subdriver subdriver>] [I<--cache cache>] [I<--type type>] [I<--mode mode>] [I<--persistent>] [I<--sourcetype soucetype>] [I<--serial serial>] [I<--shareable>] [I<--address address>] +[I<--multifunction>] Attach a new disk device to the domain. I and I are paths for the files and devices. @@ -1293,6 +1294,8 @@ I is the serial of disk device. I indicates the disk device is shareable between domains. I
is the address of disk device in the form of pci:domain.bus.slot.function, scsi:controller.bus.unit or ide:controller.bus.unit. +I indicates specified pci address is a multifunction pci device +address. =item B I I I [I<--target target>] [I<--mac mac>] [I<--script script>] [I<--model model>]