Sometimes it is useful, expedient, or desirable to be able to roll
back the entire DNS-DHCP LXC container to an earlier state. This is
very useful for example when a VM has been deployed on an Orabuntu-LXC
physical host, and then Orabuntu-LXC was deployed in the VM also, and
then some subsequent testing and development was done, and now it is
desired to update the code and retry the operations. Because the
containers have DNS records in the zone files of the containerized
DNS-DHCP, simply restoring a snapshot of the VM will NOT get the system
back to the starting state before the operations, because the zone file
DNS records still exist in the containerized DNS-DHCP that runs on the
physical LXC host. Therefore, for this and
other scenarios, Orabuntu-LXC introduced a snapshot facility for rolling
back the DNS-DHCP to an earlier state, for example before any
containers were created on an Orabuntu-LXC VM. Orabuntu-LXC takes an
lxc-snapshot automatically of the primary LXC containerized DNS-DHCP
early in it's installation steps, before the LXC containerized DNS-DHCP
is touched, so that the LXC containerized DNS-DHCP can be rolled back to
pre-install configuration. A listing of
an LXC snapshots of an Orabuntu-LXC containerized DNS-DHCP which is
supporting LXC containers installed on the Orabuntu-LXC physical host,
and a few VM's that get their IP address and DNS services from the same
containerized DNS-DHCP is shown below. ubuntu@ubuntu-ThinkPad-P72:~/Downloads/orabuntu-lxc-6.11.4-beta/products$ sudo lxc-snapshot -n afns1 -L -C snap2 (/var/lib/lxc/afns1/snaps) 2019:04:08 13:29:09 ubuntu1810A pre-install nameserver snapshot snap1 (/var/lib/lxc/afns1/snaps) 2019:04:07 21:57:04 oracle76.urdomain1.com pre-install nameserver snapshot snap0 (/var/lib/lxc/afns1/snaps) 2019:03:30 09:53:50 hub nameserver post-install snapshot snap4 (/var/lib/lxc/afns1/snaps) 2019:04:12 14:35:54 ubuntu1810B pre-install nameserver snapshot snap3 (/var/lib/lxc/afns1/snaps) 2019:04:11 11:11:54 ubuntu1810B pre-install nameserver snapshot ubuntu@ubuntu-ThinkPad-P72:~/Downloads/orabuntu-lxc-6.11.4-beta/products$ The various snaps are described below.
There
are two snaps (snap3, and snap4) for Ubuntu 1810B VM, because the
developer wanted to retest, so the VM was restored to a pre-install
snapshot, and so there are multiple snaps (3 and 4) of that VM because
the Orabuntu-LXC install was run twice on that VM. These duplicate
snapshots of re-runs on a specific VM can be manually pruned back as
needed. Once, for example, the VM has been
restored to the earlier pre-install snapshot, then before doing the
Orabuntu-LXC install again, run the following steps. On an Ubuntu Linux
host, those steps are are shown below. NOTE: It is sometimes necessary to stop and start the LXC DNS DHCP container TWICE before the desired state is returned. Use nslookup to verify that only the desired prior-state lookups are returning values. sudo lxc-stop -n afns1 Stop LXC containerized DNS-DHCP sudo lxc-snapshot -n afns1 -L -C List available snapshots sudo lxc-snapshot -n afns1 -r snap3 Restore snapshot snap3 sudo lxc-snapshot -n afns1 -d snap4 Delete snap4 which is essentially the same as snap3 sudo lxc-start -n afns1 Start LXC containerized DNS-DHCP container sudo service systemd-resolved restart Clear the DNS cache of systemd-resolved nslookup oel76c12 Verify DNS lookup fails (record no longer exists in zone file) |
Configuration >