## Augmentation de la ram
## Augmentation du cpu
## Augmentation de la bande passante
* couper un zs
xm destroy zsX
* starter un zs
xm create /home/xen/confdomU/zs1
* lister les zs qui tournent
xm list
* augmenter la RAM
xm mem-set zsX 1024 xm mem-set zsX 512
virsh setmaxmem zs1 2048000 virsh setmem zs1 2048000
* augmenter le nombre de vcpu
* lire la config en cours d'utilisation sur un zs
xm list # permet de lister la ram utilisé et le nombre de vcpu
## uptime xm uptime
#### CPU #### ## Lister le poid cpu de chaque zs
xm sched-credit -d zsX
## un zs ne peut utiliser par defaut que x% d'un coeur
xm sched-credit -d zsX -c 50 # 50% d'un coeur max xm sched-credit -d zsX -c 200 # maximum 2-CPU
## lister les CPU alloués à un ZS
xm vcpu-list zsX
## Allouer un nombre n de cpu a un guest :
xm vcpu-set zsX n
#### pour 22 parts / xen0 ####
xm mem-set zsX 512 ## 512 de ram / guest xm vcpu-set zsX 1 ## pas plus d'un CPU virtuel / guest xm sched-credit -d zsX -c 50 ## Un guest peut consomer maxi 50% d'un core
#### HDD ####
## statistique hdd
virsh # domblkstat zs1 sda1
### Attacher un nouveau device a un zs.
virsh attach-disk 5 /dev/mapper/zs-zs2--2 sda2 --driver phy
#### Une conf supra simple exemple de domU géré avec xm ####
kernel = "/root/kernelU/boot/vmlinuz-2.6.31.6" memory = 512 name = "zs1" vif = [ 'ip=81.93.248.161' ] ip="81.93.248.161" disk = [ 'phy:zs/zs1,sda1,w' ] root = "/dev/xvda1 ro"
#### Une conf de dom0 qui n'est pas faite avec du bridge à la con qui pue. #####
* xend-config.sxp
(logfile /var/log/xen/xend.log) (loglevel DEBUG) (xend-unix-server yes) (xend-unix-path /var/lib/xend/xend-socket) (xend-relocation-hosts-allow '^localhost$ ^localhost\\.localdomain$') (network-script 'network-route netdev=eth0') (vif-script vif-route) (dom0-min-mem 512) (enable-dom0-ballooning yes) (dom0-cpus 0) (vncpasswd '')
##### zs1.xml niquel pour la libvirt qui rox ####
* zs1.xml
<domain type='xen' id='5'> <name>zs1</name> <uuid>ed0a5cf4-0098-45e5-2d62-1068c1610f28</uuid> <memory>524288</memory> <currentMemory>524288</currentMemory> <vcpu>1</vcpu> <bootloader></bootloader> <os> <type>linux</type> <kernel>/root/kernelU/boot/vmlinuz-2.6.31.6</kernel> <cmdline>root=/dev/xvda1 ro ip=81.93.248.161:127.0.255.255::::eth0:off </cmdline> </os> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <disk type='block' device='disk'> <driver name='phy'/> <source dev='nbd1'/> <target dev='sda1' bus='scsi'/> </disk> <interface type='ethernet'> <mac address='00:16:3e:29:1c:a3'/> <ip address='81.93.248.161'/> <script path='/etc/xen/scripts/vif-route'/> <target dev='vif5.0'/> </interface> <console type='pty' tty='/dev/pts/1'> <source path='/dev/pts/1'/> <target port='0'/> </console> </devices> </domain>
* centoszs.pl
#!/usr/bin/perl use strict; #### Variables ##### my ($hostname,$domaine,$ip,$mask,$network,$brd,$route,$passwd,$dns) = @ARGV; ################## REDHAT Like ############################# ####################################################### ### script d'installation des ZS ####################################################### open(HOST, ">/etc/hostname"); print HOST "$hostname.$domaine\n"; close(HOST); open(HOSTS, ">/etc/hosts"); print HOSTS "127.0.0.1 localhost\n"; print HOSTS "$ip $hostname.$domaine $hostname\n"; print HOSTS "# IPV6 versions of localhost and co\n"; print HOSTS "::1 ip6-localhost ip6-loopback\n"; print HOSTS "fe00::0 ip6-localnet\n"; print HOSTS "ff00::0 ip6-mcastprefix\n"; print HOSTS "ff02::1 ip6-allnodes\n"; print HOSTS "ff02::2 ip6-allrouters\n"; print HOSTS "ff02::3 ip6-allhosts\n"; close(HOSTS); open(NET, ">/etc/sysconfig/network-scripts/ifcfg-eth0"); print NET "# \The primary network interface\n"; print NET "DEVICE=eth0\n"; print NET "BOOTPROTO=static\n"; print NET "IPADDR=$ip\n"; print NET "NETMASK=$mask\n"; print NET "ONBOOT=yes\n"; print NET "GATEWAY=$route\n"; print NET "TYPE=Ethernet\n"; close(NET); open(DNS, ">/etc/resolv.conf"); print DNS "search $domaine\n"; print DNS "nameserver $dns\n"; print DNS "domain $domaine\n"; close(DNS); ##### Configuration du mot de passe root ##### my $commande = "echo 'root:$passwd' | chpasswd"; my $resultat = system($commande); ## ## On set la route par defaut # my $droute = "route add default gw $route"; my $result = system($droute);
* debianzs.pl
#!/usr/bin/perl use strict; #### Variables ##### my ($hostname,$domaine,$ip,$mask,$network,$brd,$route,$passwd,$dns) = @ARGV; ################## DEBIAN ############################# ####################################################### ### script d'installation des ZS ####################################################### open(HOST, ">/etc/hostname"); print HOST "$hostname.$domaine\n"; close(HOST); open(HOSTS, ">/etc/hosts"); print HOSTS "127.0.0.1 localhost\n"; print HOSTS "$ip $hostname.$domaine $hostname\n"; print HOSTS "# IPV6 versions of localhost and co\n"; print HOSTS "::1 ip6-localhost ip6-loopback\n"; print HOSTS "fe00::0 ip6-localnet\n"; print HOSTS "ff00::0 ip6-mcastprefix\n"; print HOSTS "ff02::1 ip6-allnodes\n"; print HOSTS "ff02::2 ip6-allrouters\n"; print HOSTS "ff02::3 ip6-allhosts\n"; close(HOSTS); open(NET, ">/etc/network/interfaces"); print NET "auto lo\n"; print NET "iface lo inet loopback\n"; print NET "# \The primary network interface\n"; print NET "auto eth0\n"; print NET "iface eth0 inet static\n"; print NET "address $ip\n"; print NET "netmask $mask\n"; print NET "network $network\n"; print NET "broadcast $brd\n"; print NET "gateway $route\n"; close(NET); open(DNS, ">/etc/resolv.conf"); print DNS "search $domaine\n"; print DNS "nameserver $dns\n"; print DNS "domain $domaine\n"; close(DNS); ##### Configuration du mot de passe root ##### my $commande = "echo 'root:$passwd' | chpasswd"; my $resultat = system($commande); ## ## On set la route par defaut # my $droute = "route add default gw $route"; my $result = system($droute);
* gentoozs.pl
#!/usr/bin/perl use strict; #### Variables ##### my ($hostname,$domaine,$ip,$mask,$network,$brd,$route,$passwd,$dns) = @ARGV; ################## GENTOO ############################# ####################################################### ### script d'installation des ZS ### Ce script prend en parametre : ### $1 hostname ### $2 domaine ### $3 ip/mask ### $4 route ### $5 mot de passe root du zs ### $6 dns ####################################################### ## On set le hostname du zs open(HOST, ">/etc/conf.d/hostname"); print HOST "HOSTNAME=\"$hostname\"\n"; close(HOST); ## on set le resolve.conf open(RESOLV, ">/etc/resolv.conf"); print RESOLV "nameserver $dns\n"; close(RESOLV); ##### On configure son hosts ##### open(HOSTS, ">/etc/hosts"); print HOSTS "127.0.0.1 localhost\n"; print HOSTS "$ip $hostname.$domaine $hostname\n"; print HOSTS "# IPV6 versions of localhost and co\n"; print HOSTS "::1 ip6-localhost ip6-loopback\n"; print HOSTS "fe00::0 ip6-localnet\n"; print HOSTS "ff00::0 ip6-mcastprefix\n"; print HOSTS "ff02::1 ip6-allnodes\n"; print HOSTS "ff02::2 ip6-allrouters\n"; print HOSTS "ff02::3 ip6-allhosts\n"; close(HOSTS); ##### Configuration du reseau des zs gentoo ##### open(NET, ">/etc/conf.d/net"); print NET "config_eth0=( \"$ip netmask $mask brd $brd\" )\n"; print NET "routes_eth0=( \"default gw $route\" )\n"; print NET "dns_domain_eth0=\"$domaine\"\n"; print NET "dns_servers_eth0=\"$dns\"\n"; close(NET); ##### Configuration du mot de passe root ##### my $commande = "echo 'root:$passwd' | chpasswd"; my $resultat = system($commande); ## On set la route par defaut my $droute = "route add default gw $route"; my $result = system($droute);