Security:Vasum:Zone Lifecycle

From Tizen Wiki
Jump to: navigation, search

This Wiki page covers Zone Lifecycle, and goes in-depth available Zone states.

Zone Lifecycle

Throughout its existence, Zone can go through three different states:

  • Stopped - This is the very first state which Zone enters after definition. Vasum Server is aware of defined Zone, the Zone has all its initialization work done and all required files are created. Zone is registered in LXC and awaits for launch.
  • Running - In this state, Zone is launched and its environment is fully functional. Zone can enter this state in one of two ways - either from Stopped, or from Paused states.
  • Paused - Here Zone has its internal work suspended. The environment launched inside Zone has its execution suspended, and the Zone awaits for switch back to Running state. This state is sometimes called Frozen.

The following flowchart shows how specific states relate to each other throughout Zones lifetime (the field (nil) is a theoretical starting point - a state where Zone is not defined and Vasum Server does not know of its existence):

Vasum dynamic configuration database structure

In order to preserve Zone states after Vasum Server reboot, Zones state is saved into dynamic configuration database after each state change. When Vasum server is relaunched, it restores Zone state from state saved in the dynamic configuration.

Example scenarios of going through Zone Lifecycle

The following scenarios show basic Zone usage and going through their lifecycles using Vasum CLI tool.

All scenarios assume we start with clean Host environment (there are no Zones created beforehand).

Create -> start -> shutdown -> destroy

1. Create Zone "testZone" (this creates Zone's rootfs and config files)

   vasum-cli create_zone testZone

2. [OPTIONAL] Show status information about registered Zones

   vasum-cli get_zones_status

This produces output:

   Active  Id         State    Terminal  Root
           testZone   STOPPED  3         /opt/usr/zones/opt/testZone/rootfs

3. Start testZone

   vasum-cli start_zone testZone

4. Shutdown testZone

   vasum-cli shutdown_zone testZone

5. Destroy testZone (remove any files and folders related to that Zone)

   vasum-cli destroy_zone testZone