Configurando container no OpenVZ 7 como Servidor de Aplicação do LTSP-Cluster

# Configurando container no OpenVZ 7 como
# Servidor de Aplicação do LTSP-Cluster

# Listando Templates OS EZ para Containers
vzpkg list -O

# Criando Container:
prlctl create CT2 --vmtype ct --ostemplate ubuntu-14.04-x86_64

# Listing Virtual Machines and Containers 
prlctl list -a

# Configuring Main VSwap Parameters
prlctl set CT2 --memsize 12G --swappages 6G

# Increasing Disk Capacity
prl_disk_tool resize --hdd \
/vz/private/d9068bc5-085f-47b0-87d3-f82574575eaa/root.hdd --size 30G

# Listing Virtual Networks
prlsrvctl net list

# Creating Virtual Networks
prlsrvctl net add Bridged

# Configuring Virtual Network Parameters
prlsrvctl net set Bridged -t bridged --ifname eno1 \
-d "This is now a bridged virtual network"

# Connecting Virtual Networks to Adapters
prlsrvctl net set Bridged -i eno1

# Creating and Deleting veth Network Adapters
prlctl set CT2 --netif_add netif2

# Configuring veth Adapter Parameters
prlctl set CT2 --ifname netif2 --ipadd
prlctl set CT2 --ifname netif2 --dhcp no
prlctl set CT2 --ifname netif2 --nameserver,
prlctl set CT2 --ifname netif2 --gw

# Connecting Containers to Virtual Networks
prlctl set CT2 --ifname netif2 --network Bridged

# Container tunig
# You need to make a character device named /dev/fuse 
# and grant your container permissions to it 
vzctl set CT2 --devnodes fuse:rw --save

# Configurando servidor de aplicação do LTSP-Cluster no
# container CT2 previamente criado
prlctl enter CT2
apt-get update
apt-get upgrade
apt-get install ubuntu-gnome-desktop ltsp-server \
ltsp-cluster-lbagent ltsp-cluster-accountmanager
apt-get install gnome-session-flashback ltspfs
apt-get remove --purge gnome-screensaver compiz
apt-get autoremove && apt-get autoclean
update-rc.d -f nbd-server remove
update-rc.d -f gdm remove
update-rc.d -f bluetooth remove
update-rc.d -f pulseaudio remove
chown root.fuse /dev/fuse
chmod 660 /dev/fuse
mkdir -p /home/ltsp-cluster-accountmanager

vim /etc/ltsp/accountmanager.conf
# Início d conteúdo do arquivo
# /etc/ltsp/accountmanager.conf
# Final do conteúdo do arquivo
# /etc/xdg/autostart/pulseaudio-module-suspend-on-idle.desktop

service ltsp-cluster-accountmanager restart

vim /etc/xdg/autostart/pulseaudio-module-suspend-on-idle.desktop
# Início do conteúdo do arquivo
# /etc/xdg/autostart/pulseaudio-module-suspend-on-idle.desktop
[Desktop Entry]
Name=PulseAudio Session Management
Comment=Load module-suspend-on-idle into PulseAudio
Exec=pactl load-module module-suspend-on-idle
# Final do conteúdo do arquivo
# /etc/xdg/autostart/pulseaudio-module-suspend-on-idle.desktop

Criando snapshotting de container OpenVZ


Segue abaixo trecho retirado do manual do OpenVZ relacionado ao assunto.


Snapshotting is a feature based on checkpointing and ploop shapshots. It allows to save a complete state of container file system. Plus, if the container is running, it’s in-memory state (as in checkpointing). Note that snapshot functionality is only working for containers on ploop device.

snapshot CTID [--id uuid] [--name name] [--description desc]
[--skip-suspend] [--skip-config]

Creates a container snapshot, i.e. saves the current container state, including its file system state, running processes state, and configuration file.

If a container is running, and --skip-suspend option is not specified, a container is checkpointed and then restored, and CT memory dump becomes the part of snapshot.

Unless --skip-config option is given, container configuration file is saved to the snapshot.

If uuid is not specified, it is auto-generated. Options --name and --description can be used to specify the snapshot name and description, respectively. Name is displayed by snapshot-list.

snapshot-switch CTID [--skip-resume | --must-resume] [--skip-config] --id uuid

Switches the container to a snapshot identified by uuid, restoring its file system state, configuration (if available) and its running state (if available).

Note that the current state of a container (including its file system state and its configuration file) is lost!

Option --skip-resume is used to ignore a CT memory dump file in a snapshot, as a result the container will end up being in a stopped state (same as if a snapshot has been taken with --skip-suspend).

If option --must-resume is set, absense of a memory dump is treated as an error, and the inability to restore from the memory dump is treated as an error rather than warning.

Option option --skip-config is used to ignore the CT configuration file in a snapshot, i.e. the current configuration file will be left as is.

snapshot-delete CTID --id uuid

Removes a specified snapshot.

snapshot-mount CTID --id uuid --target directory

Mounts a snapshot specified by uuid to a directory. Note this mount is read-only.

snapshot-umount CTID --id uuid

Unmounts a specified snapshot.
snapshot-list CTID [-H] [-o field[,field...] [--id uuid]

List container’s snapshots.

You can suppress displaying header using -H option.

You can use the -o option to display only the specified field(s). List of available fields can be obtained using -L option.