Defrags

Publicado: 17/07/2015 en Uncategorized

Contenido de script en perl para evaluar fragmentación en disco, descargado desde:

http://sourceforge.net/projects/defragfs/files/defragfs/defragfs-1.1/

#!/usr/bin/perl
# defragfs.pl — Measurement and Report and Defrag fs/file fragmentation

# CanHao Xu <xucanhao@gmail.com>, 2007
# John Robson <john.robson@usp.br>, 2011

# Using: $ sudo ./defragfs / -af
# Help: $ ./defragfs / -h

print (“defragfs 1.1.1, Released under GPLv3 by John Robson <john.robson\@usp.br>, March 2011 (help: \$ defragfs / -h)\n\n”);

($DIR, $ARG) = @ARGV;

if($ARG =~ m/h/) { die(“GNU/Linux file systems rarely fragmented files. The file system always allocates more space to write a file, but sometimes the file size grows so that space becomes insufficient and the file is fragmented, but even so the file system fragments the file efficiently.

Using defragfs:

\$ sudo ./defragfs <partition or directory>\te.g. \$ sudo ./defragfs /usr/

(or copy to /usr/bin/ and use in anywhere) \t\$ sudo cp -af defragfs /usr/bin/\te.g. \$ sudo defragfs /home/
(perhaps you may need to give execute permissions: \$ sudo chmod +x /usr/bin/defragfs)

Options:

-a\tAutomatically defrag (configure: \$max_fragrate and \$max_avgfrags according to your preference).
Use this in your crontab.\te.g. sudo crontab -e\t(and add this line)\t0 0 1 */2 * defragfs / -a

-f\tForce defrag if there is at least one fragmented file.

-h\tDisplay this Help.

Examples of using:

\$ sudo defragfs /\t\tAnalyzes ‘root’, displays statistics and whether or not you need to defragment.

\$ sudo defragfs /home/ -a\tAnalyzes ‘home’, displays statistics and whether or not you need to defragment, if necessary, automatically defragments and exits.

\$ sudo defragfs /usr/ -f\tAnalyzes ‘usr’, displays statistics and waiting for your permission to defragment.

\$ sudo defragfs /home/user/.VirtualBox/HardDisks/ -af\tAnalyzes ‘this directory’, displays statistics, automatically defragments and exits.

Note 1: This program was tested on several different machines and also encrypted HOME partitions; worked without any problem.

Note 2: This program simply copies a fragmented file, keeping all its attributes unchanged (cp -a file) and verifying that the file has not changed during the process. The *file system performs the defragmentation process*. Not all files can be defragmented.

Note 3: If the directory you specified contains too much files (e.g. tens of thousands), it could take you several minutes on analysis, you may disturb it by CTRL+C at anytime. And BTW: the program is CURRENTLY not accurate on Reiser4 due to its default tailing policy (you may see a high fragment rate before and even after)

Note 4: If you want to see how many fragments the file contains: \$ sudo filefrag -sv file

If the file is large and has more than 10 fragments, calculate the loss of performance:
\t1) \$ sudo cp -af file file.bak\t# copy the file, the copy usually has no fragments or very little
\t2) \$ sudo filefrag -sv file.bak\t# check if the copy is less fragmented
\t3) calculate the time to read the copy and the original:
\t\ttime cat file.bak > /dev/null
\t\ttime cat file > /dev/null

* Generally a very fragmented file takes much longer to read and less fragmented file is much faster. If the file is small (less than 100 mb) you may not notice the loss of performance because of *disk caching*, the ideal is to test large files over 300 mb or 1 gb.

I hope you enjoy this program.
Thanks, John.
“); }

if (!(-e $DIR) || !(-d $DIR)) { die “You must specify a correct directory name!
“; }

my $AUTO = 0;
my $FORCE = 0;

if($ARG =~ m/a/) { $AUTO = 1; }
if($ARG =~ m/f/) { $FORCE = 1; }

if (($DIR eq “”) || ($DIR =~ m/-/)) { die “Usage: defragfs.pl DIRECTORY [-af], -af means force automatic defragmentation
“; }

start:
print (“Analysis in progress…\n\n”);

my $files = 0; # number of files
my $fragments = 0; # number of fragment before defrag
my $fragfiles = 0; # number of fragmented files before defrag
my $TMP_filefrag_1 = “/tmp/frags-result-tmp”;
my $TMP_filefrag_2 = “/tmp/frags-result”;
my $TMP_defrag_filelist_1 = “/tmp/defrag-filelist-tmp”;
my $TMP_defrag_filelist_2 = “/tmp/defrag-filelist”;
my $max_fragrate = 1; # max “File Fragmentation Rate” used to determine whether worth defrag.
my $max_avgfrags = 1.1; # max “Avg File Fragments” used to determine whether worth defrag.
my $default_defrag_ratio; # default defragmentation ratio in percentage
my $max_display_num = 10; # display how much files in report
my $total_defrag_files = 0; # which files to be defrag, determined after user input the ratio
my $max_tries = 1; # max “Max Tries” used to determine max attempts to defrag a file after first attempt.

system(“rm -f $TMP_filefrag_1”);
system(“rm -f $TMP_filefrag_2”);
system(“rm -f $TMP_defrag_filelist_1”);
system(“rm -f $TMP_defrag_filelist_2”);

my $progress = 0;
open (FILES, “find \”” . $DIR . “\” -xdev -type f |”);
while (defined (my $file = <FILES>)) {
$file =~ s/!/\\!/g;
$file =~ s/#/\\#/g;
$file =~ s/&/\\&/g;
$file =~ s/>/\\>/g;
$file =~ s/</\\</g;
$file =~ s/\$/\\\$/g;
$file =~ s/\(/\\\(/g;
$file =~ s/\)/\\\)/g;
$file =~ s/\|/\\\|/g;
$file =~ s/’/\\’/g;
$file =~ s/ /\\ /g;
open (FRAG, “filefrag $file |”);
my $res = <FRAG>;
if ($res =~ m/.*:\s+(\d+) extents? found/) {
my $fragment = $1;
if ($fragment eq 0) { $fragment = 1; }
$fragments+=$fragment;
if ($fragment > 1) {
system(“echo -n \”$res\” >> $TMP_filefrag_1″);
$fragfiles++;
}
$files++;
}
close (FRAG);
if (($progress++ % 1000) eq 0) { print “.”; }
}
close (FILES);

if ($files eq 0) {
print (“The selected directory contains no file!\n”);
exit;
}
system(“sort $TMP_filefrag_1 -g -t : -k 2 -r | sed \”/^\$/d\” > $TMP_filefrag_2″);

print (“\n\nStatistics for $DIR\n\n”);
print (“Total Files:\t\t\t” . $files . “\n”);
print (“Total Fragmented Files:\t\t” . $fragfiles . “\n”);
print (“Total Fragments:\t\t” . ($fragments – $files) . “\n”);
if ($fragfiles > 0) { print (“Fragments per Fragmented File:\t” . ($fragments – $files) / $fragfiles . “\n\n”); }
if ($files > 0) { print (“File Fragmentation Rate:\t” . ($fragfiles / $files) * 100 . ” %\n”); }
if ($files > 0) { print (“Avg File Fragments (1 is best):\t” . $fragments / $files . “\n”); }

if ($fragfiles > 0) {
if ($max_display_num > $fragfiles) { $max_display_num = $fragfiles; }
print (“\nMost Fragmented Files(for details see $TMP_filefrag_2):\n”);
system(“head $TMP_filefrag_2 -n $max_display_num”);
} else {
print (“\nYou do not need a defragmentation!\n”);
exit;
}

$default_defrag_ratio = ($files eq 1) ? 100 : ($fragfiles / $files) * 100;

if (((($fragfiles / $files) * 100) > $max_fragrate) || (($fragments / $files) > $max_avgfrags) || ($FORCE)) {
print (“\nYou need a defragmentation or Your are using -f parameter!\n”);
} else {
print (“\nYou do not need a defragmentation!\n”);
exit;
}

defrag:
print (“\nPlease specify the percentage of files should be defrag (1-100) [$default_defrag_ratio] or hit Enter.”);

if ($AUTO) { $defrag_ratio = “” }
else { $defrag_ratio = <STDIN>; }
chop($defrag_ratio);

if (!($defrag_ratio eq “”) && (($defrag_ratio < 0) || ($defrag_ratio > 100))) {
print (“Error percentage numbers, please re-enter!\n”);
goto defrag;
} else {
$total_defrag_files = ($defrag_ratio eq “”) ? $fragfiles : int($defrag_ratio * $files / 100);
}

print (“\nPreparing defragmentation, please wait…\n”);

print (“\nFiles to be defragmented: ” . $total_defrag_files . “\n\n”);
if ($total_defrag_files eq 0) { exit; }
system(“head $TMP_filefrag_2 -n $total_defrag_files > $TMP_defrag_filelist_1”);

open (TMPFRAGLIST, “$TMP_defrag_filelist_1”);
while (<TMPFRAGLIST>) {
m/(.*):\s+(\d+) extents? found/;
my $filename = $1;
system(“echo \”$1\” >> $TMP_defrag_filelist_2″);
}

open (GETSIZE, “$TMP_defrag_filelist_2”);
my $max = 0;
while (<GETSIZE>) {
s/(.*)\n/$1/;
$size = -s “$_”;
if ($size > $max) { $max = $size; }
}

print (“You need AT LEAST ” . sprintf(“%.3f”, $max / 1048576) . ” Megabytes temporarily used for defragmentation (at the directory where you specified), continue (Y/N)? [Y] “);
if ($AUTO) { $confirm = “” }
else { $confirm = <STDIN>; }
chop($confirm);

if (($confirm eq “y”) || ($confirm eq “Y”) || ($confirm eq “”)) {
print (“\nOK, please drink a cup of tea and wait…\n”);
print (“\nFile Number – File Name (Size Mb) [actual extents] – extents after defrag attempt\n”);
my $actual_file = $total_defrag_files;
open (DEFRAG, “$TMP_defrag_filelist_2”);

while (<DEFRAG>) {
s/(.*)\n/$1/;
$from = $_;
s/(.*)/$1.ft/;
$to = $_;

my $i_file = $actual_file;
my $i_tries = 0;
while ($i_tries++ < $max_tries) {
my $fragment_from = 0;
my $fragment_to = 0;
my $res;

open (FRAG, “-|”, “filefrag”, $from);
$res = <FRAG>;
if ($res =~ m/.*:\s+(\d+) extents? found/) { $fragment_from = $1; }

if ($i_file eq $actual_file) {
my $size = sprintf(“%.3f”, (stat($from))[7] / 1048576);
print “\n$actual_file – $from ($size) [$fragment_from] – “;
$actual_file–;
}

my $mtime1 = (stat($from))[9];
system(“sync”);
system(“cp -af \”$from\” \”$to\” 2>/dev/null”);
#system(“rsync -aEHAX –devices –specials \”$from\” \”$to\” 2>/dev/null”);
system(“sync”);
my $mtime2 = (stat($from))[9];

if ($mtime1 != $mtime2) { # check the file hasn’t been altered since we copied it
system(“rm -f \”$to\””);
print “! “;
} else {
open (FRAG, “-|”, “filefrag”, $to);
$res = <FRAG>;
if ($res =~ m/.*:\s+(\d+) extents? found/) { $fragment_to = $1; }

if ($fragment_to <= $fragment_from) { # <= not just <
system(“mv -f \”$to\” \”$from\” 2>/dev/null”);
print “$fragment_to “;
if ($fragment_to eq 1) { last; }
if ($fragment_to eq $fragment_from) { $i_tries++; }
if ($fragment_to < $fragment_from) { $i_tries–; }
} else {
system(“rm -f \”$to\””);
print “$fragment_from “;
}
}
system(“sync”);
}
}

system(“sync”);
print (“\n\nDone!\n\n”);

if ($AUTO) { exit; }
else { goto start; }
} else {
exit;
}

Fragmentación

Publicado: 17/07/2015 en Uncategorized

# Encontramos los 20 archivos más grandes de nuestro filesystem
find / -type f -exec du -Sh {} + | sort -rh | head -n 20
# Evaluamos la fragmentación de los mismos, utilizando filefrag incluido dentro del paquete e2fsprogs.
filefrag /ruta/a/los/archivos

# En Debian

dpkg -l |tail -n +6|cut -d’ ‘ -f3 > paquetes.txt

# En RH

yum list installed |tail -n +3|cut -d’ ‘ -f3 > paquetes.txt

# Ambos, algo por el estilo.. sigue sin ser desatendido, hay una que otra GUI de config para algunos paquetes (en Debian).

aptitude/yum install $(cat paquetes.txt) -y

add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java8-installer

Integración de oVirt y QEMU

Publicado: 23/08/2013 en Uncategorized

Por supuesto que oVirt no es estable, mucho menos fedora 19, sin embargo para los interesados en implementarlo en derivado de Red Hat, CentOS es la mejor opción. A continuación algunos tips de procedimiento:

## Para entender Gluster y su distribución en cuanto al orden en que se declaran los bricks, formarlo y ejecutar “getfattr -d -etext -m. -n trusted.glusterfs.pathinfo rutadelglustervolume”

## La instalación se puede realizar vía cobbler, la siguiente es una configuración para 4 nodos previo levantamiento de información. Feel free to re-assemble the procedure yourself.

## Agregar Máquinas

## VM1

cobbler system add –name=vm1 –netboot-enabled=true –profile=vms-glusterfs-CentOS-6.4-x86_64_Full_Repos –kopts=”vnc vncconnect=172.22.23.207 vncpassword=casa1234 ip=172.22.23.53 netmask=255.255.254.0 gateway=172.22.22.1 ksdevice=eth4″
cobbler system edit –name=vm1 –power-type=ipmilan –power-address=vm1-ipmi –power-user=root –power-pass=casa1234
cobbler system edit –name=vm1 –interface=eth0 –mac=00:15:17:92:62:44 –mtu=9000 –interface-type=bond_slave –interface-master=bond2
cobbler system edit –name=vm1 –interface=eth1 –mac=00:15:17:92:62:45 –mtu=9000 –interface-type=bond_slave –interface-master=bond2
cobbler system edit –name=vm1 –interface=bond2 –interface-type=bond –mtu=9000 –ip-address=192.168.20.1 –subnet=255.255.255.0 –static=1 –bonding-opts=”mode=6 miimon=100″
cobbler system edit –name=vm1 –interface=eth2 –mac=00:15:17:92:62:46 –mtu=9000 –interface-type=bond_slave –interface-master=bond1
cobbler system edit –name=vm1 –interface=eth3 –mac=00:15:17:92:62:47 –mtu=9000 –interface-type=bond_slave –interface-master=bond1
cobbler system edit –name=vm1 –interface=bond1 –interface-type=bond –mtu=9000 –ip-address=192.168.10.1 –subnet=255.255.255.0 –static=1 –bonding-opts=”mode=6 miimon=100″
cobbler system edit –name=vm1 –interface=eth4 –mac=00:22:19:AF:DB:17 –mtu=9000 –interface-type=bond_slave –interface-master=bond0
cobbler system edit –name=vm1 –interface=eth5 –mac=00:22:19:AF:DB:19 –mtu=9000 –interface-type=bond_slave –interface-master=bond0
cobbler system edit –name=vm1 –interface=bond0 –interface-type=bond –mtu=9000 –ip-address=172.22.23.51 –netmask=255.255.254.0 –gateway=172.22.22.1 –name-servers=172.22.22.22 –name-servers-search=dominio.local –static=true –hostname=vm1.dominio.local –dns-name=vm1.dominio.local –bonding-opts=”mode=6 miimon=100″

## VM2

cobbler system add –name=vm2 –netboot-enabled=true –profile=vms-glusterfs-CentOS-6.4-x86_64_Full_Repos –kopts=”vnc vncconnect=172.22.23.207 vncpassword=casa1234 ip=172.22.23.53 netmask=255.255.254.0 gateway=172.22.22.1 ksdevice=eth4″
cobbler system edit –name=vm2 –power-type=ipmilan –power-address=vm2-ipmi –power-user=root –power-pass=casa1234
cobbler system edit –name=vm2 –interface=eth0 –mac=00:15:17:86:a4:1c –mtu=9000 –interface-type=bond_slave –interface-master=bond2
cobbler system edit –name=vm2 –interface=eth1 –mac=00:15:17:86:a4:1d –mtu=9000 –interface-type=bond_slave –interface-master=bond2
cobbler system edit –name=vm2 –interface=bond2 –interface-type=bond –mtu=9000 –ip-address=192.168.20.2 –subnet=255.255.255.0 –static=1 –bonding-opts=”mode=6 miimon=100″
cobbler system edit –name=vm2 –interface=eth2 –mac=00:15:17:86:a4:1e –mtu=9000 –interface-type=bond_slave –interface-master=bond1
cobbler system edit –name=vm2 –interface=eth3 –mac=00:15:17:86:a4:1f –mtu=9000 –interface-type=bond_slave –interface-master=bond1
cobbler system edit –name=vm2 –interface=bond1 –interface-type=bond –mtu=9000 –ip-address=192.168.10.2 –subnet=255.255.255.0 –static=1 –bonding-opts=”mode=6 miimon=100″
cobbler system edit –name=vm2 –interface=eth4 –mac=00:22:19:1e:a5:62 –mtu=9000 –interface-type=bond_slave –interface-master=bond0
cobbler system edit –name=vm2 –interface=eth5 –mac=00:22:19:1e:a5:64 –mtu=9000 –interface-type=bond_slave –interface-master=bond0
cobbler system edit –name=vm2 –interface=bond0 –interface-type=bond –mtu=9000 –ip-address=172.22.23.52 –netmask=255.255.254.0 –gateway=172.22.22.1 –name-servers=172.22.22.22 –name-servers-search=dominio.local –static=true –hostname=vm2.dominio.local –dns-name=vm2.dominio.local –bonding-opts=”mode=6 miimon=100″

## VM3

cobbler system add –name=vm3 –netboot-enabled=true –profile=vms-glusterfs-CentOS-6.4-x86_64_Full_Repos –kopts=”vnc vncconnect=172.22.23.207 vncpassword=casa1234 ip=172.22.23.53 netmask=255.255.254.0 gateway=172.22.22.1 ksdevice=eth4″
cobbler system edit –name=vm3 –power-type=ipmilan –power-address=vm3-ipmi –power-user=root –power-pass=casa1234
cobbler system edit –name=vm3 –interface=eth0 –mac=00:15:17:86:a3:d8 –mtu=9000 –interface-type=bond_slave –interface-master=bond2
cobbler system edit –name=vm3 –interface=eth1 –mac=00:15:17:86:a3:d9 –mtu=9000 –interface-type=bond_slave –interface-master=bond2
cobbler system edit –name=vm3 –interface=bond2 –interface-type=bond –mtu=9000 –ip-address=192.168.20.3 –subnet=255.255.255.0 –static=1 –bonding-opts=”mode=6 miimon=100″
cobbler system edit –name=vm3 –interface=eth2 –mac=00:15:17:86:a3:da –mtu=9000 –interface-type=bond_slave –interface-master=bond1
cobbler system edit –name=vm3 –interface=eth3 –mac=00:15:17:86:a3:db –mtu=9000 –interface-type=bond_slave –interface-master=bond1
cobbler system edit –name=vm3 –interface=bond1 –interface-type=bond –mtu=9000 –ip-address=192.168.10.3 –subnet=255.255.255.0 –static=1 –bonding-opts=”mode=6 miimon=100″
cobbler system edit –name=vm3 –interface=eth4 –mac=00:22:19:20:7f:9a –mtu=9000 –interface-type=bond_slave –interface-master=bond0
cobbler system edit –name=vm3 –interface=eth5 –mac=00:22:19:20:7f:9c –mtu=9000 –interface-type=bond_slave –interface-master=bond0
cobbler system edit –name=vm3 –interface=bond0 –interface-type=bond –mtu=9000 –ip-address=172.22.23.53 –netmask=255.255.254.0 –gateway=172.22.22.1 –name-servers=172.22.22.22 –name-servers-search=dominio.local –static=true –hostname=vm3.dominio.local –dns-name=vm3.dominio.local –bonding-opts=”mode=6 miimon=100″

## VM4

cobbler system add –name=vm4 –netboot-enabled=true –profile=vms-glusterfs-CentOS-6.4-x86_64_Full_Repos –kopts=”vnc vncconnect=172.22.23.207 vncpassword=casa1234 ip=172.22.23.53 netmask=255.255.254.0 gateway=172.22.22.1 ksdevice=eth4″
cobbler system edit –name=vm4 –power-type=ipmilan –power-address=vm4-ipmi –power-user=root –power-pass=casa1234
cobbler system edit –name=vm4 –interface=eth0 –mac=00:15:17:86:62:68 –mtu=9000 –interface-type=bond_slave –interface-master=bond2
cobbler system edit –name=vm4 –interface=eth1 –mac=00:15:17:86:62:69 –mtu=9000 –interface-type=bond_slave –interface-master=bond2
cobbler system edit –name=vm4 –interface=bond2 –interface-type=bond –mtu=9000 –ip-address=192.168.20.4 –subnet=255.255.255.0 –static=1 –bonding-opts=”mode=6 miimon=100″
cobbler system edit –name=vm4 –interface=eth2 –mac=00:15:17:86:62:6a –mtu=9000 –interface-type=bond_slave –interface-master=bond1
cobbler system edit –name=vm4 –interface=eth3 –mac=00:15:17:86:62:6b –mtu=9000 –interface-type=bond_slave –interface-master=bond1
cobbler system edit –name=vm4 –interface=bond1 –interface-type=bond –mtu=9000 –ip-address=192.168.10.4 –subnet=255.255.255.0 –static=1 –bonding-opts=”mode=6 miimon=100″
cobbler system edit –name=vm4 –interface=eth4 –mac=00:24:e8:66:c2:9a –mtu=9000 –interface-type=bond_slave –interface-master=bond0
cobbler system edit –name=vm4 –interface=eth5 –mac=00:24:e8:66:c2:9c –mtu=9000 –interface-type=bond_slave –interface-master=bond0
cobbler system edit –name=vm4 –interface=bond0 –interface-type=bond –mtu=9000 –ip-address=172.22.23.54 –netmask=255.255.254.0 –gateway=172.22.22.1 –name-servers=172.22.22.22 –name-servers-search=dominio.local –static=true –hostname=vm4.dominio.local –dns-name=vm4.dominio.local –bonding-opts=”mode=6 miimon=100″

##### PROCEDIMIENTO EN CONSOLA QUE SE EJECUTA DE IGUAL MANERA AL GENERARSE MEDIANTE LA INTERFAZ.
## Solo a manera de información, debería hacerse vía interfaz gráfica

gluster vol create cinder-vol1 replica 4 transport tcp vm1-st:/data/glusterfs/vol2/brick1 vm2-st:/data/glusterfs/vol2/brick1 vm3-st:/data/glusterfs/vol2/brick1 vm4-st:/data/glusterfs/vol2/brick1 vm1-st:/data/glusterfs/vol2/brick2 vm2-st:/data/glusterfs/vol2/brick2 vm3-st:/data/glusterfs/vol2/brick2 vm4-st:/data/glusterfs/vol2/brick2

gluster vol create cinder-vol2 replica 4 transport tcp vm1-st:/data/glusterfs/vol3/brick1 vm2-st:/data/glusterfs/vol3/brick1 vm3-st:/data/glusterfs/vol3/brick1 vm4-st:/data/glusterfs/vol3/brick1 vm1-st:/data/glusterfs/vol3/brick2 vm2-st:/data/glusterfs/vol3/brick2 vm3-st:/data/glusterfs/vol3/brick2 vm4-st:/data/glusterfs/vol3/brick2

############## option rpc-auth-allow-insecure on ==> in glusterd.vol (ensure u restart glusterd service… for this to take effect)
############## volume set server.allow-insecure on ==> (ensure u stop and start the volume.. for this to take effect)

gluster volume set cinder-vol1 server.allow-insecure on
gluster volume set cinder-vol2 server.allow-insecure on

gluster volume stop cinder-vol1

## Yes

gluster volume start cinder-vol1

gluster volume stop cinder-vol2

## Yes

gluster volume start cinder-vol2

gluster volume set cinder-vol1 storage.owner-uid 36
gluster volume set cinder-vol1 storage.owner-gid 36

gluster volume set cinder-vol2 storage.owner-uid 36
gluster volume set cinder-vol2 storage.owner-gid 36

vim /etc/sysconfig/nfs
NFS4_SUPPORT=”no”

## IMPORTANTE: Libvirt pedirá información de autenticación y solo Dios conoce esta información, para crear nuevo usuario y contraseña para conectarse a libvirt.

saslpasswd2 -a libvirt dbompart

# Rutas en el servidor virtual donde tengo instalado OVIRT, necesarias para acceder a todas las subredes configuradas en los servidores:

cat > /etc/sysconfig/network-scripts/route-eth0 << EOF
192.168.10.1/32 via 172.22.23.51
192.168.10.2/32 via 172.22.23.52
192.168.10.3/32 via 172.22.23.53
192.168.10.4/32 via 172.22.23.54
192.168.20.1/32 via 172.22.23.51
192.168.20.2/32 via 172.22.23.52
192.168.20.3/32 via 172.22.23.53
192.168.20.4/32 via 172.22.23.54
EOF

## Instalación de libvirt última versión: 1.1.3 y QEMU 1.6

## PARA GENERAR EL RPM DE QEMU 1.6:
# Paso previo: únicamente desde DEBIAN, realizar lo siguiente
# Descargar el paquete .tar.bz2 en su última versión y ya que no se encontrará el spec file en ningún lado de ninguna forma y si lo decides crear a mano te deseo mucha suerte, hacer lo siguiente:

cd /tmp
wget http://wiki.qemu-project.org/download/qemu-1.6.0-rc3.tar.bz2
bunzip2 -c qemu-1.6.0-rc3.tar.gz
alien -r –generate qemu-1.6.0-rc3.tar.gz
# En las macros de rpm /usr/lib/rpm/macros en la sección de %configure o en el spec file agregar lo siguiente:
%configure \
–enable-glusterfs
fakeroot rpmbuild –buildroot=’/root/qemu-1.6.0/’ -bb –target x86_64 ‘qemu-1.6.0-2.spec’ –no-clean
cd /root
ls qemu*
## AHI ESTA EL RPM.

## PARA GENERAR EL RPM DE LIBVIRT 1.1.1:

cd /opt
wget http://appserver1/cobbler/repo_mirror/CentOS-epel-x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum repolist
yum –disablerepo=”*” –enablerepo=”epel” list available
cd /opt
cat > /etc/yum.repos.d/el6-ovirt.repo < /etc/yum.repos.d/el6-ovirt.repo << _EOF
[ovirt-stable]
name=Stable builds of the oVirt project
baseurl=http://ovirt.org/releases/stable/rpm/EL/\$releasever/
enabled=0
skip_if_unavailable=1
gpgcheck=0

[ovirt-updates-testing]
name=Stable builds of the oVirt project
baseurl=http://ovirt.org/releases/updates-testing/rpm/EL/\$releasever/
enabled=0
skip_if_unavailable=1
gpgcheck=0

[ovirt-beta]
name=Beta builds of the oVirt project
baseurl=http://ovirt.org/releases/beta/rpm/EL/\$releasever/
enabled=0
skip_if_unavailable=1
gpgcheck=0

[ovirt-nightly]
name=Nightly builds of the oVirt project
baseurl=http://ovirt.org/releases/nightly/rpm/EL/\$releasever/
enabled=1
skip_if_unavailable=1
gpgcheck=0
_EOF

#rm -rf epel-release-6-8.noarch.rpm
yum install mom -y
yum update -y

# Activar la versión Nightly por requisitos de dependencia mom-0.3.2-3
yum remove -y libvirt libvirt-python libvirt-client qemu-kvm qemu-img

yum install perl-IO-Pty-Easy qemu-img qemu-kvm -y
rpm -vih qemu*
rpm -vih libvirt-client-*
rpm -vih libvirt-daemon-*
rpm -vih libvirt-docs-*
rpm -vih libvirt-devel-*
rpm -vih libvirt-lock*
rpm -vih libvirt-python-*
rpm -vih libvirt-debuginfo-*
rpm -vih libvirt-1.1.1-1*
rpm -vih –nodeps libvirt*rpm –force
yum install vdsm vdsm-gluster vdsm-gluster vdsm-gluster
ldconfig

## Iniciar los servicios.

systemctl start rpcbind.service
systemctl start nfs-server.service
systemctl start nfs-lock.service
systemctl start nfs-idmap.service

systemctl status rpcbind.service
systemctl status nfs-server.service
systemctl status nfs-lock.service
systemctl status nfs-idmap.service

systemctl restatus rpcbind.service
systemctl restatus nfs-server.service
systemctl restatus nfs-lock.service
systemctl restatus nfs-idmap.service

systemctl enable rpcbind.service
systemctl enable nfs-server.service
systemctl enable nfs-lock.service
systemctl enable nfs-idmap.service

## REMOVER GLUSTER

gluster volume stop cinder-vol1
gluster volume delete cinder-vol1

gluster volume stop cinder-vol2
gluster volume delete cinder-vol2

rm -rf /data/glusterfs/vol2/brick1/*
rm -rf /data/glusterfs/vol2/brick2/*
rm -rf /data/glusterfs/vol3/brick1/*
rm -rf /data/glusterfs/vol3/brick2/*

gluster-cleanvolumes /data/glusterfs/vol2/brick1
gluster-cleanvolumes /data/glusterfs/vol2/brick2
gluster-cleanvolumes /data/glusterfs/vol3/brick1
gluster-cleanvolumes /data/glusterfs/vol3/brick2

yum -y remove vdsm vdsm-cli vdsm-gluster vdsm-jsonrpc vdsm-yajsonrpc

##### FEDORA Ovirt Server

yum localinstall http://ovirt.org/releases/ovirt-release-fedora.noarch.rpm
# Reemplazar el repo stable por:
http://resources.ovirt.org/releases/3.3/rpm/Fedora/19/

yum clean all
yum install -y ovirt-engine
engine-setup
## Responder las preguntas y listo.

#!/bin/bash -x

############################################
##### Elaborado por: #
##### David Bompart #
##### 16/04/2013 #
##### #
############################################

# Pasos GENERALES para la instalación:
#
#
# Instalar el Identity Service(Keystone).
#
# Configurar el Identity Service.
#
# Instalar el Image Service (Glance).
#
# Configurar el Image Service.
#
# Instalar Compute (Nova).
#
# Configurar el Nova con DHCP usando la red fija 10.0.0.0/24 como rango para nuestras VM sobre un bridge br100.
#
# Crear e inicializar la base de datos en postgres.
#
# Agregar imagenes.
#
# Instalar el OpenStack Dashboard.
#
# Iniciar el Dashboard.
#
# Agregar una llave par a través del Dashboard.
#
# (opcional) Instalar OpenStack Object Storage (Swift).

 

#################
### INSTALACIÓN##
#################
sed -i ‘s/NM\_CONTROLLED\=\”yes\”/NM\_CONTROLLED\=\”no\”/g’ /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i ‘s/ONBOOT\=\”no\”/ONBOOT\=\”yes\”/g’ /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i ‘s/^SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config
systemctl disable firewalld.service
setenforce 0
echo “NETWORKING_IPV6=no” >> /etc/sysconfig/network
sed -i ‘s/^SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config
for FILE in `ls /etc/sysconfig/network-scripts/ifcfg-*`; do
sed -i ‘/^IPV6/d’ $FILE
sed -i ‘s/NM\_CONTROLLED\=\”yes\”/NM\_CONTROLLED\=\”no\”/g’ $FILE
sed -i ‘s/ONBOOT\=\”no\”/ONBOOT\=\”yes\”/g’ $FILE
echo “Agregando lineas para deshabilitar ipv6 en interfaz: ” ${FILE}
echo “IPV6INIT=no” >> ${FILE}
echo “IPV6_AUTOCONF=no” >> ${FILE}
done
cat > /etc/yum.repos.d/fedora18-updates-dayco.repo << _EOF
[dayco-fedora18]
name=dayco-fedora18-base
baseurl=http://appserver1/cobbler/ks_mirror/Fedora-18-x86_64/
enabled=1
priority=99
gpgcheck=0

[dayco-fedora18-updates]
name=dayco-fedora18-updates
baseurl=http://appserver1/cobbler/repo_mirror/f18-x86_64-updates/
enabled=1
priority=99
gpgcheck=0
_EOF

yum update -y;
yum repolist;
yum update -y;
yum repolist;
yum -y install nano yum-presto yum-utils sysstat iptraf tcpdump mutt yum-plugin-fastestmirror
yum -y install mlocate man nfs-utils nfs4-acl-tools rdate chrony ssh-utils bc
yum -y groupinstall “Development Tools”
yum -y install rpmdevtools
yum -y install gcc gcc-c++ gcc-objc net-tools libgcc flex glibc-devel glibc-headers glibc-kernheaders libobjc
yum -y install compat-gcc-34 compat-gcc-34-c++ compat-libstdc++-33 compat-libstdc++-296
yum -y install libstdc++ libstdc++.i686 libstdc++-devel.i686 libstdc++-devel readline-devel readline
yum -y install qemu-* openssl openssl-devel libgcrypt libgcrypt-devel pam pam-devel
yum -y install zlib zlib-devel pnglite curl curl-devel unixODBC unixODBC-devel
yum -y install xerces-c xerces-c-devel xalan-c xalan-c-devel expat expat-devel
yum -y install libxml2 libxml2-devel libxslt libxslt-devel wbxml2 wbxml2-devel libxml++
yum -y install docbook docbook-utils docbook-style-xsl docbook2X dblatex cppunit check
yum -y install libsq3 libsq3-devel sshpass elinks uuid-devel uuidd libuuid-devel libuuid uuid bzip2-devel
yum -y install rsync chrony bc popt-devel popt popt-static pkgconfig expatmm expatmm-devel vim
yum -y install ntp* vim gpm wget nethogs
yum -y install openstack-utils memcached qpid-cpp-server
yum -y install python-sqlalchemy python-psycopg2
yum -y install $(yum search openstack |grep nova|awk ‘{print $1}’)
yum -y install openstack-utils openstack-keystone openstack-nova \
openstack-cinder openstack-glance openstack-swift openstack-swift-proxy \
openstack-swift-account openstack-swift-container openstack-swift-object \
openstack-quantum openstack-quantum-linuxbridge openstack-quantum-openvswitch \
openstack-dashboard openstack-tempo
yum -y install mysql-server qpid-cpp-server memcached nbd wget
yum -y install python-nova-adminclient
yum -y install rubygem-openstack rubygem-openstack-compute \
rubygem-openstack-quantum-client
yum -y install appliance-tools appliance-tools-minimizer \
febootstrap rubygem-boxgrinder-build
yum -y install openstack-keystone-doc openstack-nova-doc \
openstack-cinder-doc openstack-glance-doc openstack-swift-doc \
python-keystoneclient-doc python-novaclient-doc \
python-swiftclient-doc python-django-horizon-doc \
rubygem-openstack-doc rubygem-openstack-quantum-client-doc
sed -i ‘s/server /#server/g’ /etc/chrony.conf
echo “server ntp1.sigis.local iburst” >> /etc/chrony.conf
service network start;
chkconfig chronyd on;
chkconfig network on;
chkconfig iptables off;
chkconfig ip6tables off;
service iptables stop;
service ip6tables stop;
yum check-update;
yum update -y;
service chronyd start;
echo “/usr/local/lib” > /etc/ld.so.conf.d/local_lib-i386.conf
echo “/usr/local/lib64” > /etc/ld.so.conf.d/local_lib-x86-64.conf
ldconfig
echo “” > /etc/security/limits.conf
cat > /etc/security/limits.conf << _EOF
* – stack -1
* – maxlogins -1
* – locks -1
* – msgqueue -1
* – memlock -1
* – nofile 65535
* hard nproc 1024
_EOF
yum -y install \
postgresql-contrib \
postgresql-dbi-link \
postgresql-devel.i686 \
postgresql-devel.x86_64 \
postgresql-docs.x86_64 \
postgresql-ip4r.x86_64 \
postgresql-jdbc.noarch \
postgresql-libs.i686 \
postgresql-libs.x86_64 \
postgresql-odbc.x86_64 \
postgresql-plperl.x86_64 \
postgresql-plpython.x86_64 \
postgresql-pltcl.x86_64 \
postgresql-server.x86_64 \
postgresql-table_log.x86_64 \
postgresql-test.x86_64 \
postgresql-upgrade.x86_64 \
uuid-pgsql
sed -i ‘s/\/var\/lib\/pgsql\/data/\/PostgreSQL\/data/g’ /var/lib/pgsql/.bash_profile
echo “export EDITOR=\”vim\”” >> /var/lib/pgsql/.bash_profile
postgresql-setup initdb
systemctl enable postgresql.service
systemctl start postgresql.service
systemctl status postgresql.service
systemctl stop postgresql.service
echo “” > /var/lib/pgsql/data/pg_hba.conf
cat > /var/lib/pgsql/data/pg_hba.conf << EOF
# TYPE DATABASE USER ADDRESS METHOD
local all all trust
host all all 127.0.0.1/32 trust
host all all 172.22.22.0/23 trust
host all all ::1/128 trust
host all all 0.0.0.0/0 trust
EOF
sed -i “s/^#listen_addresses = ‘localhost’/listen_addresses = ‘*’/g” /var/lib/pgsql/data/postgresql.conf
sed -i “s/^#bytea_output = ‘hex’/bytea_output = ‘escape’/g” /var/lib/pgsql/data/postgresql.conf
service postgresql reload
systemctl start postgresql.service
systemctl status postgresql.service
su – postgres -c “vacuumdb -avfz; reindexdb -ae”
systemctl stop postgresql.service
systemctl start postgresql.service
systemctl start qpidd.service && systemctl enable qpidd.service
systemctl start libvirtd.service && systemctl enable libvirtd.service
systemctl enable openstack-nova-consoleauth.service
systemctl enable openstack-nova-novncproxy.service

adduser manage
echo “manage” | passwd –stdin manage
su – postgres -c “PGPASSWORD=manage; createdb manage; createlang plpgsql manage; yes $PGPASSWORD | createuser -P -sDR manage”
psql -U postgres -c “GRANT ALL PRIVILEGES ON DATABASE manage TO manage”
adduser cinder
echo “cinder” | passwd –stdin cinder
su – postgres -c “PGPASSWORD=cinder; createdb cinder; createlang plpgsql cinder; yes $PGPASSWORD | createuser -P -sDR cinder”
psql -U postgres -c “GRANT ALL PRIVILEGES ON DATABASE cinder TO cinder”
adduser nova
echo “nova” | passwd –stdin nova
su – postgres -c “PGPASSWORD=nova; createdb nova; createlang plpgsql nova; yes $PGPASSWORD | createuser -P -sDR nova”
psql -U postgres -c “GRANT ALL PRIVILEGES ON DATABASE nova TO nova”
adduser keystone
echo “keystone” | passwd –stdin keystone
su – postgres -c “PGPASSWORD=keystone; createdb keystone; createlang plpgsql keystone; yes $PGPASSWORD | createuser -P -sDR keystone”
psql -U postgres -c “GRANT ALL PRIVILEGES ON DATABASE keystone TO keystone”
adduser glance
yes glance | passwd glance
su – postgres -c “PGPASSWORD=glance; createdb glance; createlang plpgsql glance; yes $PGPASSWORD | createuser -P -sDR glance”
psql -U postgres -c “GRANT ALL PRIVILEGES ON DATABASE glance TO glance”
psql template1 -U postgres -c “GRANT ALL PRIVILEGES ON DATABASE nova TO nova; GRANT ALL PRIVILEGES ON DATABASE glance TO glance; GRANT ALL PRIVILEGES ON DATABASE keystone TO keystone; GRANT ALL PRIVILEGES ON DATABASE cinder TO cinder; GRANT ALL PRIVILEGES ON DATABASE manage TO manage;”
sed -i ‘s”sql_connection = mysql://nova:nova@localhost/nova”sql_connection = postgresql://nova:nova@localhost/nova”g’ /etc/nova/nova.conf
sed -i ‘s”sql_connection = mysql://glance:glance@localhost/glance”sql_connection = postgresql://glance:glance@localhost/glance”g’ /etc/glance/glance-api.conf
sed -i ‘s”sql_connection = mysql://glance:glance@localhost/glance”sql_connection = postgresql://glance:glance@localhost/glance”g’ /etc/glance/glance-registry.conf
sed -i ‘s”sql_connection = mysql://cinder:cinder@localhost/cinder”sql_connection = postgresql://cinder:cinder@localhost/cinder”g’ /etc/cinder/cinder.conf
sed -i ‘s”connection = mysql://keystone:keystone@localhost/keystone”connection = postgresql://keystone:keystone@localhost/keystone”g’ /etc/keystone/keystone.conf
yum install -y pgtune
service postgresql restart
yum -y update
cp /etc/sysctl.conf /root/sysctl.conf.back
ssh-keygen -t rsa -b 4096 -P “” -f /root/.ssh/id_rsa
sshpass -p ‘*S3rv1d0r3s3ND@yc0h0st*.,’ ssh-copy-id -i root@bdserver3.dayco.local
sshpass -p ‘*S3rv1d0r3s3ND@yc0h0st*.,’ scp -o StrictHostKeyChecking=no bdserver3.dayco.local:/root/sysctl-config.sh /root
chmod +x /root/sysctl-config.sh
sed -i ‘s/quiet/quiet elevator=deadline/g’ /etc/grub2.cfg
cat >> /root/.bashrc << _EOF
export ADMIN_TOKEN=$(openssl rand -hex 10)
export OS_USERNAME=admin
export OS_PASSWORD=casa1234
export OS_TENANT_NAME=OpenstackSIGIS
export OS_AUTH_URL=http://db-cloudcontroller:5000/v2.0/
export SERVICE_ENDPOINT=http://db-cloudcontroller:35357/v2.0/
export SERVICE_TOKEN=\$ADMIN_TOKEN
alias desetear=”unset SERVICE_TOKEN; unset SERVICE_ENDPOINT”
alias deseteartodo=”unset ADMIN_TOKEN; unset OS_USERNAME; unset OS_PASSWORD; unset ADMIN_PASSWORD; unset SERVICE_PASSWORD; unset OS_TENANT_NAME; unset OS_AUTH_URL; unset SERVICE_ENDPOINT; unset SERVICE_TOKEN”
alias ListarServicios=”keystone –os-token=\$ADMIN_TOKEN –os-endpoint http://db-cloudcontroller:35357/v2.0 service-list”
alias ListarUsuarios=”keystone –os-token=\$ADMIN_TOKEN –os-endpoint http://db-cloudcontroller:35357/v2.0 user-list”
alias ListarTenants=”keystone –os-token=\$ADMIN_TOKEN –os-endpoint http://db-cloudcontroller:35357/v2.0 tenant-list”
alias ListarRoles=”keystone –os-token=\$ADMIN_TOKEN –os-endpoint http://db-cloudcontroller:35357/v2.0 role-list”
alias ListarEndpoints=”keystone –os-token=\$ADMIN_TOKEN –os-endpoint http://db-cloudcontroller:35357/v2.0 endpoint-list”
alias VerificarIdentity=”keystone –os-username=admin –os-password=casa1234 –os-tenant-name=OpenstackSIGIS –os-auth-url=http://db-cloudcontroller:35357/v2.0 token-get”
alias VerificarUsuarios=”keystone –os-username=admin –os-password=casa1234 –os-tenant-name=OpenstackSIGIS –os-auth-url=http://db-cloudcontroller:35357/v2.0 user-list”
_EOF
source /root/.bashrc
iptables -F
openstack-config –set /etc/keystone/keystone.conf DEFAULT admin_token $ADMIN_TOKEN
keystone-manage db_sync
systemctl restart openstack-keystone.service && systemctl enable openstack-keystone.service
keystone-manage pki_setup
chown -R keystone:keystone /etc/keystone/*
sed -i ‘s/::/#::/g’ /etc/hosts
systemctl restart network.service
systemctl restart postgresql.service
updatedb

keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 tenant-create –name OpenstackSIGIS –description “Contenedor por defecto NO BORRAR”;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 user-create –tenant-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 tenant-list | grep ‘OpenstackSIGIS’ |awk ‘{print $2}’) –name admin –pass casa1234 ;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 role-create –name admin;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 role-create –name Member;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 user-role-add –user-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 user-list | grep ‘admin’ |awk ‘{print $2}’) –tenant-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 tenant-list | grep ‘OpenstackSIGIS’ |awk ‘{print $2}’) –role-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 role-list | grep ‘admin’ |awk ‘{print $2}’);
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 tenant-create –name service –description “Service Tenant”;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 user-create –tenant-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 tenant-list | grep ‘OpenstackSIGIS’ |awk ‘{print $2}’) –name glance –pass glance;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 user-role-add –user-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 user-list | grep ‘glance’ |awk ‘{print $2}’) –tenant-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 tenant-list | grep ‘service’ | awk ‘{print $2}’) –role-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 role-list | grep ‘admin’ | awk ‘{print $2}’);
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 user-create –tenant-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 tenant-list | grep ‘service’ | awk ‘{print $2}’) –name nova –pass nova;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 user-role-add –user-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 user-list | grep ‘admin’ |awk ‘{print $2}’) –tenant-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 tenant-list | grep ‘service’ | awk ‘{print $2}’) –role-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 role-list | grep ‘admin’ | awk ‘{print $2}’);
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 user-create –tenant-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 tenant-list | grep ‘service’ | awk ‘{print $2}’) –name ec2 –pass ec2;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 user-role-add –user-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 user-list | grep ‘ec2’ |awk ‘{print $2}’) –tenant-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 tenant-list | grep ‘service’ | awk ‘{print $2}’) –role-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 role-list | grep ‘admin’ | awk ‘{print $2}’);
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 user-create –tenant-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 tenant-list | grep ‘service’ | awk ‘{print $2}’) –name swift –pass swiftpass;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 user-role-add –user-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 user-list | grep ‘swift’ |awk ‘{print $2}’) –tenant-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 tenant-list | grep ‘service’ | awk ‘{print $2}’) –role-id $(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 role-list | grep ‘admin’ | awk ‘{print $2}’);
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 service-create –name=keystone –type=identity –description=”Keystone Identity Service”;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0 endpoint-create –region RegionOne –service-id=$(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 service-list | grep ‘keystone’ | awk ‘{print $2}’) –publicurl=http://db-cloudcontroller:5000/v2.0 –internalurl=http://db-cloudcontroller:5000/v2.0 –adminurl=http://db-cloudcontroller:35357/v2.0
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0/ service-create –name=nova –type=compute –description=”Nova Compute Service”;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0/ endpoint-create –region RegionOne –service-id=$(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 service-list | grep ‘nova’ | awk ‘{print $2}’) –publicurl=’http://db-cloudcontroller:8774/v2/%(tenant_id)s&#8217; –internalurl=’http://db-cloudcontroller:8774/v2/%(tenant_id)s&#8217; –adminurl=’http://db-cloudcontroller:8774/v2/%(tenant_id)s&#8217;;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0/ service-create –name=volume –type=volume –description=”Nova Volume Service”;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0/ endpoint-create –region RegionOne –service-id=$(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 service-list | grep ‘volume’ | awk ‘{print $2}’) –publicurl=’http://db-cloudcontroller:8776/v1/%(tenant_id)s&#8217; –internalurl=’http://db-cloudcontroller:8776/v1/%(tenant_id)s&#8217; –adminurl=’http://db-cloudcontroller:8776/v1/%(tenant_id)s&#8217;;

keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0/ service-create –name=glance –type=image –description=”Glance Image Service”;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0/ endpoint-create –region RegionOne –service-id=$(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 service-list | grep ‘glance’ | awk ‘{print $2}’) –publicurl=http://db-cloudcontroller:9292/v1 –internalurl=http://db-cloudcontroller:9292/v1 –adminurl=http://db-cloudcontroller:9292/v1;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0/ service-create –name=ec2 –type=ec2 –description=”EC2 Compatibility Layer”;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0/ endpoint-create –region RegionOne –service-id=$(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 service-list | grep ‘ec2’ | awk ‘{print $2}’) –publicurl=http://db-cloudcontroller:8773/services/Cloud –internalurl=http://db-cloudcontroller:8773/services/Cloud –adminurl=http://db-cloudcontroller:8773/services/Admin;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0/ service-create –name=swift –type=object-store –description=”Object Storage Service”;
keystone –token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –endpoint http://db-cloudcontroller:35357/v2.0/ endpoint-create –region RegionOne –service-id=$(keystone –os-token $(grep admin_token /etc/keystone/keystone.conf | head -n 1 |awk ‘{print $3}’) –os-endpoint http://db-cloudcontroller:35357/v2.0 service-list | grep ‘swift’ | awk ‘{print $2}’) –publicurl ‘http://db-cloudcontroller:8888/v1/AUTH_%(tenant_id)s&#8217; –adminurl ‘http://db-cloudcontroller:8888/v1&#8217; –internalurl ‘http://db-cloudcontroller:8888/v1/AUTH_%(tenant_id)s&#8217;;

keystone –os-username=admin –os-password=casa1234 –os-auth-url=http://db-cloudcontroller:35357/v2.0 token-get
desetear
keystone token-get
keystone user-list
keystone –os-username=admin –os-password=casa1234 –os-tenant-name=OpenstackSIGIS –os-auth-url=http://db-cloudcontroller:35357/v2.0 token-get
openstack-config –set /etc/glance/glance-api.conf paste_deploy flavor keystone
openstack-config –set /etc/glance/glance-registry.conf paste_deploy flavor keystone
openstack-config –set /etc/glance/glance-api-paste.ini filter:authtoken admin_tenant_name service
openstack-config –set /etc/glance/glance-api-paste.ini filter:authtoken admin_user glance
openstack-config –set /etc/glance/glance-api-paste.ini filter:authtoken admin_password glance
openstack-config –set /etc/glance/glance-registry-paste.ini filter:authtoken admin_tenant_name service
openstack-config –set /etc/glance/glance-registry-paste.ini filter:authtoken admin_user glance
openstack-config –set /etc/glance/glance-registry-paste.ini filter:authtoken admin_password glance
for svc in api registry; do systemctl stop openstack-glance-$svc.service; done
for svc in api registry; do systemctl start openstack-glance-$svc.service; done
for svc in api registry; do systemctl enable openstack-glance-$svc.service; done
for svc in api registry; do systemctl status openstack-glance-$svc.service; done
chown glance.glance /var/log/glance/registry.log
glance-manage db_sync
glance index
nova-manage db sync
openstack-config –set /etc/nova/api-paste.ini filter:authtoken admin_tenant_name service
openstack-config –set /etc/nova/api-paste.ini filter:authtoken admin_user admin
openstack-config –set /etc/nova/api-paste.ini filter:authtoken admin_password casa1234
openstack-config –set /etc/nova/nova.conf DEFAULT auth_strategy keystone
for svc in api objectstore compute network scheduler cert; do systemctl restart openstack-nova-$svc.service; done
for svc in api objectstore compute network scheduler cert; do systemctl enable openstack-nova-$svc.service; done
clear
for svc in api objectstore compute network scheduler cert; do systemctl status openstack-nova-$svc.service; done
sed -i “s’admin_tenant_name = %SERVICE_TENANT_NAME%’admin_tenant_name = service’g” /etc/nova/nova.conf
sed -i “s’admin_user = %SERVICE_USER%’admin_user = admin’g” /etc/nova/nova.conf
sed -i “s’admin_password = %SERVICE_PASSWORD%’admin_password = casa1234’g” /etc/nova/nova.conf
glance index
systemctl enable memcached.service
systemctl restart memcached.service
systemctl enable tgtd.service
systemctl restart tgtd.service
systemctl restart httpd.service && systemctl enable httpd.service
sed -i “s;CACHE_BACKEND = ‘locmem://’;CACHE_BACKEND = ‘memcached://127.0.0.1:11211/’;g” /etc/openstack-dashboard/local_settings
nova-manage network create openstackvnet 10.0.0.0/24 1 256 –bridge=openstackbr0
modprobe nbd

cat > /etc/motd << _EOF
#######################################################
##
## OPENSTACK – CLOUD CONTROLLER
##
## Servicios Manuales:
##
## Openstack – openstack-services start/stop/status
## Nova – nova-services start/stop/status
##
#######################################################
_EOF
cat > /bin/openstack-service << _EOF
#!/bin/bash
#############################
# Elaborado por David Bompart
# 24/04/2013
############################

function IniciarOpenstack()
{
for i in \`ls /usr/lib/systemd/system/openstack*.service\`
do systemctl start \`basename \$i\`
done
}

function DetenerOpenStack()
{
for i in \`ls /usr/lib/systemd/system/openstack*.service\`
do systemctl stop \`basename \$i\`
done
}

function EstadoOpenStack()
{
for i in \`ls /usr/lib/systemd/system/openstack*.service\`
do systemctl status \`basename \$i\`
done
}

case \$1 in

start)
echo “Iniciando todos los servicios OpenStack”
IniciarOpenStack
;;
stop)
echo “Parando todos los servicios OpenStack”
DetenerOpenStack
;;
status)
echo “Listando el estado de todos los servicios OpenStack”
EstadoOpenStack
;;
restart)
echo “Parando todos los servicios OpenStack”
DetenerOpenStack
echo “Iniciando todos los servicios OpenStack”
IniciarOpenStack
echo “Listando el estado de todos los servicios OpenStack”
EstadoOpenStack
;;
*) echo “Opción desconocida, uso \$0 start|stop|restart|status”
;;
esac
_EOF
chmod +x /bin/openstack-service
iptables -F

cat > /bin/nova-service << _EOF
#!/bin/bash
#############################
# Elaborado por David Bompart
# 24/04/2013
############################
SERVICIOS=”libvirtd openstack-nova-cert openstack-nova-network openstack-nova-compute openstack-nova-api openstack-nova-objectstore openstack-nova-scheduler openstack-nova-volume openstack-nova-consoleauth novnc”
REVERSE=”novnc openstack-nova-consoleauth openstack-nova-volume openstack-nova-scheduler openstack-nova-objectstore openstack-nova-api openstack-nova-compute openstack-nova-network openstack-nova-cert libvirtd”

function IniciarNova()
{
#/etc/init.d/rabbitmq-server start
for servicio in \$SERVICIOS
do
service \$servicio start
done
}

function DetenerNova()
{
for servicio in \$REVERSE
do
service \$servicio stop
done
#/etc/init.d/rabbitmq-server stop
}

function EstadoNova()
{
for servicio in \$REVERSE
do
service \$servicio status
done
#/etc/init.d/rabbitmq-server stop
}

 

case \$1 in

start)
echo “Iniciando todos los servicios nova”
IniciarNova
;;
stop)
echo “Parando todos los servicios nova”
DetenerNova
;;
status)
echo “Listando el estado de todos los servicios Nova”
EstadoNova
;;
restart)
echo “Parando todos los servicios nova”
DetenerNova
echo “Iniciando todos los servicios nova”
IniciarNova
echo “Listando el estado de todos los servicios Nova”
EstadoNova
;;
*) echo “Opción desconocida, uso \$0 start|stop|restart”
;;
esac
_EOF
chmod +x /bin/nova-service
iptables -F

cd ~; nova keypair-add mykey > oskey.priv
chmod 600 oskey.priv
updatedb
keystone-manage db_sync
glance-manage db_sync
nova-manage db sync
. /root/sysctl-config.sh

reboot; exit

                                        lspci
                                         |
                                Es alguna de estas?
                                        4301
                                        4303
                                        4306
                                        4309
                                        4311
                                        4312
                                        4318
                                       /    \
                                      /      \
                                     /        \
                                    /          \
                                  Si           No
                                  /              \
                                 /                \
                                /                  \
                             lsmod                4310?
                              /                   /   \
                             /                   /     \
                            /                  Si      No
                          b43                  /         \
                        cargado?               /          43XG
                        /    \           ndiswrapper   4313,43224
                       /      No                        4321,43225
                      /        \                         4322,43227
                     /          \                         4328,43228
                   Si       b43legacy                        /  \
                   /          cargado?                      /    \
                  /           /     \                    Si      No
                 /          Si      No                   /         \
                /           /         \                 /           \
             4306?         /           \          broadcom-wl      4320?
            4311?      Install        4311?                     (desde lsusb
           4318?      version 3        4312?                   u otros medios)
           /   \      firmware         /   \                        /    \
          /     \                     /     \                      /      \
        Si      No                  Si      No                   Si       No
        /         \                 /         \                  /          \
       /           \               /           \                /            \
b43-openfwwf     Instalar     broadcom-wl   ndiswrapper    b43-openfwwf   ndiswrapper
    o          version 4                                       o
  Instalar     del firmware                                  rndis_wlan
 version 4
 del firmware



Para Versión 4:

yum -y install wget
mkdir -p /opt/wlan
cd opt/wlan/
wget http://downloads.openwrt.org/sources/broadcom-wl-4.150.10.5.tar.bz2
tar xjf broadcom-wl-4.150.10.5.tar.bz2
cd broadcom-wl-4.150.10.5/driver
b43-fwcutter -w /lib/firmware wl_apsta_mimo.o
systemctl restart NetworkManager.service

Para otras e información adicional, ver: http://forums.fedoraforum.org/showthread.php?t=239922

Información extraída de http://forums.fedoraforum.org/showthread.php?t=239922