Seleziona una pagina

Blog

Blog

Virtualization: “choose your dress model and size”

Posted on Feb 8, 2019

Pepeeta - Virtualization

Virtualization is a technique used in several IT scenarios; it acts by astracting hardware and devices and providing them to the systems and applications executed on a given physical server.
A virtualization process manages and makes available system resources, including processor, memory, storage and network.
The use of this technology provides the ability to host and run several systems and/or application groups on a single physical system, thus maximizing the use of hardware resources and optimizing logistics, costs and power consumption.
Virtualization architectures make generally use of a hypervisor, a monitor program, often called VMM (Virtual Machine Monitor), which is a program that provides the abstraction layer the virtual systems need in order to gain access to the physical system resources (processor time, memory, devices and peripeherals).
The physical device running the hypervisor is called host, while the running virtual machines are called guests.

Hypervisor Types

Type 1 hypervisor

This type of hypervisor is executed directly “in contact” with physical devices, that is to say without an underlying operating system.
The advantage of this solution, as understandable, is the best performance achievable (due to the
lack of unneeded OS activity) and perhaps the highest security, given the lack of elements and services of the OS which are often the main attack target of malicious activity.
Within this this class of hypervisors we can mention Vmware ESXi, Microsoft Hyper-V and
KVM, the last one being actually an operating system (Linux), which provides the KVM subsystem the possibility to share access to physical resources with the kernel.

Type 2 hypervisor

A type 2 hypervisor is installed on top of an existing operating system, and relies on it to handle CPU, memory, storage and network calls.
In this type of architecture latency times can not be totally eliminated when accessing resources
(unavoidable latency).
Type 2 hypervisor is always a convenient choice in development, prototyping and testing environments where performance is not a primary concern.
Within this this class of hypervisors we can mention are VMware Fusion, Oracle VM VirtualBox, Oracle VM Server for x86, Oracle Solaris Zones, Parallels and VMware Workstation.

Container-based approach

This technique is having a growing popularity in recent years as an alternative or complement to hypervisor solutions.

LXC / libcontainer

Similar to other OS level Linux virtualization systems, such as OpenVZ and Linux-VServer,
or, in other Unix operating systems FreeBSD jails, AIX workload partitions and
Solaris containers.
LXC allows the execution of multiple isolated Linux systems (containers) on a single host.
It gives the existing OS the interface with the “containment” capabilities it provides. Containers execute their code directly in the host CPU (even if they are apperar isolated from each other), thus avoiding the need for a translation layer.

The main solutions that make use of the LXC approach are:

LXD, which provides, by using LXC, the capability to run several isolated instances of any shape of Linux OS. From this point of view it can be considered a “container hypervisor” that acts in cooperation with LXC rather than a regular hypervisor.

Docker, which is a container system targeted to system and application distribution.
Docker images contain an embedded filesystem that allows the “dockerized” applications to find
the necessary components directly inside itself.
While LXC accesses directly the host system filesystem, Docker container systems see it through an abstraction layer.

OpenVZ

OpenVZ (Open Virtuozzo) is a OS level virtualization technology for Linux.
It allows a server to run multiple isolated instances of the Linux OS, called containers, private virtual servers (VPS) or virtual environments (VE). OpenVZ is similar in its approach to Solaris
Containers and LXC.
Memory allocation with OpenVZ is “soft” because in this virtual environment unused memory can be used by other containers or for disk caching.
While the earlier versions of OpenVZ shared a common file system (where each environment was just an isolated directory subtree), the latest versions of OpenVZ provide each container its own filesystem.

* * * * * * * * * *

La virtualizzazione è una tecnica, utilizzata in vari scenari IT, che opera astraendo hardware e dispositivi dalle applicazioni che vengono eseguite sullo specifico server fisico.
Il processo di virtualizzazione gestisce e rende disponibili le risorse del sistema, ivi includendo il processore, la memoria, lo storage e la rete.
Conseguenza immediata di quest’approccio è la possibilità di ospitare ed eseguire contemporaneamente su un singolo sistema fisico più sistemi operativi e/o gruppi di applicazioni, massimizzando l’uso delle risorse hardware a disposizione ed ottimizzando costi e consumi.
La virtualizzazione necessita in generale di un hypervisor, talvolta indicato anche con il termine VMM (Virtual Machine Monitor), un programma che fornisce lo strato di astrazione che permette di tradurre l’accesso a risorse virtuali (processore, memoria, periferiche) in accesso a quelle fisiche effettivamente presenti.
Il dispositivo fisico su cui il processo hypervisor viene eseguito è detto host, le macchine virtuali in esecuzione sono definite guest.

Tipi di hypervisor

Hypervisor di tipo 1

Questo tipo di hypervisor viene eseguito direttamente “a contatto” con i dispositivi fisici, vale a dire in assenza di un sistema operativo sottostante.
Il vantaggio, com’è comprensibile, è la migliore performance (in assenza di attività superflue legate all’assenza del S.O.) e alla migliore sicurezza, data l’assenza di elementi e servizi del S.O. che costituiscono il prevalente bersaglio di attacco di attività fraudolente.
Membri di questa classe di hypervisor sono Vmware ESXi, Microsoft Hyper-V e KVM.
Quest’ultimo in realtà è un hypervisor di tipo 1 (direttamente a contatto con i dispositivi) anche se viene eseguito all’interno di un sistema operativo (Linux), che mette a disposizione di KVM a possibilità di condividere l’accesso alle risorse fisiche con il kernel.

 

Hypervisor di tipo 2

Un hypervisor di tipo 2 è generalmente installato su di un sistema operativo preesistente, e fa affidamento su quest’ultimo per gestire le chiamate a CPU, memoria, storage e rete. In questo tipo di approccio, sono presenti tempi di latenza non eliminabili nell’accesso alle risorse (unavoidable latency).
L’hypervisor di tipo 2 è tuttavia, una comoda scelta negli ambienti di sviluppo, prototipazione e test, ove la performance non sia una preoccupazione primaria.
Hypervisor di livello 2 sono VMware Fusion, Oracle VM VirtualBox, Oracle VM Server for x86, Oracle Solaris Zones, Parallels e VMware Workstation.

 

Approccio Container-Based

Come alternativa o complemento alle tecniche hypervisor-based negli ultimi anni si vanno affermando tecniche di virtualizzazione basate sull’approccio a container.

 

LXC /libcontainer

Simile ad altri sistemi di virtualizzazione a livello di sistema operativi presenti in Linux, come OpenVZ e Linux-VServer, ed in altri sistemi operativi Unix-based: le jail di FreeBSD, le workload partitions AIX e i container di Solaris.
LXC permette l’esecuzione di più sistemi Linux isolati (container) su un singolo host.
Esso fornisce al sistema operativo esterno l’interfaccia per le funzionalità di “containment”. I container eseguono le proprie operazioni direttamente sulla CPU host (seppure isolati tra loro) eliminando la necessità di uno strato di traduzione.

I principali utilizzatori dell’approccio LXC sono:

LXD è un sistema di container che fa uso di LXC, nel quale si possono avviare istanza separate di isolate del sistema operativo Linux. Da questo punto di vista può essere considerato un “hypervisor di container” che agisce in tandem con LXC.

Docker è un container system orientato principalmente alla distribuzione di applicazioni. Le immagini Docker contengono al loro interno un filesystem che permette alle applicazioni stesse di reperire le componenti necessarie direttamente al suo interno. Mentre LXC accede direttamente al filesystem della macchina host, per Docker questo è invece un’astrazione.

OpenVZ

OpenVZ (Open Virtuozzo) è una tecnologia di virtualizzazione a livello di sistema operativo per Linux. Consente ad un server fisico di eseguire più istanze isolate del sistema operativo, chiamate container, server virtuali privati (VPS) o ambienti virtuali (VE). OpenVZ è simile nel proprio approccio a Solaris Containers e LXC.
L’allocazione della memoria con OpenVZ è di tipo “soft” in quanto la memoria non utilizzata in un ambiente virtuale può essere utilizzata da altri o per la cache del disco.
Mentre le vecchie versioni di OpenVZ utilizzavano un file system comune (dove ogni ambiente virtuale è solo un sottoalbero di directory isolato usando chroot), le versioni recenti di OpenVZ consentono a ciascun contenitore di avere il proprio file system.