Le blog de Jean David TECHER, un Réunionnais à Saint-Priest/Lyon

Aller au contenu | Aller au menu | Aller à la recherche


1 2 3 >

lundi 28 novembre 2011

Slony 1.2: Using EnterpriseDB Advanced Server 8.3.0.112 with Slony 1.2.23 instead of Slony 1.2.11

It is possible to build Slony 1.2.23 against EnterpriseDB but the use of slonik will fail. The patch has been done put on branch Slony 2.X not in Slony 1.2.X. Here we will see how to compile Slony 1.2.23 against EnterpriseDB 8.3.0.112.

1. Binaries: Download / Installation

VersionDownload
Linux 32 Bitshttp://www.davidgis.fr/download/EDB830112_Slony-1.2.23_linux-x86.tar.bz2'
Linux 64 Bitshttp://www.davidgis.fr/download/EDB830112_Slony-1.2.23_linux-x86-64.tar.bz2'
    IMPORTANT: KEEP IN MIND THAT MY GOAL IS NOT TO REPLACE THE SLONY'S BINARIES 1.2.11 BUNDLED WITH ENTERPRISEDB 8.3.0.112. SINCE ENTERPRISEDB IS NOT RESPONSIBLE/ DOES NOT SUPPORT FOR THE USE OF SLONY 1.2.23, I'VE DECIDED TO CHOICE A "HARDCODED" PATH FOR SLONY 1.2.23: /opt/slony/1.2.23. IT IMPLIES THAT SLONY'S BINARIES 1.2.11 WILL NOT BE REPLACED :)
  • Download the required file
    # 32 Bits
    wget -q http://www.davidgis.fr/download/EDB830112_Slony-1.2.23_linux-x86.tar.bz2
    # 64 bits
    wget -q http://www.davidgis.fr/download/EDB830112_Slony-1.2.23_linux-x86-64.tar.bz2
  • (As root), decompress to '/'
    # 32 Bits
    tar xjf EDB830112_Slony-1.2.23_linux-x86.tar.bz2 -C /
    # 64 bits
    tar xjf http://www.davidgis.fr/download/EDB830112_Slony-1.2.23_linux-x86-64.tar.bz2 -C /
slonik and slon are located to /opt/slony/1.2.23/bin. The required libraries are located to /opt/slony/1.2.23/lib

How to compile yourself

  1. As root, be sure to have all the prerequisites
    apt-get install build-essential perl bison flex
  2. As root, we are going to create a (temporary) symbolic link
    mkdir -pv /opt/slony-1.2.23
    ln -s /opt/PostgresPlus/8.3R2AS/dbserver/lib /opt/slony-1.2.23/lib
  3. As enterprisedb, download the last Slony's sources from branch 1.2
    wget "http://git.postgresql.org/gitweb/?p=slony1-engine.git;a=snapshot;h=af01af7786f0f4f6c5c5ea991200be04a431f586;sf=tgz" -O - | tar xvzf -
    cd slony1-engine-af01af7/
  4. As enterprisedb, apply the patch to build SLony against EnterpriseDB 8.3.0.112
    cd ~/slony1-engine-af01af7/
    wget http://www.davidgis.fr/download/patch_EnterpriseDB.patch  -O - | patch -p1
    Notice: the required patch could be found at Slony's Git Repository (http://git.postgresql.org/gitweb/?p=slony1-engine.git;a=commit;h=32728b33d460d650445b89281d134e33958fde34 It has been submitted by Mark Mielke (http://lists.slony.info/pipermail/slony1-general/2011-May/011681.html)
  5. As enterprisedb, configure Slony
    ./configure \
    --prefix=/opt/slony-1.2.23 \
    --with-pgconfigdir=/opt/PostgresPlus/8.3R2AS/dbserver/bin/ \
    --with-perlsharedir=/opt/slony-1.2.23/lib \
    --with-pgsharedir=/opt/slony-1.2.23/share \
    --with-perltools=/opt/slony-1.2.23/scripts \
    --with-pglibdir=/opt/slony-1.2.23/lib \
    --with-pgpkglibdir=/opt/slony-1.2.23/lib
    Replace now '$libdir' by the harcoded path '/opt/slony-1.2.23/lib'
    grep -lriE '\$libdir' . | while read file;do sed -i 's:\$libdir:/opt/slony-1.2.23/lib:g' $file;done
    Compile
    make
  6. As root, delete the symbolic link
    rm -rf /opt/slony-1.2.23
    Install Slony
    cd ~enterprisedb/slony1-engine-af01af7
    make install
    Put the required rights on '/opt/slony', something like
    chmod 777 -R /opt/slony

dimanche 27 novembre 2011

Création d'un domU PVOPS Ubuntu Hardy 8.04 64 bits sous Xen 4.2 unstable / Kernel 3.1.0

Voici mes différentes notes à ce sujet. L'installation se fait à partir des xen-tools

1. Xen-tools: Fichier de configuration

Remarque: contrairement à Ubuntu Lucid, il n'est pas nécessaire d'utiliser pygrub
root@mercury:~# cat /etc/xen-tools/templates/xen-tools-Ubuntu-hardy.conf
lvm = xenvg
install-method = debootstrap
size   = 20Gb      # Disk image size.
memory = 1024    # Memory size
swap   = 2048Mb    # Swap size
fs     = ext3     # use the EXT3 filesystem for the disk image.
dist   = hardy     # Default distribution to install.
image  = sparse   # Specify sparse vs. full disk images.
gateway   = 192.168.2.253
netmask   = 255.255.255.0
broadcast = 192.168.2.255
passwd = 1
accounts = 0
kernel      = /boot/vmlinuz-`uname -r`
initrd      = /boot/initrd.img-`uname -r`
#arch = i386
arch  = amd64
mirror = http://fr.archive.ubuntu.com/ubuntu
ext3_options   = noatime,nodiratime,errors=remount-ro
ext2_options   = noatime,nodiratime,errors=remount-ro
xfs_options    = defaults
reiser_options = defaults
serial_device = hvc0
disk_device = xvda
output    = /etc/xen/machines
extension = .cfg
role=udev

Création de la machine

Par l'invocation de la commande xen-create-image
root@mercury:~# xen-create-image --force --hostname=mercury-xen06  --ip=192.168.2.231   --config=/etc/xen-tools/templates/xen-tools-Ubuntu-hardy.conf

General Information
--------------------
Hostname       :  mercury-xen06
Distribution   :  hardy
Mirror         :  http://fr.archive.ubuntu.com/ubuntu
Partitions     :  swap            2048Mb (swap)
                  /               20Gb  (ext3)
Image type     :  full
Memory size    :  1024b
Kernel path    :  /boot/vmlinuz-3.1.0
Initrd path    :  /boot/initrd.img-3.1.0

Networking Information
----------------------
IP Address 1   : 192.168.2.231 [MAC: 00:16:3E:BF:B6:67]
Netmask        : 255.255.255.0
Broadcast      : 192.168.2.255
Gateway        : 192.168.2.253


Creating swap on /dev/xenvg/mercury-xen06-swap
Done

Creating ext3 filesystem on /dev/xenvg/mercury-xen06-disk
Done
Installation method: debootstrap
Done

Running hooks
Done

Role: udev
	File: /etc/xen-tools/role.d/udev
Role script completed.

Creating Xen configuration file
Done
Setting up root password
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
All done


Logfile produced at:
	 /var/log/xen-tools/mercury-xen06.log

Installation Summary
---------------------
Hostname        :  mercury-xen06
Distribution    :  hardy
IP-Address(es)  :  192.168.2.231 
RSA Fingerprint :  a1:07:37:a1:b7:1f:2c:2c:95:8c:a2:60:68:98:8e:04
Root Password   :  N/A

samedi 26 novembre 2011

Xen - Intel VT-d sur Core 5 2400 / VGA PassThrough sur Carte NVIDIA EVGA GTX 460 SE 1024: Nouveaus patchs

Faisant suite à ce billet, voici les nouveaux patchs. Ces derniers sont aussi téléchargeables ici
--- xen-unstable.hg-rev-24232_b/tools/firmware/hvmloader/acpi/dsdt.asl	2011-11-25 21:55:23.000000000 +0100
+++ xen-unstable.hg-rev-24232_a/tools/firmware/hvmloader/acpi/dsdt.asl	2011-11-26 14:19:33.000000000 +0100
@@ -142,15 +142,43 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2,
                         0x00000000,
                         0x00020000)
 
+                    /* reserve MMIO BARs of gfx for 1:1 mapping */
                     DWordMemory(
                         ResourceProducer, PosDecode, MinFixed, MaxFixed,
                         Cacheable, ReadWrite,
                         0x00000000,
-                        0xF0000000,
-                        0xF4FFFFFF,
+                        0xF8000000,
+                        0xF9FFFFFF,
                         0x00000000,
-                        0x05000000,
-                        ,, _Y01)
+                        0x02000000)
+
+                    DWordMemory(
+                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
+                        NonCacheable, ReadWrite,
+                        0x00000000,
+                        0xD0000000,
+                        0xD7FFFFFF,
+                        0x00000000,
+                        0x08000000)
+
+                    DWordMemory(
+                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
+                        Cacheable, ReadWrite,
+                        0x00000000,
+                        0xD8000000,
+                        0xDBFFFFFF,
+                        0x00000000,
+                        0x4000000)
+
+                    DWordMemory(
+                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
+                        Cacheable, ReadWrite,
+                        0x00000000,
+                        0xFB000000,
+                        0xFB07FFFF,
+                        0x00000000,
+                        0x00080000,                        
+			,, _Y01)
                 })
 
                 CreateDWordField(PRT0, \_SB.PCI0._CRS._Y01._MIN, MMIN)
--- xen-unstable.hg-rev-24232_b/tools/firmware/hvmloader/hvmloader.c	2011-11-25 21:55:23.000000000 +0100
+++ xen-unstable.hg-rev-24232_a/tools/firmware/hvmloader/hvmloader.c	2011-11-26 14:19:33.000000000 +0100
@@ -31,6 +31,7 @@
 #include 
 
 #define ROM_INCLUDE_VGABIOS
+#define ROM_INCLUDE_PTVGABIOS
 #define ROM_INCLUDE_ETHERBOOT
 #include "roms.inc"
 
@@ -113,6 +114,9 @@ asm (
 
 unsigned long scratch_start = SCRATCH_PHYSICAL_ADDRESS;
 
+/* virtual BDF of pass-throughed gfx */
+uint8_t gfx_bdf;
+
 static void init_hypercalls(void)
 {
     uint32_t eax, ebx, ecx, edx;
@@ -310,6 +314,20 @@ static int pci_load_option_roms(unsigned
     return rom_phys_addr - rom_base_addr;
 }
 
+static void init_vm86_tss(void)
+{
+    void *tss;
+    struct xen_hvm_param p;
+
+    tss = mem_alloc(128, 128);
+    memset(tss, 0, 128);
+    p.domid = DOMID_SELF;
+    p.index = HVM_PARAM_VM86_TSS;
+    p.value = virt_to_phys(tss);
+    hypercall_hvm_op(HVMOP_set_param, &p);
+    printf("vm86 TSS at %08lx\n", virt_to_phys(tss));
+}
+
 /* Replace possibly erroneous memory-size CMOS fields with correct values. */
 static void cmos_write_memory_size(void)
 {
@@ -336,25 +354,6 @@ static void cmos_write_memory_size(void)
     cmos_outb(0x35, (uint8_t)( alt_mem >> 8));
 }
 
-/*
- * Set up an empty TSS area for virtual 8086 mode to use. 
- * The only important thing is that it musn't have any bits set 
- * in the interrupt redirection bitmap, so all zeros will do.
- */
-static void init_vm86_tss(void)
-{
-    void *tss;
-    struct xen_hvm_param p;
-
-    tss = mem_alloc(128, 128);
-    memset(tss, 0, 128);
-    p.domid = DOMID_SELF;
-    p.index = HVM_PARAM_VM86_TSS;
-    p.value = virt_to_phys(tss);
-    hypercall_hvm_op(HVMOP_set_param, &p);
-    printf("vm86 TSS at %08lx\n", virt_to_phys(tss));
-}
-
 static void apic_setup(void)
 {
     /* Set the IOAPIC ID to the static value used in the MP/ACPI tables. */
@@ -488,8 +487,10 @@ int main(void)
             break;
         case VGA_pt:
             printf("Loading VGABIOS of passthroughed gfx ...\n");
-            vgabios_sz = round_option_rom(
-                (*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 512);
+        memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
+               vgabios_pt, sizeof(vgabios_pt));
+        *(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS + sizeof(vgabios_pt)) = gfx_bdf;
+        vgabios_sz = round_option_rom(sizeof(vgabios_pt) + 1);
             break;
         default:
             printf("No emulated VGA adaptor ...\n");
@@ -528,7 +529,7 @@ int main(void)
         hypercall_hvm_op(HVMOP_set_param, &p);
     }
 
-    init_vm86_tss();
+   init_vm86_tss();
 
     cmos_write_memory_size();
 
--- xen-unstable.hg-rev-24232_b/tools/firmware/hvmloader/Makefile	2011-11-25 21:55:23.000000000 +0100
+++ xen-unstable.hg-rev-24232_a/tools/firmware/hvmloader/Makefile	2011-11-26 14:19:33.000000000 +0100
@@ -56,6 +56,7 @@ CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl
 else
 CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin
 endif
+PTVGA_ROM     := ../vgabios/vgabios-pt.bin
 
 .PHONY: all
 all: subdirs-all
@@ -94,6 +95,11 @@ ifneq ($(CIRRUSVGA_ROM),)
 	sh ./mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
 	echo "#endif" >> $@.new
 endif
+ifneq ($(PTVGA_ROM),)
+	echo "#ifdef ROM_INCLUDE_PTVGABIOS" >> $@.new
+	sh ./mkhex vgabios_pt $(PTVGA_ROM) >> $@.new
+	echo "#endif" >> $@.new
+endif
 
 	echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> $@.new
 	cat ../etherboot/eb-roms.h >> $@.new
--- xen-unstable.hg-rev-24232_b/tools/ioemu-remote/hw/pass-through.c	2011-11-26 17:28:22.000000000 +0100
+++ xen-unstable.hg-rev-24232_a/tools/ioemu-remote/hw/pass-through.c	2011-11-26 14:19:33.000000000 +0100
@@ -3243,6 +3243,8 @@ static int pt_cmd_reg_read(struct pt_dev
 }
 
 /* read BAR */
+static int gfx_first_read_BAR[7] = {1, 1, 1, 1, 1, 1, 1};
+
 static int pt_bar_reg_read(struct pt_dev *ptdev,
         struct pt_reg_tbl *cfg_entry,
         uint32_t *value, uint32_t valid_mask)
@@ -3265,6 +3267,17 @@ static int pt_bar_reg_read(struct pt_dev
     /* use fixed-up value from kernel sysfs */
     *value = ptdev->pci_dev->base_addr[index];
 
+    if ( ptdev->pci_dev->device_class == 0x300 )
+    {
+        if ( gfx_first_read_BAR[index] == 1 )
+        {
+            gfx_first_read_BAR[index] = 0;
+            PT_LOG("first read BARs of gfx\n");
+            return 0;
+        }
+    }
+
+
     /* set emulate mask depend on BAR flag */
     switch (ptdev->bases[index].bar_flag)
     {
--- xen-unstable.hg-rev-24232_b/tools/firmware/hvmloader/pci.c	2011-11-25 21:55:23.000000000 +0100
+++ xen-unstable.hg-rev-24232_a/tools/firmware/hvmloader/pci.c	2011-11-26 17:03:42.000000000 +0100
@@ -34,6 +34,10 @@ unsigned long pci_mem_end = PCI_MEM_END;
 enum virtual_vga virtual_vga = VGA_none;
 unsigned long igd_opregion_pgbase = 0;
 
+/* virtual BDF of pass-throughed gfx declared in hvmloader.c*/
+extern uint8_t gfx_bdf;
+
+
 void pci_setup(void)
 {
     uint32_t base, devfn, bar_reg, bar_data, bar_sz, cmd, mmio_total = 0;
@@ -94,19 +98,43 @@ void pci_setup(void)
             }
             else if ( virtual_vga == VGA_none )
             {
-                vga_devfn = devfn;
-                virtual_vga = VGA_pt;
-                if ( vendor_id == 0x8086 )
-                {
-                    igd_opregion_pgbase = mem_hole_alloc(2);
-                    /*
-                     * Write the the OpRegion offset to give the opregion
-                     * address to the device model. The device model will trap 
-                     * and map the OpRegion at the give address.
-                     */
-                    pci_writel(vga_devfn, PCI_INTEL_OPREGION,
-                               igd_opregion_pgbase << PAGE_SHIFT);
+                 virtual_vga = VGA_pt;
+                 gfx_bdf = devfn;
+ 
+                 /* Make vBAR=pBAR */
+                 printf("Make vBAR = pBAR of assigned gfx\n");
+                 for ( bar = 0; bar < 7; bar++ )
+                 {
+                     bar_reg = PCI_BASE_ADDRESS_0 + 4*bar;
+                     if ( bar == 6 )
+                             bar_reg = PCI_ROM_ADDRESS;
+                     /* When first time read, it will return physical address */
+                     bar_data = pci_readl(devfn, bar_reg);
+                     pci_writel(devfn, bar_reg, bar_data);
+ 
+                     /* Now enable the memory or I/O mapping. */
+                     cmd = pci_readw(devfn, PCI_COMMAND);
+                     if ( (bar_reg == PCI_ROM_ADDRESS) ||
+                              ((bar_data & PCI_BASE_ADDRESS_SPACE) ==
+                               PCI_BASE_ADDRESS_SPACE_MEMORY) )
+                           cmd |= PCI_COMMAND_MEMORY;
+                     else
+                           cmd |= PCI_COMMAND_IO;
+                     cmd |= PCI_COMMAND_MASTER;
+                     pci_writew(devfn, PCI_COMMAND, cmd);
                 }
+ 
+                 /* Map the interrupt. */
+                 pin = pci_readb(devfn, PCI_INTERRUPT_PIN);
+                 if ( pin != 0 )
+                 {
+                     /* This is the barber's pole mapping used by Xen. */
+                     link = ((pin - 1) + (devfn >> 3)) & 3;
+                     isa_irq = pci_readb(PCI_ISA_DEVFN, 0x60 + link);
+                     pci_writeb(devfn, PCI_INTERRUPT_LINE, isa_irq);
+                 }
+                 continue;
+
             }
             break;
         case 0x0680:

vendredi 25 novembre 2011

Documentation officielle Slony pour 1.2.11 et 1.2.22

Voici les liens des documentations officielles