XOSTOR documentation
๐ LINSTOR/DRBD global documentation in the context of XCP-ngโ
What is LINSTOR?โ
LINSTOR is an open-source software developed by LINBIT. It was designed to manipulate a set of resources on several machines and to replicate them via DRBD block devices while allowing high performance. XOSTOR is a LinstorSR SMAPI driver developed by Vates, which allows volume replication in an XCP-ng pool and provides a web UI in XOA.
How does it work?โ
LINSTOR is made of two main components:
- A controller, declared on a machine of the XCP-ng pool. There is only one per pool and it can run on a master or a slave. The controller is a daemon that receives commands across the pool's network to manipulate the volumes, network, configuration...
- Satellites which are the other machines of the pool. They send commands to the controller and the controller's state to the host.
Communication between the satellites and the controller is done via the TCP/IP protocol. A newly created LINSTOR SR will use the XAPI management interface by default.
A Python API is available to communicate with LINSTOR and is used in the driver. Otherwise, a CLI tool is available: linstor.
DRBDโ
Earlier, we have described what constituted an XCP-ng pool with LINSTOR: a controller and its satellites. Now, let's explain what the volumes are based on.
Each volume created via a LINSTOR command appears as a DRBD (Distributed Replicated Block Device). Like LINSTOR, this tool is also developed by LINBIT and is officially available in the Linux kernel.
DRBD is a solution to share a resource across multiple machines, using a replication parameter. In XCP-ng, it's a /dev/drbdXXX volume accessible on several hosts where XXXX is the device minor number. For each XCP-ng VDI (Virtual Disk Image), there is a DRBD volume.
Resources & Volumesโ
DRBD has a device minor number, but also a resource name which helps to understand what the resource corresponds to.
The path to a DRBD resource follows this pattern:
> realpath /dev/drbd/by-res/<RESOURCE_NAME>/<VOLUME_ID>
/dev/drbd<DRBD_MINOR>
You may notice the use of a <VOLUME_ID> here.
A DRBD is a set of volumes that form a group. Within the same DRBD resource, each volume will share the same attributes. Several volumes can be useful for breaking down information while sharing the context of the same DRBD resource. In our case, we only use one volume per DRBD resource, meaning that the VOLUME_ID will always be 0. By abuse of language, it's therefore possible that we use the terms resource and volume interchangeably in this documentation.
Roles/Locksโ
The ability of a machine to access a DRBD path /dev/drbdXXX depends on the role of the DRBD resource. A resource can be Primary or Secondary:
- A
Primaryresource is accessible on a host for READ and WRITE operations. - A
Secondaryresource only receives requests from thePrimary. It's used to replicate the data and improve reading performance simultaneously. Only the DRBD kernel module can access this volume's data and it can't be written or read by any other process.
A DRBD Primary can be seen as a lock on a resource. This lock is global to a machine, not specific to a process. At first, all instances of a DRBD are in the Secondary role. There are two main ways for a DRBD to become Primary:
- By taking the Primary role if the resource is indeed Secondary on all machines with the command
drbdadm primary <RESOURCE_NAME>. Change the parameter and run the commanddrbdadm secondary <RESOURCE_NAME>when you no longer want to read or write on this resource. - By using the default configuration of a DRBD resource: a call to a C function like
fopen("/dev/drbd1001", "r+")givesPrimaryaccess to a resource. If the resource is opened on another machine, anEROFSerrno code is returned. If the resource contains a partition, a call to themountcommand also allows to obtain a lock.
TLDR, when a volume is primary, it's like a lock: other instances of this same volume cannot be opened on other machines. The volume/lock must be released to give access to other hosts.
Diskless and Diskfulโ
Usually, when a resource is replicated through DRBD, we assume that it only exists in 1, 2 or 3 copies. In other words, in a pool that has at least 4 hosts, a host may not have a copy of a resource locally. In this case scenario, it is however possible to access a resource's data using a device like /dev/drbdXXXX. When data is written or read, network requests are sent to the hosts that have a replication of this volume. This volume type is called diskless and a DRBD which has local data is called diskful.
Like a diskful, when a diskless is opened, it takes the primary lock.
Where is the data stored?โ
The data is stored in a lower-level storage located in a layer below the DRBDs.
In the driver, an LVM group is built on one or more physical disks. Each machine in a pool doesn't need a physical disk to be able to use LINSTOR/DRBD.
We recommend using the same types of drives (processor, disk) on every machine that has them.
Concepts of LINSTORโ
We saw that DRBD is a set of resources and volumes. These notions also exist in LINSTOR, with additional elements on top of DRBD.
Nodeโ
A node is an object that contains important information about a host such as:
- Its name, which must be identical to the hostname.
- Its type: controller, satellite, combined, auxiliary. In our implementation, we always use combined nodes which can be controller and/or satellite because if the current controller of a pool has a problem, we want to be able to start one elsewhere. Without this, we would no longer be able to launch LINSTOR commands.
- The IP address and port that are used by the satellites/controller. By default, the XAPI management IP is used.
CLI example:
> linstor node list
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Node โ NodeType โ Addresses โ State โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโก
โ r620-s1 โ COMBINED โ 172.16.210.14:3366 (PLAIN) โ Online โ
โ r620-s2 โ COMBINED โ 172.16.210.15:3366 (PLAIN) โ Online โ
โ r620-s3 โ COMBINED โ 172.16.210.16:3366 (PLAIN) โ Online โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Storage Poolโ
A storage pool is a LINSTOR object that represents the physical storage layer of a pool node. In practice, it is an LVM layer below DRBD.
CLI example:
> linstor storage-pool list
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ StoragePool โ Node โ Driver โ PoolName โ FreeCapacity โ TotalCapacity โ CanSnapshots โ State โ SharedName โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโก
โ DfltDisklessStorPool โ r620-s1 โ DISKLESS โ โ โ โ False โ Ok โ r620-s1;DfltDisklessStorPool โ
โ DfltDisklessStorPool โ r620-s2 โ DISKLESS โ โ โ โ False โ Ok โ r620-s2;DfltDisklessStorPool โ
โ DfltDisklessStorPool โ r620-s3 โ DISKLESS โ โ โ โ False โ Ok โ r620-s3;DfltDisklessStorPool โ
โ xcp-sr-linstor_group_thin_device โ r620-s1 โ LVM_THIN โ linstor_group/thin_device โ 859.10 GiB โ 931.28 GiB โ True โ Ok โ r620-s1;xcp-sr-linstor_group_thin_device โ
โ xcp-sr-linstor_group_thin_device โ r620-s2 โ LVM_THIN โ linstor_group/thin_device โ 829.77 GiB โ 931.28 GiB โ True โ Ok โ r620-s2;xcp-sr-linstor_group_thin_device โ
โ xcp-sr-linstor_group_thin_device โ r620-s3 โ LVM_THIN โ linstor_group/thin_device โ 758.99 GiB โ 931.28 GiB โ True โ Ok โ r620-s3;xcp-sr-linstor_group_thin_device โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
In the XCP-ng LINSTOR driver, only two backends are supported: LVM (thick provisioning) and LVM_THIN (thin provisioning).
In this example, the name of the storage pool used on each node is: xcp-sr-linstor_group_thin_device. The special storage pool DfltDisklessStorPool is used to manage diskless DRBDs.
Resource Groupโ
A resource group is another LINSTOR object and it can be seen as a container of resources. The managed resources are influenced by the group's properties. The most important property is the PlaceCount which defines for each resource, the number of copies that must be present in the pool.
A change in a property has a direct impact on the existing resources. For example, increasing a place count will create new duplications on other hosts.
CLI example:
> linstor rg list
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ResourceGroup โ SelectFilter โ VlmNrs โ Description โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโก
โ DfltRscGrp โ PlaceCount: 2 โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโก
โ xcp-ha-linstor_group_thin_device โ PlaceCount: 3 โ 0 โ โ
โ โ StoragePool(s): xcp-sr-linstor_group_thin_device โ โ โ
โ โ DisklessOnRemaining: False โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโก
โ xcp-sr-linstor_group_thin_device โ PlaceCount: 2 โ 0 โ โ
โ โ StoragePool(s): xcp-sr-linstor_group_thin_device โ โ โ
โ โ DisklessOnRemaining: False โ โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
In an XCP-ng context, we use a single storage pool (xcp-sr-linstor_group_thin_device) containing two resource groups:
- xcp-ha-linstor_group_thin_device
- xcp-sr-linstor_group_thin_device
The first group is used both as the heartbeat volume required by the HA and as the drbd1000 volume which contains the LINSTOR database. This database contains the information displayed via the linstor command. As these volumes are vital for the SR's survival, the replication is forced to 3.
The second group is used for all volumes created by a user and the replication count is configurable from 1 to 3.
Resource, Volume & Definitionsโ
In comparison to DRBD, the info about the resource and volume also has a definition in LINSTOR. A resource cannot exist without a definition and it describes the most common attributes of each copy of the resource, regardless of the number of replications.
Examples of resource and volume definitions:
> linstor rd list
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ResourceName โ Port โ ResourceGroup โ State โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโก
โ xcp-persistent-database โ 7000 โ xcp-ha-linstor_group_thin_device โ ok โ
โ xcp-persistent-ha-statefile โ 7001 โ xcp-ha-linstor_group_thin_device โ ok โ
โ xcp-persistent-redo-log โ 7002 โ xcp-ha-linstor_group_thin_device โ ok โ
โ xcp-volume-01611aa8-688b-470a-92ee-21c56de16cdf โ 7003 โ xcp-sr-linstor_group_thin_device โ ok โ
โ xcp-volume-07f73f51-95ea-4a82-ba03-ef65dfbfb967 โ 7010 โ xcp-sr-linstor_group_thin_device โ ok โ
โ xcp-volume-10d2c269-35ef-4948-b7f0-dcd8db9b7815 โ 7021 โ xcp-sr-linstor_group_thin_device โ ok โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
> linstor vd list
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ResourceName โ VolumeNr โ VolumeMinor โ Size โ Gross โ State โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโก
โ xcp-persistent-database โ 0 โ 1000 โ 1 GiB โ โ ok โ
โ xcp-persistent-ha-statefile โ 0 โ 1001 โ 2 MiB โ โ ok โ
โ xcp-persistent-redo-log โ 0 โ 1002 โ 256 MiB โ โ ok โ
โ xcp-volume-01611aa8-688b-470a-92ee-21c56de16cdf โ 0 โ 1003 โ 2.01 GiB โ โ ok โ
โ xcp-volume-07f73f51-95ea-4a82-ba03-ef65dfbfb967 โ 0 โ 1010 โ 100.21 GiB โ โ ok โ
โ xcp-volume-10d2c269-35ef-4948-b7f0-dcd8db9b7815 โ 0 โ 1021 โ 100.25 GiB โ โ ok โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
In XCP-ng, we always use only one volume for one resource, so the VolumeNr column only contains 0s.
It is possible to retrieve DRBD paths with this info.
For example for the HA statefile volume, we have:
/dev/drbd/by-res/xcp-persistent-ha-statefile/0 # where 0 is the VolumeNr
/dev/drbd1001 # where 1001 is the VolumeMinor
A resource is an instance of a definition. There are usually at least three resources per definition and each has its properties: the node where it is located, its usage, state and creation date.
Examples of resources and volumes:
> linstor r list
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ResourceName โ Node โ Port โ Usage โ Conns โ State โ CreatedOn โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโก
โ xcp-persistent-database โ r620-s1 โ 7000 โ InUse โ Ok โ UpToDate โ 2023-06-13 18:40:06 โ
โ xcp-persistent-database โ r620-s2 โ 7000 โ Unused โ Ok โ Diskless โ 2023-06-13 18:40:04 โ
โ xcp-persistent-database โ r620-s3 โ 7000 โ Unused โ Ok โ Diskless โ 2023-06-13 18:40:04 โ
โ xcp-persistent-ha-statefile โ r620-s1 โ 7001 โ Unused โ Ok โ UpToDate โ 2024-03-20 16:01:18 โ
โ xcp-persistent-ha-statefile โ r620-s2 โ 7001 โ Unused โ Ok โ UpToDate โ 2024-03-20 16:01:14 โ
โ xcp-persistent-ha-statefile โ r620-s3 โ 7001 โ Unused โ Ok โ UpToDate โ 2024-03-20 16:01:18 โ
โ xcp-persistent-redo-log โ r620-s1 โ 7002 โ Unused โ Ok โ UpToDate โ 2024-03-20 16:01:27 โ
โ xcp-persistent-redo-log โ r620-s2 โ 7002 โ Unused โ Ok โ UpToDate โ 2024-03-20 16:01:23 โ
โ xcp-persistent-redo-log โ r620-s3 โ 7002 โ Unused โ Ok โ UpToDate โ 2024-03-20 16:01:28 โ
โ xcp-volume-01611aa8-688b-470a-92ee-21c56de16cdf โ r620-s1 โ 7003 โ Unused โ Ok โ UpToDate โ 2023-10-19 14:59:57 โ
โ xcp-volume-01611aa8-688b-470a-92ee-21c56de16cdf โ r620-s2 โ 7003 โ Unused โ Ok โ UpToDate โ 2023-10-19 14:59:57 โ
โ xcp-volume-01611aa8-688b-470a-92ee-21c56de16cdf โ r620-s3 โ 7003 โ Unused โ Ok โ TieBreaker โ 2023-10-19 14:59:56 โ
โ xcp-volume-07f73f51-95ea-4a82-ba03-ef65dfbfb967 โ r620-s1 โ 7010 โ Unused โ Ok โ UpToDate โ 2023-10-24 10:42:40 โ
โ xcp-volume-07f73f51-95ea-4a82-ba03-ef65dfbfb967 โ r620-s3 โ 7010 โ Unused โ Ok โ UpToDate โ 2023-10-24 10:42:40 โ
โ xcp-volume-10d2c269-35ef-4948-b7f0-dcd8db9b7815 โ r620-s1 โ 7021 โ Unused โ Ok โ UpToDate โ 2024-02-16 15:42:11 โ
โ xcp-volume-10d2c269-35ef-4948-b7f0-dcd8db9b7815 โ r620-s2 โ 7021 โ Unused โ Ok โ Diskless โ 2024-02-16 15:42:10 โ
โ xcp-volume-10d2c269-35ef-4948-b7f0-dcd8db9b7815 โ r620-s3 โ 7021 โ Unused โ Ok โ UpToDate โ 2024-02-16 15:42:11 โ
โ xcp-volume-13f2bcc0-c010-4637-9d10-d670f68a4ff4 โ r620-s1 โ 7012 โ Unused โ Ok โ UpToDate โ 2024-02-16 13:44:05 โ
โ xcp-volume-13f2bcc0-c010-4637-9d10-d670f68a4ff4 โ r620-s2 โ 7012 โ Unused โ Ok โ UpToDate โ 2024-02-16 13:44:05 โ
โ xcp-volume-13f2bcc0-c010-4637-9d10-d670f68a4ff4 โ r620-s3 โ 7012 โ Unused โ Ok โ TieBreaker โ 2024-02-16 13:44:04 โ
โฐโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
> linstor v list
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Node โ Resource โ StoragePool โ VolNr โ MinorNr โ DeviceName โ Allocated โ InUse โ State โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโก
โ r620-s1 โ xcp-persistent-database โ xcp-sr-linstor_group_thin_device โ 0 โ 1000 โ /dev/drbd1000 โ 67.54 MiB โ InUse โ UpToDate โ
โ r620-s2 โ xcp-persistent-database โ DfltDisklessStorPool โ 0 โ 1000 โ /dev/drbd1000 โ โ Unused โ Diskless โ
โ r620-s3 โ xcp-persistent-database โ DfltDisklessStorPool โ 0 โ 1000 โ /dev/drbd1000 โ โ Unused โ Diskless โ
โ r620-s1 โ xcp-persistent-ha-statefile โ xcp-sr-linstor_group_thin_device โ 0 โ 1001 โ /dev/drbd1001 โ 1 MiB โ Unused โ UpToDate โ
โ r620-s2 โ xcp-persistent-ha-statefile โ xcp-sr-linstor_group_thin_device โ 0 โ 1001 โ /dev/drbd1001 โ 1 MiB โ Unused โ UpToDate โ
โ r620-s3 โ xcp-persistent-ha-statefile โ xcp-sr-linstor_group_thin_device โ 0 โ 1001 โ /dev/drbd1001 โ 1 MiB โ Unused โ UpToDate โ
โ r620-s1 โ xcp-persistent-redo-log โ xcp-sr-linstor_group_thin_device โ 0 โ 1002 โ /dev/drbd1002 โ 2.50 MiB โ Unused โ UpToDate โ
โ r620-s2 โ xcp-persistent-redo-log โ xcp-sr-linstor_group_thin_device โ 0 โ 1002 โ /dev/drbd1002 โ 2.50 MiB โ Unused โ UpToDate โ
โ r620-s3 โ xcp-persistent-redo-log โ xcp-sr-linstor_group_thin_device โ 0 โ 1002 โ /dev/drbd1002 โ 2.50 MiB โ Unused โ UpToDate โ
โ r620-s1 โ xcp-volume-01611aa8-688b-470a-92ee-21c56de16cdf โ xcp-sr-linstor_group_thin_device โ 0 โ 1003 โ /dev/drbd1003 โ 163.47 MiB โ Unused โ UpToDate โ
โ r620-s2 โ xcp-volume-01611aa8-688b-470a-92ee-21c56de16cdf โ xcp-sr-linstor_group_thin_device โ 0 โ 1003 โ /dev/drbd1003 โ 163.47 MiB โ Unused โ UpToDate โ
โ r620-s3 โ xcp-volume-01611aa8-688b-470a-92ee-21c56de16cdf โ DfltDisklessStorPool โ 0 โ 1003 โ /dev/drbd1003 โ โ Unused โ TieBreaker โ
โ r620-s1 โ xcp-volume-07f73f51-95ea-4a82-ba03-ef65dfbfb967 โ xcp-sr-linstor_group_thin_device โ 0 โ 1010 โ /dev/drbd1010 โ 728.63 MiB โ Unused โ UpToDate โ
โ r620-s3 โ xcp-volume-07f73f51-95ea-4a82-ba03-ef65dfbfb967 โ xcp-sr-linstor_group_thin_device โ 0 โ 1010 โ /dev/drbd1010 โ 728.63 MiB โ Unused โ UpToDate โ
โ r620-s1 โ xcp-volume-10d2c269-35ef-4948-b7f0-dcd8db9b7815 โ xcp-sr-linstor_group_thin_device โ 0 โ 1021 โ /dev/drbd1021 โ 10.27 MiB โ Unused โ UpToDate โ
โ r620-s2 โ xcp-volume-10d2c269-35ef-4948-b7f0-dcd8db9b7815 โ DfltDisklessStorPool โ 0 โ 1021 โ /dev/drbd1021 โ โ Unused โ Diskless โ
โ r620-s3 โ xcp-volume-10d2c269-35ef-4948-b7f0-dcd8db9b7815 โ xcp-sr-linstor_group_thin_device โ 0 โ 1021 โ /dev/drbd1021 โ 10.27 MiB โ Unused โ UpToDate โ
โ r620-s1 โ xcp-volume-13f2bcc0-c010-4637-9d10-d670f68a4ff4 โ xcp-sr-linstor_group_thin_device โ 0 โ 1012 โ /dev/drbd1012 โ 10.27 MiB โ Unused โ UpToDate โ
โ r620-s2 โ xcp-volume-13f2bcc0-c010-4637-9d10-d670f68a4ff4 โ xcp-sr-linstor_group_thin_device โ 0 โ 1012 โ /dev/drbd1012 โ 10.27 MiB โ Unused โ UpToDate โ
โ r620-s3 โ xcp-volume-13f2bcc0-c010-4637-9d10-d670f68a4ff4 โ DfltDisklessStorPool โ 0 โ 1012 โ /dev/drbd1012 โ โ Unused โ TieBreaker โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
DRBD/LINSTOR Resource Stateโ
A DRBD/LINSTOR resource can be in several states, the main ones are:
- UpToDate: No issue with the resource!
- DUnknown: Communication issue getting the resource's state. An incorrect IP address, a problem with the network or with a satellite can cause this.
- Inconsistent: This can happen on replications when a new resource is created or during a new synchronization.
- Diskless: The resource doesn't store the data locally but has a DRBD path to read/write, using the network.
- TieBreaker: To protect against loss of quorum, each diskful and diskless DRBD acts as a tie-breaker. The reason for displaying this state using the
linstor r listis because there is a specific case when it is explicitly visible: when a resource is not available on a host. No diskful nor diskless means no/dev/drbdXXXXpath.
For more info, please visit this page.
drbd-reactorโ
Several services are necessary for LINSTOR to work properly on XCP-ng. The most trivial are the linstor-controller and the linstor-satellite services.
Never manually start a controller on a pool where an SR is already configured. There is a reason for this and it's called high availability: a controller must always be available. If a host that was running the controller is rebooted, another machine will start another controller. A daemon called drbd-reactor automatically handles the startup process.
The drbd-reactor is a daemon implemented to react to DRBD events and respond using scripts.
It has a modified configuration on XCP-ng so that it can always be restarted in the event of a problem:
/etc/systemd/system/drbd-reactor.service.d/override.conf
It is configured using:
- A modification of the satellite configuration:
> cat /etc/systemd/system/linstor-satellite.service.d/override.conf
[Service]
Environment=LS_KEEP_RES=^xcp-persistent.*
[Unit]
After=drbd.service
As noted in the shared database section, the controller uses a DRBD volume containing the LINSTOR database instead of a simple local folder on a host. This database must be accessible after a reboot, meaning that /dev/drbd/by-res/xcp-persistent-database/0 must be accessible on at least one machine (normally 3, since this volume is always replicated 3 times). A path like that is generated using a DRBD resource config file. These configurations are automatically created by LINSTOR itself and they are not persistent: they are recreated each time the controller is started after a pool reboot. The only way to keep a DRBD config file at boot is to use the LS_KEEP_RES environment variable to indicate it to LINSTOR.
- A
drbd-reactorconfiguration that uses the linbit promoter plugin:
> cat /etc/drbd-reactor.d/sm-linstor.toml
[[promoter]]
[promoter.resources.xcp-persistent-database]
start = [ "var-lib-linstor.service", "linstor-controller.service" ]
This plugin allows the running of resources when a resource has a quorum and is not primary. In our case, we start var-lib-linstor.service which mounts the database /dev/drbd1000 on /var/lib/linstor. If successful, we can start the controller. Only one host can mount the database since only one primary is on the resource. Quick reminder: when a resource is mounted on a host, it takes the primary lock.
For more info regarding the promoter plugin, you can visit this page.
- The
/etc/systemd/system/var-lib-linstor.serviceconfig file that contains:
[Unit]
Description=Mount filesystem for the LINSTOR controller
[Service]
Type=oneshot
ExecStart=/bin/mount -w /dev/drbd/by-res/xcp-persistent-database/0 /var/lib/linstor
ExecStop=/opt/xensource/libexec/safe-umount /var/lib/linstor
RemainAfterExit=true
โ Howto and Questionsโ
๐ฅ Installationโ
Prerequisitesโ
- At least 3 hosts: DRBD uses a quorum algorithm that needs at least 3 reachable machines to correctly replicate resources and avoid the risk of split-brain.
- A dedicated 10G or higher network interface for DRBD. It's possible to use the same interface used for host management (XAPI) but it's recommended to use a dedicated interface.
- At least 1 disk on any machine of the pool (case without replication). Otherwise, any number of disks can be used on a machine. However, to be consistent, we recommend using the same model and number for each machine that has disks.
- The replication/place count must be equal to 1, 2 or 3.
Changing the replication factor after creating XOSTOR is not possible, as it can lead to significant issues and is therefore not supported.
- LINSTOR services like satellites and controller can use a lot of memory resources. It is therefore more than necessary to have sufficient RAM allocated to the Dom-0, 16 GiB can be enough for average pools with around a hundred volumes. But it may be essential to increase the dedicated memory for more intensive use. So make sure to monitor the memory usage of your pool to prevent the OOM Killer from being triggered.
The maximum number of machines per pool is 7.
โป๏ธ Updateโ
See this documentation: RPU.
โฌ๏ธ Upgradeโ
If you are reading this documentation, we assume that you want to upgrade a pool on which XOSTOR is deployed, i.e. change the version of XCP-ng, for example from 8.2 to 8.3. For updates that don't change the version number of XCP-ng (bugfixes, security fixes), see the update section.
1. Prerequisitesโ
- All hosts must be up to date on the version of XCP-ng you are currently using. For this refer to the update section.
- HA must be disabled on your pool.
- Ensure all nodes are reachable and resources are in "OK" state via XO's XOSTOR view. Alternatively, you can use the CLI:
# linstor n l # linstor r l # linstor adv r # linstor sp l
2. XCP-ng ISO with LINSTOR supportโ
To upgrade your XCP-ng LINSTOR pool without issues, you need to use a dedicated ISO with linstor-upgradeonly in its name.
Also don't try to upgrade using CLI or network ISO installer.
The dedicated upgrade ISO can be downloaded from https://repo.vates.tech/xcp-ng/isos/.
LINSTOR has several prerequisites to work correctly and if you don't use the right upgrade image:
- LINSTOR's controller and satellite packages would be removed.
- Specific LINSTOR services would be removed through the use of a generic XCP-ng ISO.
- DRBDs/LINSTOR ports would not be open on the resulting upgraded host.
3. Upgrade stepsโ
From this point we can proceed to upgrade your XOSTOR-enabled pool.
An upgrade can take quite a long time so we recommend disabling the auto-evict mechanism during this procedure to avoid bad behavior. On the host where the controller is running:
# linstor controller set-property DrbdOptions/AutoEvictAllowEviction False
For each host of the pool (starting with the master), follow the instructions given in this guide.
Do not update the host following an upgrade until all hosts in the XOSTOR pool have been upgraded. Otherwise, it could pull more recent versions of the LINSTOR packages on the newly upgraded hosts. LINSTOR packages versions need to be aligned on the whole pool.
If you have this error during upgrade, you must download the right ISO version as documented in this section:
Cannot upgrade host with LINSTOR using a package source that does not have LINSTOR. Please use as package source the repository on the dedicated ISO.
If you want to make sure that everything is going well so as not to impact your production, we recommend these manual checks after each host reboot:
- Ensure the host node is connected with the command below. Otherwise wait a few seconds.
# linstor n list
- Check if there is an issue with the resources:
# linstor r list # linstor advise r # Give possible fix commands in case of problems.
- Check in XOA that the PBD of the SR of this host is connected. If not, connect it.
Very important: if you don't want to break the quorum or your production environment, you must execute the commands given above after upgrading a host and do not reboot/upgrade the others until the host's satellite is operational and its PBD is plugged.
4. After pool upgradeโ
- If you have deactivated auto eviction as recommended, it's necessary to reactivate it. On the host where the controller resides, execute this command:
# linstor controller set-property DrbdOptions/AutoEvictAllowEviction True
If a node was evicted because the recommendation was not followed, read this topic.
- Check the resource states with:
# linstor r list
In case of bad sync between volumes, execute on each machine:
# systemctl stop linstor-controller # systemctl restart linstor-satellite
- In case of a bad node (missing, without storage pool or inaccessible via
linstor n l/linstor sp l) due to a failed upgrade or if the documentation was not followed correctly, you can read this documentation to recover.
๐ฌ Global questionsโ
The linstor command does not work!?โ
If you get the following output, this is not necessarily abnormal:
> linstor r list
Error: Unable to connect to linstor://localhost:3370: [Errno 99] Cannot assign requested address
There can only be one controller running on a pool at a time. If you get this error, there are two possibilities:
- Either there is a problem and the
linstor-controllerservice is not started anywhere. - Or you should rerun the command on another machine.
It's possible to provide the command with a comma separated list of IPs, eliminating the need to manually try each host.
# linstor --controllers=<IP_LIST> r list
Example on a pool with 3 machines:
# linstor --controllers=172.16.210.84,172.16.210.85,172.16.210.86 r list
Important: the --controllers parameter should always be just after the command name and before the action.
:::
How to list LINSTOR resources and interpret this output?โ
Command:
# linstor r list
Output example:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ResourceName โ Node โ Port โ Usage โ Conns โ State โ CreatedOn โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโก
โ xcp-persistent-database โ r620-s1 โ 7000 โ InUse โ Ok โ UpToDate โ 2023-06-13 18:40:06 โ
โ xcp-persistent-database โ r620-s2 โ 7000 โ Unused โ Ok โ UpToDate โ 2023-06-13 18:40:04 โ
โ xcp-persistent-database โ r620-s3 โ 7000 โ Unused โ Ok โ UpToDate โ 2023-06-13 18:40:04 โ
โ xcp-persistent-ha-statefile โ r620-s1 โ 7001 โ Unused โ Ok โ UpToDate โ 2024-03-20 16:01:18 โ
โ xcp-persistent-ha-statefile โ r620-s2 โ 7001 โ Unused โ Ok โ UpToDate โ 2024-03-20 16:01:14 โ
โ xcp-persistent-ha-statefile โ r620-s3 โ 7001 โ Unused โ Ok โ UpToDate โ 2024-03-20 16:01:18 โ
โ xcp-persistent-redo-log โ r620-s1 โ 7002 โ Unused โ Ok โ UpToDate โ 2024-03-20 16:01:27 โ
โ xcp-persistent-redo-log โ r620-s2 โ 7002 โ Unused โ Ok โ UpToDate โ 2024-03-20 16:01:23 โ
โ xcp-persistent-redo-log โ r620-s3 โ 7002 โ Unused โ Ok โ UpToDate โ 2024-03-20 16:01:28 โ
โ xcp-volume-01611aa8-688b-470a-92ee-21c56de16cdf โ r620-s1 โ 7003 โ Unused โ Ok โ UpToDate โ 2023-10-19 14:59:57 โ
โ xcp-volume-01611aa8-688b-470a-92ee-21c56de16cdf โ r620-s2 โ 7003 โ Unused โ Ok โ UpToDate โ 2023-10-19 14:59:57 โ
โ xcp-volume-01611aa8-688b-470a-92ee-21c56de16cdf โ r620-s3 โ 7003 โ Unused โ Ok โ TieBreaker โ 2023-10-19 14:59:56 โ
โ xcp-volume-07f73f51-95ea-4a82-ba03-ef65dfbfb967 โ r620-s1 โ 7010 โ Unused โ Ok โ UpToDate โ 2023-10-24 10:42:40 โ