diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 8adec1d9b1..a6fd1ceb2d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -290,6 +290,10 @@ static const vshCmdOptDef opts_attach_disk[] = { .type = VSH_OT_STRING, .help = N_("wwn of disk device") }, + {.name = "alias", + .type = VSH_OT_STRING, + .help = N_("custom alias name of disk device") + }, {.name = "rawio", .type = VSH_OT_BOOL, .help = N_("needs rawio capability") @@ -574,7 +578,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd) *subdriver = NULL, *type = NULL, *mode = NULL, *iothread = NULL, *cache = NULL, *io = NULL, *serial = NULL, *straddr = NULL, *wwn = NULL, - *targetbus = NULL; + *targetbus = NULL, *alias = NULL; struct DiskAddress diskAddr; bool isFile = false, functionReturn = false; int ret; @@ -611,6 +615,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd) vshCommandOptStringReq(ctl, cmd, "wwn", &wwn) < 0 || vshCommandOptStringReq(ctl, cmd, "address", &straddr) < 0 || vshCommandOptStringReq(ctl, cmd, "targetbus", &targetbus) < 0 || + vshCommandOptStringReq(ctl, cmd, "alias", &alias) < 0 || vshCommandOptStringReq(ctl, cmd, "sourcetype", &stype) < 0) goto cleanup; @@ -680,6 +685,9 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd) if (serial) virBufferAsprintf(&buf, "%s\n", serial); + if (alias) + virBufferAsprintf(&buf, "", alias); + if (wwn) virBufferAsprintf(&buf, "%s\n", wwn); diff --git a/tools/virsh.pod b/tools/virsh.pod index 9ac4946337..a7fb8ab82c 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -3032,7 +3032,7 @@ expected. =item B I I I [[[I<--live>] [I<--config>] | [I<--current>]] | [I<--persistent>]] [I<--targetbus bus>] [I<--driver driver>] [I<--subdriver subdriver>] [I<--iothread iothread>] -[I<--cache cache>] [I<--io io>] [I<--type type>] +[I<--cache cache>] [I<--io io>] [I<--type type>] [I<--alias alias>] [I<--mode mode>] [I<--sourcetype sourcetype>] [I<--serial serial>] [I<--wwn wwn>] [I<--rawio>] [I<--address address>] [I<--multifunction>] [I<--print-xml>] @@ -3055,6 +3055,7 @@ disk formats. I can indicate I, I or I as alternative to the disk default, although this use only replaces the media within the existing virtual cdrom or floppy device; consider using B for this usage instead. +I can set user supplied alias. I can specify the two specific mode I or I. I can indicate the type of source (block|file) I can be one of "default", "none", "writethrough", "writeback",