Overblog Suivre ce blog
Editer l'article Administration Créer mon blog
26 avril 2012 4 26 /04 /avril /2012 08:24

I've installed an openfiler on the KVM with directe access to disk.

 

I use a file to hold the Virtaul machine and I give it a directe acess to disk /dev/hda and /dev/hdb

 

1 - Generate the VM

 

cat <EOF>>/srv/VM/openfiler29.sh
#!/bin/bash

NAME='openfiler29'
DISK='5'
ISO='/srv/VM/ISO/openfileresa-2.99.1-x86_64-disc1.iso'

virt-install \
-n${NAME} \
--description 'OpenFiler 2.99' \
--ram 512 \
--vcpus=1 \
--autostart \
--os-type linux \
--hvm \
--accelerate \
-v \
--network bridge=br0,model=virtio \
--disk path=/srv/VM/OS/lv_${NAME}_os.qcow2,size=${DISK} \
-c ${ISO} \
--vnc --vnclisten=0.0.0.0 --vncport=5901\
-k fr-fr

EOF


we finish by connecting to the VM with vnc on port 5901.
I suggest to add an ssh authentification to do the rest of the configuration remotely (lots of documentation about this on the web)

2 - update the openfiler

Here are some command to do have the last version

conary update conary
conary updateall
conary update openfiler

add some package
conary install patch testdisk

 

3 - correction and modification

 

RAID-1(from : http://www.everything-virtual.com/?p=349)

conary update mdadm=openfiler.rpath.org@rpl:devel/2.6.4-0.2-1
ln -s /sbin/lvm /usr/sbin/lvm

 

Virtual drive in openfiler those show by the use of virtio. We need to had some line in /opt/openfiler/sbin/list-disks.pl

I've done a small patch. you can apply this way :

 

cd /opt/openfiler/sbin/

conary install patch
patch -bR -p1 /opt/openfiler/sbin/list-disks.pl< ./list-disks.pl.patch
chown openfiler.openfiler /opt/openfiler/sbin/list-disks.pl
chmod 755 /opt/openfiler/sbin/list-disks.pl

 

cat list-disks.pl.patch

 

--- list-disks.pl    2012-04-22 14:24:14.000000000 +0200
+++ /opt/openfiler/sbin/list-disks.pl    2009-05-16 19:07:57.000000000 +0200
@@ -188,11 +188,6 @@
             # Promise raid controller
             push(@devs, "/dev/$1");
         }
-        elsif (/\d+\s+\d+\s+\d+\s+vd(\S)\s/ || /\d+\s+\d+\s+\d+\s+vd(\S\D)\s/) {
-             # virtio raid device
-             local $d = $1;
-             push(@devs, "/dev/vd$d");
-         }
     }
    
     close(PARTS);
@@ -329,11 +324,7 @@
                 $disk->{'desc'} = &text('select_device', 'IDE', uc($1));
                 $disk->{'type'} = 'ide';
             }
-            elsif ($disk->{'device'} =~ /\/vd(\S)$/) {
-                # VIRTIO disk
-                $disk->{'desc'} = &text('select_device', 'IDE', uc($1));
-                $disk->{'type'} = 'ide';
-            }   
+           
             elsif ($disk->{'device'} =~ /\/xvd(\S)$/) {
                 # Xen disk
                 $disk->{'desc'} = &text('select_device', 'IDE', uc($1));

 

3 -

 

change the Virtual MAchine definition to allow access to disk directly

 

virsh dumpxml openfiler29 >openfiler29.xml

 

root@HostVm:/srv/VM# cat openfiler29.xml
<domain type='kvm' id='15'>
  <name>openfiler29</name>
  <uuid>e16ff78f-ac6b-f35e-a31d-f8b0a547db5d</uuid>
  <description>OpenFiler 2.99</description>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-1.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/srv/VM/OS/lv_openfiler29_os.qcow2'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <disk type='block' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hdd' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/dev/sda'/>
      <target dev='hdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/dev/sdb'/>
      <target dev='hdc' bus='virtio'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:95:ec:fc'/>
      <source bridge='br0'/>
      <target dev='vnet1'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/4'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/4'>
      <source path='/dev/pts/4'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5901' autoport='no' listen='0.0.0.0' keymap='fr'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='apparmor' relabel='yes'>
    <label>libvirt-e16ff78f-ac6b-f35e-a31d-f8b0a547db5d</label>
    <imagelabel>libvirt-e16ff78f-ac6b-f35e-a31d-f8b0a547db5d</imagelabel>
  </seclabel>
</domain>

 

update openfiler29 VM

 

virsh dumpxml openfiler29 >openfiler29.xml

virsh shutdown openfiler29

virsh define openfiler29.xml

virsh start openfiler29

 

 

4 - active directory Integration

Copy and past from an other web site http://www.ozziks.com/2008/12/13/join-openfiler-to-active-directory/

Partager cet article

Repost 0
Published by nitocris - dans Linux
commenter cet article

commentaires