[PATCH 1/3] storage: Linstor configuration

Rene Peinthor rene.peinthor at linbit.com
Tue Jan 19 13:14:49 UTC 2021


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 @@
         <ref name="poolgluster"/>
         <ref name="poolzfs"/>
         <ref name="poolvstorage"/>
+        <ref name="poollinstor"/>
       </choice>
     </element>
   </define>
@@ -224,6 +225,21 @@
     </interleave>
   </define>
 
+  <define name="poollinstor">
+    <attribute name="type">
+      <value>linstor</value>
+    </attribute>
+    <interleave>
+      <ref name="commonMetadataNameOptional"/>
+      <ref name="sizing"/>
+      <ref name="features"/>
+      <ref name="sourcelinstor"/>
+      <optional>
+        <ref name="target"/>
+      </optional>
+    </interleave>
+  </define>
+
   <define name="sourceinfovendor">
     <interleave>
       <optional>
@@ -463,6 +479,17 @@
     </element>
   </define>
 
+  <define name="sourcelinstor">
+    <element name="source">
+      <interleave>
+        <ref name="sourceinfoname"/>
+        <optional>
+          <ref name="sourceinfohost"/>
+        </optional>
+      </interleave>
+    </element>
+  </define>
+
   <define name="sourcefmtfs">
     <optional>
       <element name="format">
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 a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 16bc53aa46..63f860a963 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1647,6 +1647,7 @@ storageVolLookupByPathCallback(virStoragePoolObjPtr obj,
         case VIR_STORAGE_POOL_RBD:
         case VIR_STORAGE_POOL_SHEEPDOG:
         case VIR_STORAGE_POOL_ZFS:
+        case VIR_STORAGE_POOL_LINSTOR:
         case VIR_STORAGE_POOL_LAST:
             stable_path = g_strdup(data->path);
             break;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 29c4c86b1d..b03ede39d0 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -7103,6 +7103,7 @@ testStorageVolumeTypeForPool(int pooltype)
     case VIR_STORAGE_POOL_ISCSI:
     case VIR_STORAGE_POOL_SCSI:
     case VIR_STORAGE_POOL_ZFS:
+    case VIR_STORAGE_POOL_LINSTOR:
         return VIR_STORAGE_VOL_BLOCK;
     case VIR_STORAGE_POOL_LAST:
     default:
diff --git a/tests/storagepoolcapsschemadata/poolcaps-fs.xml b/tests/storagepoolcapsschemadata/poolcaps-fs.xml
index eee75af746..2ddb18082e 100644
--- a/tests/storagepoolcapsschemadata/poolcaps-fs.xml
+++ b/tests/storagepoolcapsschemadata/poolcaps-fs.xml
@@ -204,4 +204,11 @@
       </enum>
     </volOptions>
   </pool>
+  <pool type='linstor' supported='no'>
+    <volOptions>
+      <defaultFormat type='raw'/>
+      <enum name='targetFormatType'>
+      </enum>
+    </volOptions>
+  </pool>
 </storagepoolCapabilities>
diff --git a/tests/storagepoolcapsschemadata/poolcaps-full.xml b/tests/storagepoolcapsschemadata/poolcaps-full.xml
index 805950a937..cdce2d1ad8 100644
--- a/tests/storagepoolcapsschemadata/poolcaps-full.xml
+++ b/tests/storagepoolcapsschemadata/poolcaps-full.xml
@@ -204,4 +204,11 @@
       </enum>
     </volOptions>
   </pool>
+  <pool type='linstor' supported='yes'>
+    <volOptions>
+      <defaultFormat type='raw'/>
+      <enum name='targetFormatType'>
+      </enum>
+    </volOptions>
+  </pool>
 </storagepoolCapabilities>
diff --git a/tests/storagepoolxml2argvtest.c b/tests/storagepoolxml2argvtest.c
index 967d1f21a8..a632b07a00 100644
--- a/tests/storagepoolxml2argvtest.c
+++ b/tests/storagepoolxml2argvtest.c
@@ -68,6 +68,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
     case VIR_STORAGE_POOL_GLUSTER:
     case VIR_STORAGE_POOL_ZFS:
     case VIR_STORAGE_POOL_VSTORAGE:
+    case VIR_STORAGE_POOL_LINSTOR:
     case VIR_STORAGE_POOL_LAST:
     default:
         VIR_TEST_DEBUG("pool type '%s' has no xml2argv test", defTypeStr);
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 7835fa6d75..0e5bec1688 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -1237,6 +1237,9 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
             case VIR_STORAGE_POOL_VSTORAGE:
                 flags |= VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE;
                 break;
+            case VIR_STORAGE_POOL_LINSTOR:
+                flags |= VIR_CONNECT_LIST_STORAGE_POOLS_LINSTOR;
+                break;
             case VIR_STORAGE_POOL_LAST:
                 break;
             }
-- 
2.30.0




More information about the libvir-list mailing list