vr_services - OpenNebula/one-apps GitHub Wiki
OpenRC Services
Each feature of the VR is represented by an OpenRC service. There are two types of such services, some are one-shot like NAT4,
and others are daemons like SDNAT4 or HAProxy.
To list all running services, run rc-status:
$ rc-status
Runlevel: default
 keepalived                                       [  started  ]
 one-failover                                     [  started  ]
 haveged                                          [  started  ]
 crond                                            [  started  ]
 qemu-guest-agent                                 [  started  ]
 sshd                                             [  started  ]
 acpid                                            [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
 sysfs                                            [  started  ]
 udev                                             [  started  ]
 fsck                                             [  started  ]
 root                                             [  started  ]
 localmount                                       [  started  ]
 udev-trigger                                     [  started  ]
 udev-settle                                      [  started  ]
Dynamic Runlevel: manual
 iptables                                         [  started  ]
 one-lvs                                          [  started  ]
 one-sdnat4                                       [  started  ]
 one-dhcp4v2                                      [  started  ]
 one-dns                                          [  started  ]
 one-haproxy                                      [  started  ]
 one-nat4                                         [  started  ]
 unbound                                          [  started  ]
 one-context-reconfigure                          [  started  ]
 one-router4                                      [  started  ]
 haproxy                                          [  started  ]
 one-context-reconfigure-delayed                  [  started  ]
To start/stop/restart a service:
$ rc-service <openrc-service> <start | stop | restart>
The list of OpenRC services implementing each of the virtual router features are describes in the table below: The table below lists the OpenRC services and the VR features they implement:
| OpenRC Service | Type | Runlevel | Config Path (INPUT) | Config Path (OUTPUT) | Log Path | 
|---|---|---|---|---|---|
keepalived | 
daemon | 
default | 
/etc/keepalived/ (dir) | 
/var/log/messages | 
|
one-failover | 
daemon | 
default | 
/run/one-context/one_env | 
/var/log/one-appliance/one-failover.log | 
|
one-lvs | 
daemon | 
manual | 
/run/one-context/one_env | 
/etc/keepalived/conf.d/lvs.conf | 
/var/log/one-appliance/one-lvs.log | 
one-router4 | 
oneshot | 
manual | 
/run/one-context/one_env | 
/etc/sysctl.d/98-Router4.conf | 
/var/log/one-appliance/one-router4.log | 
iptables | 
oneshot | 
manual | 
/etc/iptables/ (dir) | 
/etc/iptables/ (dir) | 
/var/log/messages | 
one-nat4 | 
oneshot | 
manual | 
/run/one-context/one_env | 
(iptables -t nat) | /var/log/one-appliance/one-nat4.log | 
one-sdnat4 | 
daemon | 
manual | 
/run/one-context/one_env | 
(iptables -t nat) | /var/log/one-appliance/one-sdnat4.log | 
haproxy | 
daemon | 
manual | 
/etc/haproxy/ (dir) | 
/var/log/messages | 
|
one-haproxy | 
daemon | 
manual | 
/run/one-context/one_env | 
/etc/haproxy/ (dir) | 
/var/log/one-appliance/one-haproxy.log | 
unbound | 
daemon | 
manual | 
/etc/unbound/ (dir) | 
/var/log/unbound/ (dir) | 
|
one-dns | 
daemon | 
manual | 
/run/one-context/one_env | 
/etc/unbound/ (dir) | 
/var/log/one-appliance/one-dns.log | 
one-dhcp4v2 | 
daemon | 
manual | 
/run/one-context/one_env | 
/etc/one-appliance/service.d/VRouter/DHCP4v2/coredhcp-onelease/onelease-config.yml | 
/var/log/one-appliance/one-dhcp4v2.log | 
[!NOTE] Services prefixed with
one-have been designed to automatically manage their counterparts (if present), so for example stoppingone-haproxyautomatically stops thehaproxyservice as well, etc.
Contextualization
Each feature of the VR goes through three lifecycle steps:
| Step | Frequency | Log Path | Description | 
|---|---|---|---|
install | 
once | 
/var/log/one-appliance/install.log | 
Install required software and render OpenRC scripts. | 
configure | 
recurring | 
/var/log/one-appliance/configure.log | 
Render static configuration files. | 
bootstrap | 
recurring | 
/var/log/one-appliance/bootstrap.log | 
No operation for VR. | 
[!NOTE] The
installstage is executed during image build, only once.
[!NOTE] The
configureandbootstrapstages are executed every time (re)contextualization takes place, i.e. on occasions like: initial deployment, reboot, context modification, NIC attach, etc.
[!NOTE] During (re)contextualization the
one-contextddaemon creates (among others) the/run/one-context/one_envfile, which is then loaded for each of the OpenRC services as environment variables (configuration).