CTL stands for CAM Target Layer, and CAM stands for Common Access Method Storage subsystem, and is available on FreeBSD. Quoting the ctl(4) manual page: The ctl subsystem provides SCSI target devices emulation. It supports features such as: • Disk, CD-ROM and processor device emulation • Tagged queueing • SCSI task attribute support (ordered, head of queue, simple tags) • SCSI implicit command ordering support • Full task management support (abort, query, reset, etc.) • Support for multiple ports, initiators, targets and backing stores • Support for VMWare VAAI and Microsoft ODX offload (COMPARE AND WRITE, XCOPY, POPULATE TOKEN/WRITE USING TOKEN, WRITE SAME and UNMAP) • Persistent reservation support • Extensive VPD/mode/log pages support • Featured error reporting, error injection and basic SMART support • High Availability clustering support with ALUA • All I/O handled in-kernel, no userland context switch overhead This is a preparation for implementing virtio-scsi support for the bhyve driver. Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- src/bhyve/bhyve_process.c | 1 + src/ch/ch_monitor.c | 1 + src/conf/domain_conf.c | 7 +++++++ src/conf/schemas/domaincommon.rng | 13 +++++++++++++ src/conf/storage_source_conf.c | 6 +++++- src/conf/storage_source_conf.h | 1 + src/libxl/xen_xl.c | 1 + src/qemu/qemu_block.c | 2 ++ src/qemu/qemu_command.c | 1 + src/qemu/qemu_migration.c | 3 +++ src/qemu/qemu_process.c | 1 + src/qemu/qemu_snapshot.c | 4 ++++ src/qemu/qemu_validate.c | 1 + src/storage_file/storage_source.c | 1 + 14 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 7de614a1a3..1d436da609 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -405,6 +405,7 @@ bhyvePrepareNVRAM(bhyveConn *driver, case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_VHOST_VDPA: + case VIR_STORAGE_TYPE_CTL: case VIR_STORAGE_TYPE_LAST: case VIR_STORAGE_TYPE_NONE: break; diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 46b31acc76..52f281cf73 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -285,6 +285,7 @@ virCHMonitorBuildDiskJson(virDomainDiskDef *diskdef) case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_VHOST_VDPA: + case VIR_STORAGE_TYPE_CTL: case VIR_STORAGE_TYPE_LAST: default: virReportEnumRangeError(virStorageType, diskdef->src->type); diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 541dad5bdc..b85bbbcaf6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7831,6 +7831,9 @@ virDomainStorageSourceParse(xmlNodePtr node, if (!(src->vdpadev = virXMLPropStringRequired(node, "dev"))) return -1; break; + case VIR_STORAGE_TYPE_CTL: + src->path = virXMLPropString(node, "dev"); + break; case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -23711,6 +23714,10 @@ virDomainDiskSourceFormat(virBuffer *buf, virBufferEscapeString(&attrBuf, " dev='%s'", src->vdpadev); break; + case VIR_STORAGE_TYPE_CTL: + virBufferEscapeString(&attrBuf, " dev='%s'", src->path); + break; + case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng index 1f9ac102a0..5d5fd87f87 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -1905,6 +1905,7 @@ <ref name="diskSourceNvme"/> <ref name="diskSourceVhostUser"/> <ref name="diskSourceVhostVdpa"/> + <ref name="diskSourceCtl"/> </choice> </define> @@ -2544,6 +2545,18 @@ </element> </define> + <define name="diskSourceCtl"> + <attribute name="type"> + <value>ctl</value> + </attribute> + <element name="source"> + <attribute name="dev"> + <ref name="absFilePath"/> + </attribute> + <empty/> + </element> + </define> + <define name="diskTargetDev"> <choice> <data type="string"> diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c index 087de1eaf2..d7b9bdfecb 100644 --- a/src/conf/storage_source_conf.c +++ b/src/conf/storage_source_conf.c @@ -48,7 +48,8 @@ VIR_ENUM_IMPL(virStorage, "volume", "nvme", "vhostuser", - "vhostvdpa" + "vhostvdpa", + "ctl", ); @@ -976,6 +977,7 @@ virStorageSourceIsSameLocation(virStorageSource *a, case VIR_STORAGE_TYPE_DIR: case VIR_STORAGE_TYPE_LAST: case VIR_STORAGE_TYPE_VOLUME: + case VIR_STORAGE_TYPE_CTL: /* nothing to do */ break; } @@ -1058,6 +1060,7 @@ virStorageSourceIsLocalStorage(const virStorageSource *src) case VIR_STORAGE_TYPE_FILE: case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_DIR: + case VIR_STORAGE_TYPE_CTL: return true; case VIR_STORAGE_TYPE_NETWORK: @@ -1263,6 +1266,7 @@ virStorageSourceIsRelative(virStorageSource *src) case VIR_STORAGE_TYPE_FILE: case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_DIR: + case VIR_STORAGE_TYPE_CTL: return !g_path_is_absolute(src->path); case VIR_STORAGE_TYPE_NETWORK: diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index fc868b31af..22c35d420d 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -44,6 +44,7 @@ typedef enum { VIR_STORAGE_TYPE_NVME, VIR_STORAGE_TYPE_VHOST_USER, VIR_STORAGE_TYPE_VHOST_VDPA, + VIR_STORAGE_TYPE_CTL, VIR_STORAGE_TYPE_LAST } virStorageType; diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c index b2ff0edcf2..e72e7d7f44 100644 --- a/src/libxl/xen_xl.c +++ b/src/libxl/xen_xl.c @@ -1531,6 +1531,7 @@ xenFormatXLDiskSrc(virStorageSource *src, char **srcstr) case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_VHOST_VDPA: + case VIR_STORAGE_TYPE_CTL: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index a7062d3e96..9b43279797 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1046,6 +1046,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src, src->srcpool->pool, src->srcpool->volume); return NULL; + case VIR_STORAGE_TYPE_CTL: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportEnumRangeError(virStorageType, actualType); @@ -2417,6 +2418,7 @@ qemuBlockStorageSourceCreateGetStorageProps(virStorageSource *src, case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_VHOST_VDPA: + case VIR_STORAGE_TYPE_CTL: return 0; case VIR_STORAGE_TYPE_NONE: diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 98229d7cf9..0de0a79b46 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1486,6 +1486,7 @@ qemuBuildDriveSourceStr(virDomainDiskDef *disk, case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_VHOST_VDPA: + case VIR_STORAGE_TYPE_CTL: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 1371742529..08f05ff727 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -344,6 +344,7 @@ qemuMigrationDstPrecreateDisk(virConnectPtr *conn, case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_VHOST_VDPA: + case VIR_STORAGE_TYPE_CTL: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -499,6 +500,7 @@ qemuMigrationDstPrepareStorage(virDomainObj *vm, /* Existance of 'volume' type disks are handled when pre-creating them */ break; + case VIR_STORAGE_TYPE_CTL: case VIR_STORAGE_TYPE_LAST: case VIR_STORAGE_TYPE_NONE: break; @@ -1725,6 +1727,7 @@ qemuMigrationSrcCheckStorageSourceSafety(virStorageSource *src, case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_DIR: case VIR_STORAGE_TYPE_VOLUME: + case VIR_STORAGE_TYPE_CTL: case VIR_STORAGE_TYPE_LAST: *requires_safe_cache = true; break; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 0e50cd1ccc..4e1d713809 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4994,6 +4994,7 @@ qemuPrepareNVRAM(virQEMUDriver *driver, case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_VHOST_VDPA: + case VIR_STORAGE_TYPE_CTL: case VIR_STORAGE_TYPE_LAST: case VIR_STORAGE_TYPE_NONE: if (reset_nvram) { diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 5b0b52e2ba..bad135ee61 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -689,6 +689,7 @@ qemuSnapshotPrepareDiskExternalInactive(virDomainSnapshotDiskDef *snapdisk, case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_VHOST_VDPA: + case VIR_STORAGE_TYPE_CTL: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -708,6 +709,7 @@ qemuSnapshotPrepareDiskExternalInactive(virDomainSnapshotDiskDef *snapdisk, case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_VHOST_VDPA: + case VIR_STORAGE_TYPE_CTL: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -752,6 +754,7 @@ qemuSnapshotPrepareDiskExternalActive(virDomainSnapshotDiskDef *snapdisk, case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_VHOST_VDPA: + case VIR_STORAGE_TYPE_CTL: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -914,6 +917,7 @@ qemuSnapshotPrepareDiskInternal(virDomainDiskDef *disk, case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_VHOST_VDPA: + case VIR_STORAGE_TYPE_CTL: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index da08fd17cd..c43e794816 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -717,6 +717,7 @@ qemuValidateDomainDefNvram(const virDomainDef *def, case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_VHOST_VDPA: + case VIR_STORAGE_TYPE_CTL: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported nvram disk type '%1$s'"), virStorageTypeToString(src->type)); diff --git a/src/storage_file/storage_source.c b/src/storage_file/storage_source.c index 1883225a8b..e886433bb4 100644 --- a/src/storage_file/storage_source.c +++ b/src/storage_file/storage_source.c @@ -625,6 +625,7 @@ virStorageSourceUpdatePhysicalSize(virStorageSource *src, case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: case VIR_STORAGE_TYPE_VHOST_VDPA: + case VIR_STORAGE_TYPE_CTL: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: return -1; -- 2.52.0