FirstServed Tech Blog - FirstServed and the Art of Server Tuning

How to create one storage repository for two servers

Hi,

In this entry I will try to explain how to create one storage repository on a device used by two Xenservers.
Such a setup may be archieved by using DRBD in a primary-primary state between the Xenservers.
The Xenserver version used for this entry is: 4.1.0

First of all, create some room, this can be done by removing your old repository.
www.firstserved.net/blog/2008/05/08/how-to-remove-a-storage-repository/

On your primary server, this command should cover about everything (PBD + SR creation):
xe sr-create name-label=SR-DRBD0 type=lvm shared=false device-config:device=/dev/drbd0

The secondary server however needs some more care:
As you can see with the command "vgdisplay", the command on the primary server has already created a volume group for the data:
[root@jeremy ~]# vgdisplay
  — Volume group —
  VG Name               VG_XenStorage-8312500f-9962-59ff-9b0e-797987963750
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               258.15 GB
  PE Size               4.00 MB
  Total PE              66087
  Alloc PE / Size       0 / 0
  Free  PE / Size       66087 / 258.15 GB
  VG UUID               0bdET3-DGv5-KSX2-4rag-vgDA-ClmD-Flq9pX

We can’t just delete this because that would break our primary server.

So we introduce the new storage repository on our secondary server instead of creating a new one using the same parameters and uuid as our primary server:
xe sr-introduce name-label=SR-DRBD0 uuid=8312500f-9962-59ff-9b0e-797987963750 shared=false type=lvm

When we now ask a listing of the Storage Repositories, we get this new entry:
uuid ( RO)                : 8312500f-9962-59ff-9b0e-797987963750
          name-label ( RW): SR-DRBD0
    name-description ( RW):
                host ( RO): <not in database>
                type ( RO): lvm
        content-type ( RO): disks
As you can see, some data is still missing.
This data will be filled up after creating the PBD.
(The command xe sr-introduce doesn’t create a PBD for the introduced SR.)
For the creation of a PBD, you will need the hosts uuid, which can be found using:
[root@jeremy ~]# xe host-list
uuid ( RO)                : 38e2b381-697d-4a11-971d-53ed1dcecd72
          name-label ( RW): jeremy.firstserved.net
    name-description ( RO): Default install of XenServer

Now we are ready to create the PBD:
xe pbd-create host-uuid=38e2b381-697d-4a11-971d-53ed1dcecd72 sr-uuid=8312500f-9962-59ff-9b0e-797987963750 device-config:device=/dev/drbd0

Now we can see the new PBD in the listing:
[root@jeremy ~]# xe pbd-list
uuid ( RO)                  : 19f7f1df-7679-bd59-604e-37110e72ad3f
             host-uuid ( RO): 38e2b381-697d-4a11-971d-53ed1dcecd72
               sr-uuid ( RO): 8312500f-9962-59ff-9b0e-797987963750
         device-config (MRO): device: /dev/drbd0
    currently-attached ( RO): false

The last action to do is to attach the PBD to the system:
xe pbd-plug uuid=19f7f1df-7679-bd59-604e-37110e72ad3f

And you should be ready to go!

Koen

Leave a Reply

You must be logged in to post a comment.