diff --git a/include/libvirt/libvirt-storage.h b/include/libvirt/libvirt-storage.h index aaad4a3da18..4c8c9cb1af3 100644 --- a/include/libvirt/libvirt-storage.h +++ b/include/libvirt/libvirt-storage.h @@ -326,6 +326,8 @@ typedef enum { VIR_CONNECT_LIST_STORAGE_POOLS_ZFS = 1 << 17, /* (Since: 1.2.8) */ VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE = 1 << 18, /* (Since: 3.1.0) */ VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT = 1 << 19, /* (Since: 5.6.0) */ + + VIR_CONNECT_LIST_STORAGE_POOLS_RAWSTOR = 1 << 20, /* (Since: 12.4.0) */ } virConnectListAllStoragePoolsFlags; int virConnectListAllStoragePools(virConnectPtr conn, diff --git a/meson.build b/meson.build index 71151ae6b47..d57ff1ba946 100644 --- a/meson.build +++ b/meson.build @@ -1113,6 +1113,8 @@ else libpcap_dep = dependency('', required: false) endif +librawstor_dep = dependency('rawstor', required: get_option('storage_rawstor')) + libssh_version = '0.8.1' if conf.has('WITH_REMOTE') libssh_dep = dependency('libssh', version: '>=' + libssh_version, required: get_option('libssh')) @@ -1882,6 +1884,13 @@ if conf.has('WITH_LIBVIRTD') error('mpath storage driver is supported only on Linux and you must install libdevmapper') endif + if not get_option('storage_rawstor').disabled() and librawstor_dep.found() + use_storage = true + conf.set('WITH_STORAGE_RAWSTOR', 1) + elif get_option('storage_rawstor').enabled() + error('You must install the librawstor library & headers to compile libvirt') + endif + if not get_option('storage_rbd').disabled() and rbd_dep.found() use_storage = true conf.set('WITH_STORAGE_RBD', 1) @@ -2273,6 +2282,7 @@ storagedriver_summary = { 'LVM': conf.has('WITH_STORAGE_LVM'), 'mpath': conf.has('WITH_STORAGE_MPATH'), 'NetFS': conf.has('WITH_STORAGE_FS'), + 'Rawstor': conf.has('WITH_STORAGE_RAWSTOR'), 'RBD': conf.has('WITH_STORAGE_RBD'), 'SCSI': conf.has('WITH_STORAGE_SCSI'), 'Virtuozzo storage': conf.has('WITH_STORAGE_VSTORAGE'), @@ -2312,6 +2322,7 @@ libs_summary = { 'libnl': libnl_dep, 'libparted': libparted_dep, 'libpcap': libpcap_dep, + 'librawstor': librawstor_dep, 'libssh': libssh_dep, 'libssh2': libssh2_dep, 'libutil': libutil_dep, diff --git a/meson_options.txt b/meson_options.txt index e12ace4e115..3d30326fdfe 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -105,6 +105,7 @@ option('storage_iscsi', type: 'feature', value: 'auto', description: 'iscsi back option('storage_iscsi_direct', type: 'feature', value: 'auto', description: 'iscsi-direct backend for the storage driver') option('storage_lvm', type: 'feature', value: 'auto', description: 'LVM backend for the storage driver') option('storage_mpath', type: 'feature', value: 'auto', description: 'mpath backend for the storage driver') +option('storage_rawstor', type: 'feature', value: 'auto', description: 'Rawstor backend for the storage driver') option('storage_rbd', type: 'feature', value: 'auto', description: 'RADOS Block Device backend for the storage driver') option('storage_scsi', type: 'feature', value: 'auto', description: 'SCSI backend for the storage driver') option('storage_vstorage', type: 'feature', value: 'auto', description: 'Virtuozzo storage backend for the storage driver') diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2d3e646bcb5..4dbf6974b28 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -32792,6 +32792,7 @@ virDomainStorageSourceTranslateSourcePool(virStorageSource *src, case VIR_STORAGE_POOL_RBD: case VIR_STORAGE_POOL_SHEEPDOG: case VIR_STORAGE_POOL_GLUSTER: + case VIR_STORAGE_POOL_RAWSTOR: case VIR_STORAGE_POOL_LAST: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("using '%1$s' pools for backing 'volume' disks isn't yet supported"), diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 1dc9365bf28..19f25996a27 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -55,7 +55,7 @@ VIR_ENUM_IMPL(virStoragePool, "dir", "fs", "netfs", "logical", "disk", "iscsi", "iscsi-direct", "scsi", "mpath", - "rbd", "sheepdog", "gluster", + "rawstor", "rbd", "sheepdog", "gluster", "zfs", "vstorage", ); @@ -230,6 +230,13 @@ static virStoragePoolTypeInfo poolTypeInfo[] = { .flags = (VIR_STORAGE_POOL_SOURCE_ADAPTER), }, }, + {.poolType = VIR_STORAGE_POOL_RAWSTOR, + .poolOptions = { + .flags = (VIR_STORAGE_POOL_SOURCE_HOST | + VIR_STORAGE_POOL_SOURCE_NETWORK | + VIR_STORAGE_POOL_SOURCE_NAME), + } + }, {.poolType = VIR_STORAGE_POOL_RBD, .poolOptions = { .flags = (VIR_STORAGE_POOL_SOURCE_HOST | diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h index fc67957cfe9..2affb316cbe 100644 --- a/src/conf/storage_conf.h +++ b/src/conf/storage_conf.h @@ -103,6 +103,7 @@ typedef enum { VIR_STORAGE_POOL_GLUSTER, /* Gluster device */ VIR_STORAGE_POOL_ZFS, /* ZFS */ VIR_STORAGE_POOL_VSTORAGE, /* Virtuozzo Storage */ + VIR_STORAGE_POOL_RAWSTOR, /* Rawstor device */ VIR_STORAGE_POOL_LAST, } virStoragePoolType; @@ -453,6 +454,7 @@ VIR_ENUM_DECL(virStoragePartedFs); VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI | \ VIR_CONNECT_LIST_STORAGE_POOLS_SCSI | \ VIR_CONNECT_LIST_STORAGE_POOLS_MPATH | \ + VIR_CONNECT_LIST_STORAGE_POOLS_RAWSTOR | \ VIR_CONNECT_LIST_STORAGE_POOLS_RBD | \ VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG | \ VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER | \ diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index ac79ff4c263..c0cb869d039 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -1468,6 +1468,7 @@ virStoragePoolObjSourceFindDuplicateCb(const void *payload, break; case VIR_STORAGE_POOL_ISCSI_DIRECT: + case VIR_STORAGE_POOL_RAWSTOR: case VIR_STORAGE_POOL_RBD: case VIR_STORAGE_POOL_LAST: break; @@ -1948,6 +1949,8 @@ virStoragePoolObjMatch(virStoragePoolObj *obj, (obj->def->type == VIR_STORAGE_POOL_SCSI)) || (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_MPATH) && (obj->def->type == VIR_STORAGE_POOL_MPATH)) || + (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_RAWSTOR) && + (obj->def->type == VIR_STORAGE_POOL_RAWSTOR)) || (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_RBD) && (obj->def->type == VIR_STORAGE_POOL_RBD)) || (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG) && diff --git a/src/libvirt-storage.c b/src/libvirt-storage.c index db7660aac47..5962e7efddc 100644 --- a/src/libvirt-storage.c +++ b/src/libvirt-storage.c @@ -93,6 +93,7 @@ virStoragePoolGetConnect(virStoragePoolPtr pool) * VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI * VIR_CONNECT_LIST_STORAGE_POOLS_SCSI * VIR_CONNECT_LIST_STORAGE_POOLS_MPATH + * VIR_CONNECT_LIST_STORAGE_POOLS_RAWSTOR * VIR_CONNECT_LIST_STORAGE_POOLS_RBD * VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG * VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER diff --git a/src/storage/meson.build b/src/storage/meson.build index f6f28757efb..aad21ce114a 100644 --- a/src/storage/meson.build +++ b/src/storage/meson.build @@ -43,6 +43,10 @@ storage_backend_mpath_sources = [ 'storage_backend_mpath.c', ] +storage_backend_rawstor_sources = [ + 'storage_backend_rawstor.c', +] + storage_backend_rbd_sources = [ 'storage_backend_rbd.c', ] @@ -213,6 +217,19 @@ if conf.has('WITH_STORAGE_MPATH') } endif +if conf.has('WITH_STORAGE_RAWSTOR') + virt_modules += { + 'name': 'virt_storage_backend_rawstor', + 'sources': [ + files(storage_backend_rawstor_sources), + ], + 'deps': [ + librawstor_dep + ], + 'install_dir': storage_backend_install_dir, + } +endif + if conf.has('WITH_STORAGE_RBD') virt_modules += { 'name': 'virt_storage_backend_rbd', diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index ecc30ae7109..ee9e4432131 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -123,6 +123,9 @@ virStorageBackendDriversRegister(bool allbackends G_GNUC_UNUSED) #if WITH_STORAGE_DISK VIR_STORAGE_BACKEND_REGISTER(virStorageBackendDiskRegister, "disk"); #endif +#if WITH_STORAGE_RAWSTOR + VIR_STORAGE_BACKEND_REGISTER(virStorageBackendRawstorRegister, "rawstor"); +#endif #if WITH_STORAGE_RBD VIR_STORAGE_BACKEND_REGISTER(virStorageBackendRBDRegister, "rbd"); #endif diff --git a/src/storage/storage_backend_rawstor.c b/src/storage/storage_backend_rawstor.c new file mode 100644 index 00000000000..926662780be --- /dev/null +++ b/src/storage/storage_backend_rawstor.c @@ -0,0 +1,18 @@ +#include "storage_backend.h" +#include "storage_backend_rawstor.h" + + +static virStorageBackend virStorageBackendRawstor = { + .type = VIR_STORAGE_POOL_RAWSTOR, + + // .refreshPool = virStorageBackendMyVhostRefreshPool, + // .createVol = virStorageBackendMyVhostCreateVol, + // ... остальные обработчики +}; + + +int +virStorageBackendRawstorRegister(void) +{ + return virStorageBackendRegister(&virStorageBackendRawstor); +} diff --git a/src/storage/storage_backend_rawstor.h b/src/storage/storage_backend_rawstor.h new file mode 100644 index 00000000000..d629ba465be --- /dev/null +++ b/src/storage/storage_backend_rawstor.h @@ -0,0 +1,23 @@ +/* + * storage_backend_iscsi.h: storage backend for iSCSI handling + * + * Copyright (C) 2025-2026 Vasily Stepanov + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#pragma once + +int virStorageBackendRawstorRegister(void); diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 22ce462a63d..efc5b4a6de0 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -1625,6 +1625,7 @@ storageVolLookupByPathCallback(virStoragePoolObj *obj, break; case VIR_STORAGE_POOL_GLUSTER: + case VIR_STORAGE_POOL_RAWSTOR: case VIR_STORAGE_POOL_RBD: case VIR_STORAGE_POOL_SHEEPDOG: case VIR_STORAGE_POOL_ZFS: diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 536e2918613..b509abac279 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -7362,6 +7362,7 @@ testStorageVolumeTypeForPool(int pooltype) case VIR_STORAGE_POOL_ISCSI_DIRECT: case VIR_STORAGE_POOL_GLUSTER: case VIR_STORAGE_POOL_RBD: + case VIR_STORAGE_POOL_RAWSTOR: return VIR_STORAGE_VOL_NETWORK; case VIR_STORAGE_POOL_LOGICAL: case VIR_STORAGE_POOL_DISK: diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index c4821cf41d3..2a8a2f6425a 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -1172,6 +1172,9 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) case VIR_STORAGE_POOL_MPATH: flags |= VIR_CONNECT_LIST_STORAGE_POOLS_MPATH; break; + case VIR_STORAGE_POOL_RAWSTOR: + flags |= VIR_CONNECT_LIST_STORAGE_POOLS_RAWSTOR; + break; case VIR_STORAGE_POOL_RBD: flags |= VIR_CONNECT_LIST_STORAGE_POOLS_RBD; break;