-
23rd May, 2008No Comments
Extracting language strings from PHP is best done woth xgettext… in order you are using the _(”) function to specify your text fragments.
Afterwards on the server you must run the following command to create a translatable *.po file which then can be eidtied using programs like poEdit:
find . -iname ‘*.php’ -exec xgettext –keyword=_ -j -o messages.po {} \; -
22nd May, 2008Comments Off
Hi,
A quick guide on how to create selfsigned certificates using openssl:
Setup Ca environment:
vi /etc/pki/tls/openssl.cnf
dir = /usr/local/lib/CA # Where everything is kept
cd /usr/local/lib mkdir CA mkdir newcerts private echo '01' > serial touch index.txt cd /usr/local/lib/CA
Generate key:
openssl genrsa -des3 -out server.key 1024
Generating RSA private key, 1024 bit long modulus
......................................++++++
................................................++++++
e is 65537 (0x10001)
Enter pass phrase for server.key:
Verifying - Enter pass phrase for server.key:
Generate self signed root certificate:
openssl req -new -x509 -days 3560 -key server.key -out server.crt
Enter pass phrase for server.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:BE
State or Province Name (full name) [Berkshire]:Antwerpen
Locality Name (eg, city) [Newbury]:Berchem
Organization Name (eg, company) [My Company Ltd]:FirstServed NV/SA
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:ca.firstserved.net
Email Address []:nospam@firstserved.net
Create client key:
openssl genrsa -out quorumd.key 1024
Generating RSA private key, 1024 bit long modulus
............++++++
.........................................................++++++
e is 65537 (0x10001)
Create the certificate request for the client:
openssl req -new -days 3560 -key quorumd.key -out quorumd.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:BE
State or Province Name (full name) [Berkshire]:Antwerpen
Locality Name (eg, city) [Newbury]:Berchem
Organization Name (eg, company) [My Company Ltd]:FirstServed NV/SA
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:bemobile
Email Address []:nospam@firstserved.net
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Sign the request using your self-signed certificate:
openssl ca -days 3560 -in quorumd.csr -cert server.crt -keyfile server.key -out quorumd.crt
Using configuration from /etc/pki/tls/openssl.cnf
Enter pass phrase for server.key:
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 1 (0x1)
Validity
Not Before: May 22 10:44:49 2008 GMT
Not After : Feb 19 10:44:49 2018 GMT
Subject:
countryName = BE
stateOrProvinceName = Antwerpen
organizationName = FirstServed NV/SA
commonName = bemobile
emailAddress = nospam@firstserved.net
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
29:A5:E4:6A:F4:4E:89:35:5D:7D:C6:9A:CE:B9:D0:1B:75:0A:7F:8C
X509v3 Authority Key Identifier:
keyid:4B:B2:BA:F6:65:66:60:EB:CC:45:F5:57:34:FB:E9:AB:40:CF:B4:E8
Certificate is to be certified until Feb 19 10:44:49 2018 GMT (3560 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
That should do it.
Koen
-
8th May, 2008Comments Off
Hi,
After tweaking your storage repositories you might want to change the value for the default SR.
This can be done using the following command:
xe pool-param-set uuid=1ad826b1-9c9f-fd8a-3a50-b8ce3a0841af default-SR=8312500f-9962-59ff-9b0e-797987963750Don’t forget to change the uuids to the ones that match your configuration!
Koen
-
8th May, 2008No Comments
Hi,
After being able to mirror the data of my guests using a DRBD setup between 2 servers, I obviously wanted to copy the config of these guest machines to.
(Otherwise the data mirror would be rather useless.)
But since I did already have all the data perfectly in sync, I did not want to do a complete export of the virtual machine.
I found an option which allows you to backup only the configuration (metadata) of a guest machine. This way you are free to setup your own data mirrorring solution.
The command:
[root@snake ~]# xe vm-export vm=12c2ee4d-16fd-5564-0589-9f302e4aa329 filename=/root/ddk –metadataTo import the data, just copy the file (here /root/ddk) over to your other server and use the following command to import your guest:
[root@jeremy ~]# xe vm-import filename=/root/ddk –metadata
You might need to manually specify the SR, in which case the command becomes:
xe vm-import filename=/root/ddk sr-uuid=8312500f-9962-59ff-9b0e-797987963750 –metadata(Please note that wordpress doesn’t like the 2 hyphens before the word metadata and displays only one, the option is "- -metadata" without the space between those 2 hyphens.)
Don’t you just love these undocumented switches?
Koen
-
8th May, 2008No Comments
Hi,
Using DRBD on Xenserver is fairly simple.
Just download the Driver Development kit from Citrix for XenServer 4.1.
Import the DDK to your server.
Download your DRBD release (source code) of choice (we used version 8.2.5).
Put it inside the DDK, extract, run the magical command "make rpm" and off you go!The packages will be ready soon. Just SCP them out of your DDK to any Xenserver you want to install them on.
No additional dependencies are needed to be resolved.BEWARE: Citrix doesn’t support custom modules (and most likely they won’t ever support DRBD).
Kind Regards,
Koen
-
8th May, 2008No Comments
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.0First 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/drbd0The 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-Flq9pXWe 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=lvmWhen 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 XenServerNow 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/drbd0Now 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): falseThe last action to do is to attach the PBD to the system:
xe pbd-plug uuid=19f7f1df-7679-bd59-604e-37110e72ad3fAnd you should be ready to go!
Koen
-
8th May, 2008No Comments
Hi,
This entry describes how to remove a Xen storage repository from a XenServer 4.1 Server.
Removal of a Storage repository may be needed after damage to the disk has occured or when organising one or more xen servers in a custom setup.When trying to remove a SR, you might encounter nasty error messages like:
[root@jeremy ~]# xe pbd-destroy uuid=4c057786-4fd3-eefa-c098-39a2e9eabbf2
You attempted an operation that was not allowed.
reason: PBD is currently attached
[root@jeremy ~]# xe sr-forget uuid=d22f5ac3-4f8d-cb7c-85ed-eb32288d8371
The SR is still connected to a host via a PBD. It cannot be destroyed.
sr: d22f5ac3-4f8d-cb7c-85ed-eb32288d8371 (Local storage)So here is a small explanation on how to really remove your repository.
First of all, find the uuid of your Storage repositiry using "xe sr-list"
uuid ( RO) : e98c3da7-14f7-c2ae-3a15-c50965244cc9
name-label ( RW): storage
name-description ( RW):
host ( RO): jeremy.firstserved.net
type ( RO): lvm
content-type ( RO): diskNow search the corresponding PBD entry using "xe pbd-list":
uuid ( RO) : 4c057786-4fd3-eefa-c098-39a2e9eabbf2
host-uuid ( RO): 38e2b381-697d-4a11-971d-53ed1dcecd72
sr-uuid ( RO): e98c3da7-14f7-c2ae-3a15-c50965244cc9
device-config (MRO): device: /dev/drbd0
currently-attached ( RO): trueAs you can see, the SR (Storage Repository) can easily be tracked using the uuid.
Now unplug the PBD from the SR:
xe pbd-unplug uuid=4c057786-4fd3-eefa-c098-39a2e9eabbf2This allows you to either forget or destroy the SR:
xe sr-destroy uuid=e98c3da7-14f7-c2ae-3a15-c50965244cc9As you can see, the storage repository has been removed from the system:
[root@jeremy ~]# xe sr-list
uuid ( RO) : b7060810-f98f-ddfc-2c1a-e829570ed373
name-label ( RW): Removable storage
name-description ( RW):
host ( RO): jeremy.firstserved.net
type ( RO): udev
content-type ( RO): diskuuid ( RO) : b89f976a-46e3-3e88-febd-685d624cffa3
name-label ( RW): XenServer Tools
name-description ( RW): XenServer Tools ISOs
host ( RO): jeremy.firstserved.net
type ( RO): iso
content-type ( RO): isouuid ( RO) : 861138a5-f359-74a7-93f1-c20fbdb1c8a0
name-label ( RW): DVD drives
name-description ( RW): Physical DVD drives
host ( RO): jeremy.firstserved.net
type ( RO): udev
content-type ( RO): isoGreets,
Koen







