bdev_virtio: set unique name for the bdevs

Previously all bdevs were using
hardcoded name Virtio0.

Change-Id: Ib990027a0edd4e200aa4b6f4689ccb9e0824a9c3
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382926
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-10-18 11:04:56 +02:00 committed by Jim Harris
parent 66ed5a2bb6
commit c6ba3fe473

View File

@ -622,7 +622,13 @@ alloc_virtio_disk(struct virtio_scsi_scan_base *base, uint8_t target_id, uint64_
disk->target = target_id;
bdev = &disk->bdev;
bdev->name = spdk_sprintf_alloc("Virtio0");
bdev->name = spdk_sprintf_alloc("VirtioScsi%"PRIu32"t%"PRIu8, disk->vdev->id, target_id);
if (bdev->name == NULL) {
SPDK_ERRLOG("Couldn't alloc memory for the bdev name.\n");
free(disk);
return -1;
}
bdev->product_name = "Virtio SCSI Disk";
bdev->write_cache = 0;
bdev->blocklen = disk->block_size;