[PATCH 1/3] storage: Linstor configuration

2021-02-04 Thread Rene Peinthor
This adds Linstor storage defines and documentation
for the new storage backend for Linstor.

Signed-off-by: Rene Peinthor 
---
 docs/schemas/storagepool.rng  | 27 +++
 include/libvirt/libvirt-storage.h |  1 +
 src/conf/domain_conf.c|  1 +
 src/conf/storage_conf.c   | 13 -
 src/conf/storage_conf.h   |  1 +
 src/conf/virstorageobj.c  |  4 ++-
 src/storage/storage_driver.c  |  1 +
 src/test/test_driver.c|  1 +
 .../storagepoolcapsschemadata/poolcaps-fs.xml |  7 +
 .../poolcaps-full.xml |  7 +
 tests/storagepoolxml2argvtest.c   |  1 +
 tools/virsh-pool.c|  3 +++
 12 files changed, 65 insertions(+), 2 deletions(-)

diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng
index bd24b8b8d0..9b163e611d 100644
--- a/docs/schemas/storagepool.rng
+++ b/docs/schemas/storagepool.rng
@@ -26,6 +26,7 @@
 
 
 
+
   
 
   
@@ -224,6 +225,21 @@
 
   
 
+  
+
+  linstor
+
+
+  
+  
+  
+  
+  
+
+  
+
+  
+
   
 
   
@@ -463,6 +479,17 @@
 
   
 
+  
+
+  
+
+
+  
+
+  
+
+  
+
   
 
   
diff --git a/include/libvirt/libvirt-storage.h 
b/include/libvirt/libvirt-storage.h
index 089e1e0bd1..6876ce6c5a 100644
--- a/include/libvirt/libvirt-storage.h
+++ b/include/libvirt/libvirt-storage.h
@@ -245,6 +245,7 @@ typedef enum {
 VIR_CONNECT_LIST_STORAGE_POOLS_ZFS   = 1 << 17,
 VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE  = 1 << 18,
 VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT  = 1 << 19,
+VIR_CONNECT_LIST_STORAGE_POOLS_LINSTOR   = 1 << 20,
 } virConnectListAllStoragePoolsFlags;
 
 int virConnectListAllStoragePools(virConnectPtr conn,
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 12ebdb37f4..7cd697aee4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -31429,6 +31429,7 @@ 
virDomainStorageSourceTranslateSourcePool(virStorageSourcePtr src,
 case VIR_STORAGE_POOL_SCSI:
 case VIR_STORAGE_POOL_ZFS:
 case VIR_STORAGE_POOL_VSTORAGE:
+case VIR_STORAGE_POOL_LINSTOR:
 if (!(src->path = virStorageVolGetPath(vol)))
 return -1;
 
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 3f06fcaebf..6bd3ca3b35 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -60,7 +60,7 @@ VIR_ENUM_IMPL(virStoragePool,
   "logical", "disk", "iscsi",
   "iscsi-direct", "scsi", "mpath",
   "rbd", "sheepdog", "gluster",
-  "zfs", "vstorage",
+  "zfs", "vstorage", "linstor"
 );
 
 VIR_ENUM_IMPL(virStoragePoolFormatFileSystem,
@@ -304,6 +304,17 @@ static virStoragePoolTypeInfo poolTypeInfo[] = {
 .formatToString = virStorageFileFormatTypeToString,
  },
 },
+{.poolType = VIR_STORAGE_POOL_LINSTOR,
+ .poolOptions = {
+ .flags = (VIR_STORAGE_POOL_SOURCE_NETWORK |
+   VIR_STORAGE_POOL_SOURCE_NAME),
+ },
+ .volOptions = {
+ .defaultFormat = VIR_STORAGE_FILE_RAW,
+ .formatFromString = virStorageVolumeFormatFromString,
+ .formatToString = virStorageFileFormatTypeToString,
+ }
+},
 };
 
 
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 647eb847bf..1750c41a9f 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -110,6 +110,7 @@ typedef enum {
 VIR_STORAGE_POOL_GLUSTER,  /* Gluster device */
 VIR_STORAGE_POOL_ZFS,  /* ZFS */
 VIR_STORAGE_POOL_VSTORAGE, /* Virtuozzo Storage */
+VIR_STORAGE_POOL_LINSTOR,  /* Linstor Storage */
 
 VIR_STORAGE_POOL_LAST,
 } virStoragePoolType;
diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index 9fe8b3f28e..4a2a924eb2 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -1461,13 +1461,15 @@ virStoragePoolObjSourceFindDuplicateCb(const void 
*payload,
 case VIR_STORAGE_POOL_FS:
 case VIR_STORAGE_POOL_LOGICAL:
 case VIR_STORAGE_POOL_DISK:
+case VIR_STORAGE_POOL_LINSTOR:
 case VIR_STORAGE_POOL_ZFS:
 if ((data->def->type == VIR_STORAGE_POOL_ISCSI ||
  data->def->type == VIR_STORAGE_POOL_ISCSI_DIRECT ||
  data->def->type == VIR_STORAGE_POOL_FS ||
  data->def->type == VIR_STORAGE_POOL_LOGICAL ||
  data->def->type == VIR_STORAGE_POOL_DISK ||
- data->def->type == VIR_STORAGE_POOL_ZFS) &&
+ data->def->type == VIR_STORAGE_POOL_ZFS ||
+ data->def->type == VIR_STORAGE_POOL_LINSTOR) &&
 virStoragePoolObjSourceMatchTypeDEVICE(obj, data->def))
 return 1;
 break;
diff --git a/src/storage/storage_driver.c 

[PATCH 1/3] storage: Linstor configuration

2021-01-19 Thread Rene Peinthor
This adds Linstor storage defines and documentation
for the new storage backend for Linstor.
---
 docs/schemas/storagepool.rng  | 27 +++
 include/libvirt/libvirt-storage.h |  1 +
 src/conf/domain_conf.c|  1 +
 src/conf/storage_conf.c   | 14 +-
 src/conf/storage_conf.h   |  1 +
 src/conf/virstorageobj.c  |  4 ++-
 src/storage/storage_driver.c  |  1 +
 src/test/test_driver.c|  1 +
 .../storagepoolcapsschemadata/poolcaps-fs.xml |  7 +
 .../poolcaps-full.xml |  7 +
 tests/storagepoolxml2argvtest.c   |  1 +
 tools/virsh-pool.c|  3 +++
 12 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng
index bd24b8b8d0..9b163e611d 100644
--- a/docs/schemas/storagepool.rng
+++ b/docs/schemas/storagepool.rng
@@ -26,6 +26,7 @@
 
 
 
+
   
 
   
@@ -224,6 +225,21 @@
 
   
 
+  
+
+  linstor
+
+
+  
+  
+  
+  
+  
+
+  
+
+  
+
   
 
   
@@ -463,6 +479,17 @@
 
   
 
+  
+
+  
+
+
+  
+
+  
+
+  
+
   
 
   
diff --git a/include/libvirt/libvirt-storage.h 
b/include/libvirt/libvirt-storage.h
index 089e1e0bd1..6876ce6c5a 100644
--- a/include/libvirt/libvirt-storage.h
+++ b/include/libvirt/libvirt-storage.h
@@ -245,6 +245,7 @@ typedef enum {
 VIR_CONNECT_LIST_STORAGE_POOLS_ZFS   = 1 << 17,
 VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE  = 1 << 18,
 VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT  = 1 << 19,
+VIR_CONNECT_LIST_STORAGE_POOLS_LINSTOR   = 1 << 20,
 } virConnectListAllStoragePoolsFlags;
 
 int virConnectListAllStoragePools(virConnectPtr conn,
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fcf332fe44..6144bbd004 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -31379,6 +31379,7 @@ 
virDomainStorageSourceTranslateSourcePool(virStorageSourcePtr src,
 case VIR_STORAGE_POOL_SCSI:
 case VIR_STORAGE_POOL_ZFS:
 case VIR_STORAGE_POOL_VSTORAGE:
+case VIR_STORAGE_POOL_LINSTOR:
 if (!(src->path = virStorageVolGetPath(vol)))
 return -1;
 
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 0c50529ace..9a0dda6374 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -60,7 +60,7 @@ VIR_ENUM_IMPL(virStoragePool,
   "logical", "disk", "iscsi",
   "iscsi-direct", "scsi", "mpath",
   "rbd", "sheepdog", "gluster",
-  "zfs", "vstorage",
+  "zfs", "vstorage", "linstor"
 );
 
 VIR_ENUM_IMPL(virStoragePoolFormatFileSystem,
@@ -304,6 +304,18 @@ static virStoragePoolTypeInfo poolTypeInfo[] = {
 .formatToString = virStorageFileFormatTypeToString,
  },
 },
+{.poolType = VIR_STORAGE_POOL_LINSTOR,
+ .poolOptions = {
+ .flags = (VIR_STORAGE_POOL_SOURCE_HOST |
+   VIR_STORAGE_POOL_SOURCE_NETWORK |
+   VIR_STORAGE_POOL_SOURCE_NAME),
+ },
+ .volOptions = {
+ .defaultFormat = VIR_STORAGE_FILE_RAW,
+ .formatFromString = virStorageVolumeFormatFromString,
+ .formatToString = virStorageFileFormatTypeToString,
+ }
+},
 };
 
 
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index ffd406e093..716bde942f 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -110,6 +110,7 @@ typedef enum {
 VIR_STORAGE_POOL_GLUSTER,  /* Gluster device */
 VIR_STORAGE_POOL_ZFS,  /* ZFS */
 VIR_STORAGE_POOL_VSTORAGE, /* Virtuozzo Storage */
+VIR_STORAGE_POOL_LINSTOR,  /* Linstor Storage */
 
 VIR_STORAGE_POOL_LAST,
 } virStoragePoolType;
diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index 9fe8b3f28e..4a2a924eb2 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -1461,13 +1461,15 @@ virStoragePoolObjSourceFindDuplicateCb(const void 
*payload,
 case VIR_STORAGE_POOL_FS:
 case VIR_STORAGE_POOL_LOGICAL:
 case VIR_STORAGE_POOL_DISK:
+case VIR_STORAGE_POOL_LINSTOR:
 case VIR_STORAGE_POOL_ZFS:
 if ((data->def->type == VIR_STORAGE_POOL_ISCSI ||
  data->def->type == VIR_STORAGE_POOL_ISCSI_DIRECT ||
  data->def->type == VIR_STORAGE_POOL_FS ||
  data->def->type == VIR_STORAGE_POOL_LOGICAL ||
  data->def->type == VIR_STORAGE_POOL_DISK ||
- data->def->type == VIR_STORAGE_POOL_ZFS) &&
+ data->def->type == VIR_STORAGE_POOL_ZFS ||
+ data->def->type == VIR_STORAGE_POOL_LINSTOR) &&
 virStoragePoolObjSourceMatchTypeDEVICE(obj, data->def))
 return 1;
 break;
diff --git