Add --sharable option for attach-disk to allow user to specify whether
the disk device is sharable between domains when attaching a disk
device from virsh command line.
---
tools/virsh.c | 4 ++++
tools/virsh.pod | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index c30f333..095eede 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -10182,6 +10182,7 @@ static const vshCmdOptDef opts_attach_disk[] = {
{"persistent", VSH_OT_BOOL, 0, N_("persist disk attachment")},
{"sourcetype", VSH_OT_STRING, 0, N_("type of source
(block|file)")},
{"serial", VSH_OT_STRING, 0, N_("serial of disk device")},
+ {"shareable", VSH_OT_BOOL, 0, N_("shareable between domains")},
{NULL, 0, 0, NULL}
};
@@ -10271,6 +10272,9 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
if (serial)
virBufferAsprintf(&buf, " <serial>%s</serial>\n",
serial);
+ if (vshCommandOptBool(cmd, "shareable"))
+ virBufferAsprintf(&buf, " <shareable/>\n");
+
virBufferAddLit(&buf, "</disk>\n");
if (virBufferError(&buf)) {
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 95e7744..401f3c6 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -876,7 +876,7 @@ the single existing device; consider using B<update-device> for
this usage.
=item B<attach-disk> I<domain-id> I<source> I<target> optional
I<--driver driver> I<--subdriver subdriver> I<--cache cache>
I<--type type> I<--mode mode> I<--persistent> I<--sourcetype
soucetype>
-I<--serial serial>
+I<--serial serial> I<--shareable>
Attach a new disk device to the domain.
I<source> and I<target> are paths for the files and devices.
@@ -888,7 +888,8 @@ I<mode> can specify the two specific mode I<readonly> or
I<shareable>.
I<persistent> indicates the changes will affect the next boot of the domain.
I<sourcetype> can indicate the type of source (block|file)
I<cache> can be one of "default", "none",
"writethrough" or "writeback".
-I<serial> is the serial of disk device.
+I<serial> is the serial of disk device. I<shareable> indicates the disk
device
+is shareable between domains.
=item B<attach-interface> I<domain-id> I<type> I<source>
optional
I<--target target> I<--mac mac> I<--script script> I<--model
model>
--
1.7.5.1