mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
virsh: Allow attach-disk to specify disk wwn
Commit 6e73850b01ee support to set wwn for disks, but it was not exposed to attach-disk.
This commit is contained in:
parent
a83b77dd73
commit
232240d095
@ -307,6 +307,10 @@ static const vshCmdOptDef opts_attach_disk[] = {
|
|||||||
.type = VSH_OT_STRING,
|
.type = VSH_OT_STRING,
|
||||||
.help = N_("serial of disk device")
|
.help = N_("serial of disk device")
|
||||||
},
|
},
|
||||||
|
{.name = "wwn",
|
||||||
|
.type = VSH_OT_STRING,
|
||||||
|
.help = N_("wwn of disk device")
|
||||||
|
},
|
||||||
{.name = "shareable",
|
{.name = "shareable",
|
||||||
.type = VSH_OT_BOOL,
|
.type = VSH_OT_BOOL,
|
||||||
.help = N_("shareable between domains")
|
.help = N_("shareable between domains")
|
||||||
@ -499,7 +503,8 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virDomainPtr dom = NULL;
|
virDomainPtr dom = NULL;
|
||||||
const char *source = NULL, *target = NULL, *driver = NULL,
|
const char *source = NULL, *target = NULL, *driver = NULL,
|
||||||
*subdriver = NULL, *type = NULL, *mode = NULL,
|
*subdriver = NULL, *type = NULL, *mode = NULL,
|
||||||
*cache = NULL, *serial = NULL, *straddr = NULL;
|
*cache = NULL, *serial = NULL, *straddr = NULL,
|
||||||
|
*wwn = NULL;
|
||||||
struct DiskAddress diskAddr;
|
struct DiskAddress diskAddr;
|
||||||
bool isFile = false, functionReturn = false;
|
bool isFile = false, functionReturn = false;
|
||||||
int ret;
|
int ret;
|
||||||
@ -538,6 +543,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
|
|||||||
vshCommandOptStringReq(ctl, cmd, "mode", &mode) < 0 ||
|
vshCommandOptStringReq(ctl, cmd, "mode", &mode) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "cache", &cache) < 0 ||
|
vshCommandOptStringReq(ctl, cmd, "cache", &cache) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "serial", &serial) < 0 ||
|
vshCommandOptStringReq(ctl, cmd, "serial", &serial) < 0 ||
|
||||||
|
vshCommandOptStringReq(ctl, cmd, "wwn", &wwn) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "address", &straddr) < 0 ||
|
vshCommandOptStringReq(ctl, cmd, "address", &straddr) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "sourcetype", &stype) < 0)
|
vshCommandOptStringReq(ctl, cmd, "sourcetype", &stype) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -564,6 +570,9 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wwn && !virValidateWWN(wwn))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
/* Make XML of disk */
|
/* Make XML of disk */
|
||||||
virBufferAsprintf(&buf, "<disk type='%s'",
|
virBufferAsprintf(&buf, "<disk type='%s'",
|
||||||
(isFile) ? "file" : "block");
|
(isFile) ? "file" : "block");
|
||||||
@ -597,6 +606,9 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (serial)
|
if (serial)
|
||||||
virBufferAsprintf(&buf, " <serial>%s</serial>\n", serial);
|
virBufferAsprintf(&buf, " <serial>%s</serial>\n", serial);
|
||||||
|
|
||||||
|
if (wwn)
|
||||||
|
virBufferAsprintf(&buf, " <wwn>%s</wwn>\n", wwn);
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "shareable"))
|
if (vshCommandOptBool(cmd, "shareable"))
|
||||||
virBufferAddLit(&buf, " <shareable/>\n");
|
virBufferAddLit(&buf, " <shareable/>\n");
|
||||||
|
|
||||||
|
@ -1849,8 +1849,8 @@ expected.
|
|||||||
[[[I<--live>] [I<--config>] | [I<--current>]] | [I<--persistent>]]
|
[[[I<--live>] [I<--config>] | [I<--current>]] | [I<--persistent>]]
|
||||||
[I<--driver driver>] [I<--subdriver subdriver>] [I<--cache cache>]
|
[I<--driver driver>] [I<--subdriver subdriver>] [I<--cache cache>]
|
||||||
[I<--type type>] [I<--mode mode>] [I<--config>] [I<--sourcetype soucetype>]
|
[I<--type type>] [I<--mode mode>] [I<--config>] [I<--sourcetype soucetype>]
|
||||||
[I<--serial serial>] [I<--shareable>] [I<--rawio>] [I<--address address>]
|
[I<--serial serial>] [I<--wwn wwn>] [I<--shareable>] [I<--rawio>]
|
||||||
[I<--multifunction>] [I<--print-xml>]
|
[I<--address address>] [I<--multifunction>] [I<--print-xml>]
|
||||||
|
|
||||||
Attach a new disk device to the domain.
|
Attach a new disk device to the domain.
|
||||||
I<source> is path for the files and devices. I<target> controls the bus or
|
I<source> is path for the files and devices. I<target> controls the bus or
|
||||||
@ -1870,8 +1870,8 @@ I<mode> can specify the two specific mode I<readonly> or I<shareable>.
|
|||||||
I<sourcetype> can indicate the type of source (block|file)
|
I<sourcetype> can indicate the type of source (block|file)
|
||||||
I<cache> can be one of "default", "none", "writethrough", "writeback",
|
I<cache> can be one of "default", "none", "writethrough", "writeback",
|
||||||
"directsync" or "unsafe".
|
"directsync" or "unsafe".
|
||||||
I<serial> is the serial of disk device. I<shareable> indicates the disk device
|
I<serial> is the serial of disk device. I<wwn> is the wwn of disk device.
|
||||||
is shareable between domains.
|
I<shareable> indicates the disk device is shareable between domains.
|
||||||
I<rawio> indicates the disk needs rawio capability.
|
I<rawio> indicates the disk needs rawio capability.
|
||||||
I<address> is the address of disk device in the form of pci:domain.bus.slot.function,
|
I<address> is the address of disk device in the form of pci:domain.bus.slot.function,
|
||||||
scsi:controller.bus.unit or ide:controller.bus.unit.
|
scsi:controller.bus.unit or ide:controller.bus.unit.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user