hw/block/nvme: update nsid when registered

If the user does not specify an nsid parameter on the nvme-ns device,
nvme_register_namespace will find the first free namespace id and assign
that.

This fix makes sure the assigned id is saved.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
This commit is contained in:
Klaus Jensen 2020-10-01 23:37:20 +02:00
parent 6eb7a07129
commit b20804946b
1 changed files with 1 additions and 1 deletions

View File

@ -2578,7 +2578,7 @@ int nvme_register_namespace(NvmeCtrl *n, NvmeNamespace *ns, Error **errp)
for (int i = 1; i <= n->num_namespaces; i++) {
NvmeNamespace *ns = nvme_ns(n, i);
if (!ns) {
nsid = i;
nsid = ns->params.nsid = i;
break;
}
}